From c37d71b1a31d26a4790166e2508822b18934a5c0 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 13 Apr 2021 15:44:14 +0200 Subject: [PATCH 1/2] backend/usb-libusb.c: Use 60s timeout for reading at backchannel Some older models malfunction if timeout is too short. --- backend/usb-libusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index d6b0eb423..fbb0d9d89 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -1704,7 +1704,7 @@ static void *read_thread(void *reference) readstatus = libusb_bulk_transfer(g.printer->handle, g.printer->read_endp, readbuffer, rbytes, - &rbytes, 250); + &rbytes, 60000); if (readstatus == LIBUSB_SUCCESS && rbytes > 0) { fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n", (int)rbytes); From 4cb6f6806cdbe040d478b266a1d351b19341dd79 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 13 Apr 2021 15:47:37 +0200 Subject: [PATCH 2/2] backend/usb-libusb.c: Revert enforcing read limits This commit reverts the change introduced by 2.2.12 [1] - its implementation caused a regression with Lexmark filters. [1] https://github.com/apple/cups/commit/35e927f83529cd9b4bc37bcd418c50e307fced35 --- backend/usb-libusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index fbb0d9d89..89b5182f7 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -1721,7 +1721,8 @@ static void *read_thread(void *reference) * Make sure this loop executes no more than once every 250 miliseconds... */ - if ((g.wait_eof || !g.read_thread_stop)) + if ((readstatus != LIBUSB_SUCCESS || rbytes == 0) && + (g.wait_eof || !g.read_thread_stop)) usleep(250000); } while (g.wait_eof || !g.read_thread_stop);