Sane permissions script

I haven't checked lately, but it's likely that modern udev sets
permissions up correctly. This script should work if it doesn't.

Original readme:

Just a short word about setting up sane.

You've just plugged in your shiny new scanner, selected the right
backend and tried to run xsane but get permision denied. So you run
it as root and find it works. Great but running as root in the long
term is not the answer.

What you now need to do is set up correct permissions to run xsane as
a normal user. Hopefully you are in the 'scanner' group. If not, get
yourself in it:

Replace your needed groups as you like, but as root it's roughly:

usermod -G floppy,audio,video,cdrom,plugdev,power,scanner username
groups username

Now find the usb device that your scanner is using:

scanimage -L

Hopefully you get output like the following:

device `snapscan:libusb:001:002' is a EPSON EPSON Scanner1 flatbed scanner

The parts we are interesting in are the numbers 001 and 002. This
means that the scanner is using /proc/bus/usb/001/002 and this is the
file we need to change permissions of:

as root again:

chown root:scanner /proc/bus/usb/001/002
chmod g+rw /proc/bus/usb/001/002

This sets group ownership and allows users in scanner group rw
access. Now you should be able to scan.

But you've just resumed your pc from hibernation or suspension and
now the usb device has changed. That's why I created the scanperms
script - it will find your scanner and set the permissions. You can
source/run the file from your hibernation script and
/etc/rc.d/rc.local