Udev rule required for scsi scanner
BACKGROUND
I only use the scanner (UMAX Astra 1200S) occasionally and the scsi module aic7xxx takes around 20 seconds to auto detect on boot, so I do not load it on boot. scsi scanners either have to be turned on at boot or detected with rescan-scsi-bus (root priveledges required). I do not want other users to have the root password, so I used to use the following method. The user would run the shell script "use_scanner" this calls a script "scanner" and then "xsane". The script "scanner" runs sudo and modprobes the scsi card then rescans the bus. xsane then runs as a normal user in the scanner group. To enable this to work /dev/sg0 had to have been changed to owner root:scanner PROBLEM udev creates /dev/sg0 root:root automatically when the scsi bus is scanned. As it is not a persistent device I cannot chown it. POTENTIAL WORK AROUNDS --------------------------------------------- I have tried to create a udev rule in /etc/udev/rules.d/10-local.rules using udevinfo but to tell you the truth I don't relly understand udev yet. Quote:
There appear to be persistent devices in /lib/udev/devices that are copied to /dev when rc.udev is started. Is this the case, and if so would it be safe to create a new sg0 device here? --------------------------------------------- What suggestions/fixes would you do? Samac |
I don't have a scanner to test this rule with, but something like this should work. Add it to your 10-local.rules:
BUS=="scsi", KERNEL=="sg*", SYSFS{model}=="Astra 1200S ", GROUP="scanner" If you really wanted to get cool you could add this to the end: SYMLINK+="scanner" This would create /dev/scanner as a symbolic link pointing to /dev/sg0. The benefit is that /dev/scanner will always work, even if you add more SCSI devices later. Check Writing udev Rules for more details. |
Many thanks marnold that worked fine.
The mistakes I made. BUS=="scsi", KERNEL=="sg0", SYSFS{Model}=="Astra 1200S ", GROUP="scanner" As you can see I tried to specify the device to sg0, I don't know if that was a mistake. I had model with a capital M (definite mistake). I also think I had KERNEL as the third item (don't know if that would be a problem). Thanks again. Samac |
All times are GMT -5. The time now is 06:45 AM. |