cups/cups-usb-paperout.patch

52 lines
1.1 KiB
Diff
Raw Normal View History

--- cups-1.2.10/backend/usb-unix.c.usb-paperout 2007-06-26 15:11:14.000000000 +0100
+++ cups-1.2.10/backend/usb-unix.c 2007-06-26 15:16:23.000000000 +0100
@@ -39,6 +39,11 @@
#include "ieee1284.c"
#include <sys/select.h>
+#ifdef __linux
+#include <sys/ioctl.h>
+#include <linux/lp.h>
+#endif /* __linux */
+
/*
* Local functions...
@@ -308,7 +313,19 @@
if (!strncmp(uri, "usb:/dev/", 9))
#ifdef __linux
{
- return (open(uri + 4, O_RDWR | O_EXCL));
+ fd = open(uri + 4, O_RDWR | O_EXCL);
+
+ if (fd != -1)
+ {
+ /*
+ * Tell the driver to return from write() with errno==ENOSPACE
+ * on paper-out.
+ */
+ unsigned int t = 1;
+ ioctl (fd, LPABORT, &t);
+ }
+
+ return fd;
}
else if (!strncmp(uri, "usb://", 6))
{
@@ -374,7 +391,14 @@
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);
+
+ /*
+ * Return this file descriptor...
*/
fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);