Package: foo2zjs / 20200505dfsg0-1

0020-Prevent-an-infinite-loop-when-loading-the-firmware.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From: Didier Raboud <odyx@debian.org>
Date: Tue, 4 Oct 2016 11:44:03 +0200
Subject: Prevent an infinite loop when loading the firmware.

 When using the load_cups method, the CUPS backend will internally
 unload and reload the usblp module. This will generate
 SUBSYSTEM=usbmisc events that need to be ignored in the CUPS code
 path, or this script will be rerun in an infite loop.

 But when using the load_usblp method, the usblp module is obviously
 needed. So in this situation we need to ignore the SUBSYSTEM=usb
 events.
Bug-Debian: http://bugs.debian.org/663868
Author: Peter De Wachter <pdewacht@gmail.com>
---
 hplj1000 | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/hplj1000 b/hplj1000
index 2cd24b9..0461f24 100755
--- a/hplj1000
+++ b/hplj1000
@@ -24,12 +24,6 @@
 #		Mike Morgan (2004)
 #
 
-# udev calls us twice on FC4! Just want /dev/usb/lp<N>
-case "$DEVNAME" in
-/dev/usb/usb*)	exit;;	# Bug: FC4
-/dev/bus/usb/*)	exit;;	# Bug: Ubuntu 14
-esac
-
 PROGNAME="$0"
 
 #
@@ -261,6 +255,7 @@ if [ "$DEV" != "" ]; then
     #
     # force downloading to a specific device
     #
+    if [ "$SUBSYSTEM" != "usbmisc" ]; then exit; fi
     load_usblp "$DEV"
 elif [ -x $USB_BACKEND ]; then
         #
@@ -268,11 +263,13 @@ elif [ -x $USB_BACKEND ]; then
         # not need to care whether the system uses the usblp kernel module or
         # libusb 
         #
+        if [ "$SUBSYSTEM" != "usb" ]; then exit; fi
         load_cups
 elif [ -x $PRINTERID ]; then
 	#
 	# Sniff around for printers that need a firmware download
 	#
+	if [ "$SUBSYSTEM" != "usbmisc" ]; then exit; fi
 	usblps=`find /dev/usb -type c -name 'lp*'`" "`find /dev -type c -name 'usblp*'`
 	for dev in $usblps; do
 	    status=`$PRINTERID $dev 2>/dev/null | grep -y "hp LaserJet $MODEL"`