USB scanner and udev

USB scanners are quite popular today, many ‘all-in-one’ devices contains them. But if you use distribution where permissions are done ‘per group’ like it is in Debian you can get hit by lack of access to your scanner.

Solution is: write own udev rule. It may sounds scary but in reality it is quite simple.

  • Run udevmonitor (it needs root access so sudo udevmonitor).
  • Unplug and plug scanner. You will get lot of output from udev monitor — only one line is needed:
UDEV  [1194523774.343853] add      /devices/pci0000:00/0000:00:13.0/usb1/1-1/usb_endpoint/usbdev1.7_ep00 (usb_endpoint)
  • Now it is time to gather more information about our device. Run udevinfo -a -p LINE_FROM_PREVIOUS_POINT and look at output. For my Epson Stylus DX4000 it shows:
  looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1':
    ATTRS{product}=="USB MFP"
  • Edit (as root) one of files in /etc/udev/rules.d/ directory (best way is creating own one — scanner.rules for example) and add there something like that (of course set “manufacturer” and “product” to value shown in previous step)
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="EPSON", ATTRS{product}=="USB MFP", GROUP="scanner"
  • Add youself into “scanner” group: sudo addgroup YOURACCOUNTNAME scanner.
  • Unplug and plug scanner — now it should be in proper group.
  • Logout and login so system will notice that you are now also in “scanner” group.
  • Launch your favourite scanning utility — I use Kooka from KDE.

As you see whole procedure can be done in few minutes without problems.