Productive Linux


 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Don't have an account?
Sign up to
Forgot your password?

Usb scanners, usb devices and permissions
9 March 2006 @ 23:03 GMT
by Paul

So there I was ready to start scanning. The scanner was plugged into the usb port, syslog said it was there, so why when I started xsane I was told 'No devices available'?

Hmmm, try doing it as root. That worked, but xsane says that using it as root was extremely naughty and that my grandmother would be roasted and eaten by cannibals, or something to that effect.

So, this was obviously a permissions problem. But the permissions of which device would I have to change?

I hit google and found this page about usb cameras. Given that I'm running hotplug and kernel 2.6, Linux sets up the device when I plug it in. That's nice, but it still didn't tell me what permissions I needed to set.

The problem unravels thusly. The file /etc/hotplug/usb/libsane.usermap contains a list of all the scanners that could be plugged in. In each case, it tells hotplug to run the script at /etc/hotplug/usb/libusbscanner. This is the meat of the script:

if [ -z "$DEVICE" ] ; then
  IF=`echo $DEVPATH | sed 's/\(bus\/usb\/devices\/\)\(.*\)-\(.*\)/\2/'`
  DEV=`echo $DEVPATH | sed 's/\(bus\/usb\/devices\/\)\(.*\)-\(.*\)/\3/'`
  DEV=`expr $DEV + 1`
  DEVICE=`printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV`

if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
  chown root:scanner "$DEVICE"
  chmod 0660 "$DEVICE"

As you can see from the second and third lines up from the bottom, the device is made read/writable by root and everyone in the 'scanner' group. So, there you have it, you have to be a member of the scanner group.

adduser paul scanner

at the command line, as root, solved the problem.

Tags: hardware

Comments disabled