diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-09-24 23:50:39 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-09-24 23:50:39 +0000 |
commit | 18ecb4282108afe096df4958d992c80bb5f2b570 (patch) | |
tree | d41d1b895293498ec62aa785616eb291919db0cf /backend/usb-libusb.c | |
parent | 7a0cbd5e5715d715c3fddfaace2f800ef820d328 (diff) | |
download | cups-18ecb4282108afe096df4958d992c80bb5f2b570.tar.gz |
Merge changes from CUPS 1.5svn-r8829.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1695 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'backend/usb-libusb.c')
-rw-r--r-- | backend/usb-libusb.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index d5c6ae5b6..d265d1203 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -158,7 +158,16 @@ print_device(const char *uri, /* I - Device URI */ while (poll(pfds, 2, -1) > 0) { - if (pfds[0].revents & POLLIN) + /* + * CUPS STR #3318: USB process hangs on end-of-file, making further + * printing impossible + * + * From a strict interpretation of POSIX poll(), POLLHUP should never be + * set without POLLIN, since POLLIN is the event you request. That said, + * it appears that some versions of Linux break this. + */ + + if (pfds[0].revents & (POLLIN | POLLHUP)) { if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0) { @@ -178,8 +187,13 @@ print_device(const char *uri, /* I - Device URI */ break; } - if (pfds[1].revents & POLLIN) - tbytes += side_cb(printer, print_fd); + if (pfds[1].revents & (POLLIN | POLLHUP)) + { + if ((bytes = side_cb(printer, print_fd)) < 0) + pfds[1].events = 0; /* Filter has gone away... */ + else + tbytes += bytes; + } } } @@ -745,10 +759,7 @@ side_cb(usb_printer_t *printer, /* I - Printer */ datalen = sizeof(data); if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0)) - { - _cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n")); - return (0); - } + return (-1); switch (command) { |