Package: python-foomatic
Severity: normal
Hi
detect_usb_printers() in detect.py fails to detect the USB printer, if
it doesn't exist on /dev/usb/lp0 . If I have two USB printers attached
and then remove the first one, udev removes /dev/usb/lp0, but keeps
/dev/usb/lp1 for the second one. The attached patch checks for such
cases and tries to specify the first lp device it finds.
Please consider including it into detect.py.
Cheers
Steffen
--- /usr/share/pyshared/foomatic/detect.py 2005-07-23 04:41:10.000000000
+0200
+++ foomatic/detect.py 2008-12-10 13:08:39.000000000 +0100
@@ -143,13 +143,25 @@
# Figure out what special files are used on this system
format = None
for fmt in ('/dev/usb/lp%d', '/dev/usb/usblp%d', '/dev/usblp%d'):
- if os.path.exists(fmt % 0):
+ if os.path.exists(fmt % 0):
format = fmt
break
+ else:
+ for i in range(USB_MAX):
+ if os.path.exists(fmt % i):
+ format = fmt
+ int = i
+ break
+ if format:
+ break
+
if not format:
+
return conns
for i in range(USB_MAX):
+ if i < int:
+ continue
device = format % i
if not os.path.exists(device): continue
data = read_ieee1284_data(device)