Bug#399367: no way to map DeviceURI to device name
Package: cupsys
Version: 1.1.23-10sarge1
Severity: normal
I was trying to write a script for udev that could automatically
enable my printer if I turn it on. However, cups uses device URIs
like "usb://Samsung/ML-1610" in printers.conf, which are impossible to
map onto USB ids, device names or other sysfs properties. Therefore
it is impossible to find out from outside of cups which printer was
connected or turned on.
Internally, cups determines which usb device an USB DeviceURI belongs
to by polling all present usb printers (i.e., all devices in
/dev/usb/lp*) and ioctl()ling them for their ieee1281 manifacturer and
model strings.
It would be nice if cups could export this functionality (currently in
backend/ieee1284.c) to a userspace utility so that it would be
possible to check from the command line what DeviceID is associated
with a specific usb printer device. It would be even nicer if this
utility would be able to return the specific cups printer (if any) a
specific usb device is associated with (by parsing printers.conf and
matching the DeviceURI).
Something like:
> cups_usbinfo /dev/usb/lp0
DeviceURI usb://Samsung/ML-1610
Printer MySamsungPrinter
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.8-3-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Versions of packages cupsys depends on:
ii adduser 3.63 Add and remove users and groups
ii debconf 1.4.30.13 Debian configuration management sy
ii libc6 2.3.2.ds1-22sarge4 GNU C Library: Shared libraries an
ii libcupsimage2 1.1.23-10sarge1 Common UNIX Printing System(tm) -
ii libcupsys2-gnutls10 1.1.23-10sarge1 Common UNIX Printing System(tm) -
ii libgnutls11 1.0.16-13.2sarge2 GNU TLS library - runtime library
ii libpam0g 0.76-22 Pluggable Authentication Modules l
ii libpaper1 1.1.14-3 Library for handling paper charact
ii libslp1 1.0.11a-2 OpenSLP libraries
ii patch 2.5.9-2 Apply a diff file to an original
ii perl-modules 5.8.4-8sarge5 Core Perl modules
ii xpdf-utils 3.00-13.6 Portable Document Format (PDF) sui
ii zlib1g 1:1.2.2-4.sarge.2 compression library - runtime
-- debconf information excluded
Reply to: