Archive for January 26th, 2013
SANE: Network Access to a USB Scanner in Xubuntu 12.04
Posted by Ed in PC Tweakage on 2013-01-26
The missing link turns out to be assigning a device node with the proper owner, group, and permissions to let saned
share the scanner over the network. IIRC, this worked right out of the box in previous versions of Xubuntu, but now requires manual tweakage.
That post gives the steps for my old SCSI scanner. It turns out that the udev
rule is not optional for USB scanners… at least not in 12.04, anyway.
In order to build the udev
rule, you start with lsusb
:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 0424:2504 Standard Microsystems Corp. USB 2.0 Hub Bus 002 Device 005: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter Bus 002 Device 006: ID 046d:c52f Logitech, Inc. Wireless Mouse M305 Bus 008 Device 006: ID 04a9:220e Canon, Inc. CanoScan N1240U/LiDE 30 Bus 008 Device 003: ID 413c:1003 Dell Computer Corp. Keyboard Hub Bus 008 Device 004: ID 413c:2010 Dell Computer Corp. Keyboard
That gives you the bus and device numbers, which means the corresponding device is, at least right now:
/dev/bus/usb/008/006
The udevinfo
command I used a while ago has Gone Away, replaced by udevadm
with even more syntactic sugar:
udevadm info --query=all --attribute-walk --name=/dev/bus/usb/008/006
Which produces a ton of information, starting with:
looking at device '/devices/pci0000:00/0000:00:1d.2/usb8/8-1': KERNEL=="8-1" SUBSYSTEM=="usb" DRIVER=="usb" ATTR{configuration}=="" ATTR{bNumInterfaces}==" 1" ATTR{bConfigurationValue}=="1" ATTR{bmAttributes}=="a0" ATTR{bMaxPower}=="500mA" ATTR{urbnum}=="18658" ATTR{idVendor}=="04a9" ATTR{idProduct}=="220e" ATTR{bcdDevice}=="0100" ATTR{bDeviceClass}=="ff" ATTR{bDeviceSubClass}=="00" ATTR{bDeviceProtocol}=="ff" ATTR{bNumConfigurations}=="1" ATTR{bMaxPacketSize0}=="8" ATTR{speed}=="12" ATTR{busnum}=="8" ATTR{devnum}=="6" ATTR{devpath}=="1" ATTR{version}==" 1.10" ATTR{maxchild}=="0" ATTR{quirks}=="0x0" ATTR{avoid_reset_quirk}=="0" ATTR{authorized}=="1" ATTR{manufacturer}=="Canon" ATTR{product}=="CanoScan"
Extracting the two highlighted values lets you create a udev
rule. If your udev-fu
is strong, you can pluck them directly from the lsusb
output.
I created a new file:
/etc/udev/rules.d/60-scanner.rules
Which contains this rule:
# Canon LiDE 30 scanner ATTRS{idVendor}=="04a9",ATTRS{idProduct}=="220e",SYMLINK+="scanner",MODE="0660",OWNER="root",GROUP="saned"
Based on the advice there, I added the port number to the /etc/xinetd.d/saned
stanza, but I’m not sure it’s needed:
service sane-port { port = 6566 socket_type = stream server = /usr/sbin/saned protocol = tcp user = saned group = scanner wait = no disable = no }
After doing all the rest of the saned
and xinetd
setup, unplug and replug the scanner, which should produce these devices:
ll /dev/bus/usb/008/006 /dev/scan* crw-rw----+ 1 root saned 189, 901 Jan 5 21:30 /dev/bus/usb/008/006 lrwxrwxrwx 1 root root 15 Jan 5 21:14 /dev/scanner -> bus/usb/008/006
And then it should Just Work…
Blowback