Accepting request 886931 from home:jsmeix:branches:Printing

Fix printing with older USB printers https://github.com/OpenPrinting/cups/pull/174

OBS-URL: https://build.opensuse.org/request/show/886931
OBS-URL: https://build.opensuse.org/package/show/Printing/cups?expand=0&rev=373
This commit is contained in:
Johannes Meixner 2021-04-20 09:14:33 +00:00 committed by Git OBS Bridge
parent 43801330ab
commit 5df04109a3
3 changed files with 69 additions and 1 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Apr 20 10:57:45 CEST 2021 - jsmeix@suse.de
- upstream_pull_174.patch is
https://github.com/OpenPrinting/cups/pull/174
"Use 60s timeout for read_thread, revert read limits"
to fix printing with older USB printers
- New upstream URL https://openprinting.github.io/cups
-------------------------------------------------------------------
Tue Apr 6 11:34:50 CEST 2021 - jsmeix@suse.de

View File

@ -34,7 +34,7 @@ Release: 0
Summary: The Common UNIX Printing System
License: Apache-2.0
Group: Hardware/Printing
URL: http://www.cups.org/
URL: https://openprinting.github.io/cups
# To get Source0 go to https://github.com/OpenPrinting/cups/releases or use e.g.
# wget --no-check-certificate -O cups-2.3.3op2-source.tar.gz https://github.com/OpenPrinting/cups/releases/download/v2.3.3op2/cups-2.3.3op2-source.tar.gz
Source0: https://github.com/OpenPrinting/cups/releases/download/v2.3.3op2/cups-2.3.3op2-source.tar.gz
@ -54,6 +54,9 @@ Source106: Postscript-level2.ppd.gz
Source108: cups-client.conf
Source109: baselibs.conf
# Patch0...Patch9 is for patches from upstream:
# Patch1 upstream_pull_174.patch is https://github.com/OpenPrinting/cups/pull/174
# Use 60s timeout for read_thread, revert read limits
Patch1: upstream_pull_174.patch
# Source10...Source99 is for sources from SUSE which are intended for upstream:
# Patch10...Patch99 is for patches from SUSE which are intended for upstream:
# Patch10 cups-2.1.0-choose-uri-template.patch adds 'smb://...' URIs to templates/choose-uri.tmpl:
@ -276,6 +279,9 @@ printer drivers for CUPS.
%prep
%setup -q
# Patch0...Patch9 is for patches from upstream:
# Patch1 upstream_pull_174.patch is https://github.com/OpenPrinting/cups/pull/174
# Use 60s timeout for read_thread, revert read limits
%patch1 -p1
# Patch10...Patch99 is for patches from SUSE which are intended for upstream:
# Patch10 cups-2.1.0-choose-uri-template.patch adds 'smb://...' URIs to templates/choose-uri.tmpl:
%patch10 -b choose-uri-template.orig

53
upstream_pull_174.patch Normal file
View File

@ -0,0 +1,53 @@
From c37d71b1a31d26a4790166e2508822b18934a5c0 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
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.
---
CHANGES.md | 1 +
backend/usb-libusb.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- 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 <zdohnal@redhat.com>
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
---
CHANGES.md | 1 +
backend/usb-libusb.c | 3 ++-
2 files changed, 3 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);