SCSI scanner device ownership and permissions

Paul Howarth paul at city-fan.org
Fri Aug 12 06:53:33 UTC 2005


On Fri, 2005-08-12 at 02:02 -0400, D. Hugh Redelmeier wrote:
> | From: Paul Howarth <paul at city-fan.org>
> 
> | What type of scanner do you have?
> | 
> | Please post the output of:
> | # udevinfo -a -p $(udevinfo -q path -n /dev/sg0)
> 
> Sure.  What does this tell you?

It tells me how to write a udev rule that will create an appropriate
link for your scanner at boot time :-)

> [root at redtape hugh]# udevinfo -a -p $(udevinfo -q path -n /dev/sg0)
> 
> udevinfo starts with the device the node belongs to and then walks up the
> device chain, to print for every device found, all possibly useful attributes
> in the udev key format.
> Only attributes within one device section may be used together in one rule,
> to match the device for which the node will be created.
> 
> device '/sys/class/scsi_generic/sg0' has major:minor 21:0
>   looking at class device '/sys/class/scsi_generic/sg0':
>     SUBSYSTEM=="scsi_generic"
>     SYSFS{dev}=="21:0"
> 
> follow the "device"-link to the physical device:
>   looking at the device chain at '/sys/devices/pci0000:00/0000:00:08.0/host0/target0:0:5/0:0:5:0':
>     BUS=="scsi"
>     ID=="0:0:5:0"
>     DRIVER=="unknown"
>     SYSFS{device_blocked}=="0"
>     SYSFS{iocounterbits}=="32"
>     SYSFS{iodone_cnt}=="0x6"
>     SYSFS{ioerr_cnt}=="0x0"
>     SYSFS{iorequest_cnt}=="0x6"
>     SYSFS{model}=="Astra 1200S     "
>     SYSFS{queue_depth}=="2"
>     SYSFS{queue_type}=="none"
>     SYSFS{rev}=="V2.9"
>     SYSFS{scsi_level}=="3"
>     SYSFS{state}=="running"
>     SYSFS{timeout}=="0"
>     SYSFS{type}=="6"
>     SYSFS{vendor}=="UMAX    "

Create a file /etc/udev/rules.d/10-custom.rules containing the following
line:

BUS="scsi", SYSFS{vendor}="UMAX*", SYSFS{model}="Astra*",
SYMLINK="scanner%n"

You should get an appropriate symlink created next time the sg module is
loaded (e.g. at reboot). The name of the symlink is such that the
existing "console" rules will change ownership of the device to the
currently-logged-in user.

Paul.
-- 
Paul Howarth <paul at city-fan.org>




More information about the fedora-list mailing list