cups-usb-paperout.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. diff -up cups-1.5b1/backend/usb-unix.c.usb-paperout cups-1.5b1/backend/usb-unix.c
  2. --- cups-1.5b1/backend/usb-unix.c.usb-paperout 2011-05-24 15:51:39.000000000 +0200
  3. +++ cups-1.5b1/backend/usb-unix.c 2011-05-24 15:51:39.000000000 +0200
  4. @@ -30,6 +30,11 @@
  5. #include <sys/select.h>
  6. +#ifdef __linux
  7. +#include <sys/ioctl.h>
  8. +#include <linux/lp.h>
  9. +#endif /* __linux */
  10. +
  11. /*
  12. * Local functions...
  13. @@ -334,7 +339,19 @@ open_device(const char *uri, /* I - Dev
  14. if (!strncmp(uri, "usb:/dev/", 9))
  15. #ifdef __linux
  16. {
  17. - return (open(uri + 4, O_RDWR | O_EXCL));
  18. + fd = open(uri + 4, O_RDWR | O_EXCL);
  19. +
  20. + if (fd != -1)
  21. + {
  22. + /*
  23. + * Tell the driver to return from write() with errno==ENOSPACE
  24. + * on paper-out.
  25. + */
  26. + unsigned int t = 1;
  27. + ioctl (fd, LPABORT, &t);
  28. + }
  29. +
  30. + return fd;
  31. }
  32. else if (!strncmp(uri, "usb://", 6))
  33. {
  34. @@ -400,7 +417,14 @@ open_device(const char *uri, /* I - Dev
  35. if (!strcmp(uri, device_uri))
  36. {
  37. /*
  38. - * Yes, return this file descriptor...
  39. + * Yes, tell the driver to return from write() with
  40. + * errno==ENOSPACE on paper-out.
  41. + */
  42. + unsigned int t = 1;
  43. + ioctl (fd, LPABORT, &t);
  44. +
  45. + /*
  46. + * Return this file descriptor...
  47. */
  48. fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n",