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