2008-11-12 16:09:54 +00:00
|
|
|
diff -up cups-1.4b1/backend/usb-unix.c.usb-paperout cups-1.4b1/backend/usb-unix.c
|
|
|
|
--- cups-1.4b1/backend/usb-unix.c.usb-paperout 2008-11-12 09:30:03.000000000 +0000
|
|
|
|
+++ cups-1.4b1/backend/usb-unix.c 2008-11-12 09:30:03.000000000 +0000
|
|
|
|
@@ -30,6 +30,11 @@
|
|
|
|
|
2007-07-23 12:19:34 +00:00
|
|
|
#include <sys/select.h>
|
2007-04-25 17:10:11 +00:00
|
|
|
|
|
|
|
+#ifdef __linux
|
|
|
|
+#include <sys/ioctl.h>
|
|
|
|
+#include <linux/lp.h>
|
|
|
|
+#endif /* __linux */
|
|
|
|
+
|
2007-06-12 09:24:24 +00:00
|
|
|
|
2007-07-23 12:19:34 +00:00
|
|
|
/*
|
|
|
|
* Local functions...
|
2008-11-12 16:09:54 +00:00
|
|
|
@@ -324,7 +329,19 @@ open_device(const char *uri, /* I - Dev
|
2007-07-23 12:19:34 +00:00
|
|
|
if (!strncmp(uri, "usb:/dev/", 9))
|
|
|
|
#ifdef __linux
|
|
|
|
{
|
|
|
|
- return (open(uri + 4, O_RDWR | O_EXCL));
|
|
|
|
+ fd = open(uri + 4, O_RDWR | O_EXCL);
|
2007-04-25 17:10:11 +00:00
|
|
|
+
|
2007-07-23 12:19:34 +00:00
|
|
|
+ if (fd != -1)
|
2007-04-25 17:10:11 +00:00
|
|
|
+ {
|
2007-07-23 12:19:34 +00:00
|
|
|
+ /*
|
|
|
|
+ * Tell the driver to return from write() with errno==ENOSPACE
|
|
|
|
+ * on paper-out.
|
|
|
|
+ */
|
|
|
|
+ unsigned int t = 1;
|
|
|
|
+ ioctl (fd, LPABORT, &t);
|
2007-04-25 17:10:11 +00:00
|
|
|
+ }
|
|
|
|
+
|
2007-07-23 12:19:34 +00:00
|
|
|
+ return fd;
|
2007-04-25 17:10:11 +00:00
|
|
|
}
|
2007-07-23 12:19:34 +00:00
|
|
|
else if (!strncmp(uri, "usb://", 6))
|
|
|
|
{
|
2008-11-12 16:09:54 +00:00
|
|
|
@@ -390,7 +407,14 @@ open_device(const char *uri, /* I - Dev
|
2007-07-23 12:19:34 +00:00
|
|
|
if (!strcmp(uri, device_uri))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
- * Yes, return this file descriptor...
|
|
|
|
+ * Yes, tell the driver to return from write() with
|
|
|
|
+ * errno==ENOSPACE on paper-out.
|
|
|
|
+ */
|
|
|
|
+ unsigned int t = 1;
|
|
|
|
+ ioctl (fd, LPABORT, &t);
|
2007-04-25 17:10:11 +00:00
|
|
|
+
|
2007-07-23 12:19:34 +00:00
|
|
|
+ /*
|
|
|
|
+ * Return this file descriptor...
|
|
|
|
*/
|
2007-04-25 17:10:11 +00:00
|
|
|
|
2008-07-15 12:48:19 +00:00
|
|
|
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n",
|