|
|
1d75c0 |
diff -up cups-1.5b1/backend/usb-unix.c.usb-paperout cups-1.5b1/backend/usb-unix.c
|
|
|
1d75c0 |
--- cups-1.5b1/backend/usb-unix.c.usb-paperout 2011-05-24 15:51:39.000000000 +0200
|
|
|
1d75c0 |
+++ cups-1.5b1/backend/usb-unix.c 2011-05-24 15:51:39.000000000 +0200
|
|
|
1d75c0 |
@@ -30,6 +30,11 @@
|
|
|
1d75c0 |
|
|
|
1d75c0 |
#include <sys/select.h>
|
|
|
1d75c0 |
|
|
|
1d75c0 |
+#ifdef __linux
|
|
|
1d75c0 |
+#include <sys/ioctl.h>
|
|
|
1d75c0 |
+#include <linux/lp.h>
|
|
|
1d75c0 |
+#endif /* __linux */
|
|
|
1d75c0 |
+
|
|
|
1d75c0 |
|
|
|
1d75c0 |
/*
|
|
|
1d75c0 |
* Local functions...
|
|
|
1d75c0 |
@@ -334,7 +339,19 @@ open_device(const char *uri, /* I - Dev
|
|
|
1d75c0 |
if (!strncmp(uri, "usb:/dev/", 9))
|
|
|
1d75c0 |
#ifdef __linux
|
|
|
1d75c0 |
{
|
|
|
1d75c0 |
- return (open(uri + 4, O_RDWR | O_EXCL));
|
|
|
1d75c0 |
+ fd = open(uri + 4, O_RDWR | O_EXCL);
|
|
|
1d75c0 |
+
|
|
|
1d75c0 |
+ if (fd != -1)
|
|
|
1d75c0 |
+ {
|
|
|
1d75c0 |
+ /*
|
|
|
1d75c0 |
+ * Tell the driver to return from write() with errno==ENOSPACE
|
|
|
1d75c0 |
+ * on paper-out.
|
|
|
1d75c0 |
+ */
|
|
|
1d75c0 |
+ unsigned int t = 1;
|
|
|
1d75c0 |
+ ioctl (fd, LPABORT, &t);
|
|
|
1d75c0 |
+ }
|
|
|
1d75c0 |
+
|
|
|
1d75c0 |
+ return fd;
|
|
|
1d75c0 |
}
|
|
|
1d75c0 |
else if (!strncmp(uri, "usb://", 6))
|
|
|
1d75c0 |
{
|
|
|
1d75c0 |
@@ -400,7 +417,14 @@ open_device(const char *uri, /* I - Dev
|
|
|
1d75c0 |
if (!strcmp(uri, device_uri))
|
|
|
1d75c0 |
{
|
|
|
1d75c0 |
/*
|
|
|
1d75c0 |
- * Yes, return this file descriptor...
|
|
|
1d75c0 |
+ * Yes, tell the driver to return from write() with
|
|
|
1d75c0 |
+ * errno==ENOSPACE on paper-out.
|
|
|
1d75c0 |
+ */
|
|
|
1d75c0 |
+ unsigned int t = 1;
|
|
|
1d75c0 |
+ ioctl (fd, LPABORT, &t);
|
|
|
1d75c0 |
+
|
|
|
1d75c0 |
+ /*
|
|
|
1d75c0 |
+ * Return this file descriptor...
|
|
|
1d75c0 |
*/
|
|
|
1d75c0 |
|
|
|
1d75c0 |
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n",
|