]> git.ipfire.org Git - ipfire-3.x.git/blame - cups/patches/cups-usb-paperout.patch
Move all packages to root.
[ipfire-3.x.git] / cups / patches / cups-usb-paperout.patch
CommitLineData
f92713d3
SS
1diff -up cups-1.4b1/backend/usb-unix.c.usb-paperout cups-1.4b1/backend/usb-unix.c
2--- cups-1.4b1/backend/usb-unix.c.usb-paperout 2008-11-12 09:30:03.000000000 +0000
3+++ cups-1.4b1/backend/usb-unix.c 2008-11-12 09:30:03.000000000 +0000
4@@ -30,6 +30,11 @@
5
6 #include <sys/select.h>
7
8+#ifdef __linux
9+#include <sys/ioctl.h>
10+#include <linux/lp.h>
11+#endif /* __linux */
12+
13
14 /*
15 * Local functions...
16@@ -324,7 +329,19 @@ open_device(const char *uri, /* I - Dev
17 if (!strncmp(uri, "usb:/dev/", 9))
18 #ifdef __linux
19 {
20- return (open(uri + 4, O_RDWR | O_EXCL));
21+ fd = open(uri + 4, O_RDWR | O_EXCL);
22+
23+ if (fd != -1)
24+ {
25+ /*
26+ * Tell the driver to return from write() with errno==ENOSPACE
27+ * on paper-out.
28+ */
29+ unsigned int t = 1;
30+ ioctl (fd, LPABORT, &t);
31+ }
32+
33+ return fd;
34 }
35 else if (!strncmp(uri, "usb://", 6))
36 {
37@@ -390,7 +407,14 @@ open_device(const char *uri, /* I - Dev
38 if (!strcmp(uri, device_uri))
39 {
40 /*
41- * Yes, return this file descriptor...
42+ * Yes, tell the driver to return from write() with
43+ * errno==ENOSPACE on paper-out.
44+ */
45+ unsigned int t = 1;
46+ ioctl (fd, LPABORT, &t);
47+
48+ /*
49+ * Return this file descriptor...
50 */
51
52 fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n",