Walter Dnes writes:
> You can get the ATTRS{serial} (i.e. serial number). See the printer
> example at http://www.reactivated.net/writing_udev_rules.html and adapt
> to your hard drive. Serial numbers should be unique, even amongst
> otherwise identical drives...
>
> ======================================================================
> I power on my printer, and it is assigned device node /dev/lp0. Not
> satisfied with such a bland name, I decide to use udevinfo to aid me in
> writing a rule which will provide an alternative name:
>
> # udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
> looking at device '/class/usb/lp0':
> KERNEL=="lp0"
> SUBSYSTEM=="usb"
> DRIVER==""
> ATTR{dev}=="180:0"
>
> looking at parent device
> '/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
> SUBSYSTEMS=="usb"
> ATTRS{manufacturer}=="EPSON"
> ATTRS{product}=="USB Printer"
> ATTRS{serial}=="L72010011070626380"
>
> My rule becomes:
>
> SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380",
> SYMLINK+="epson_680"
That's exactly what I would like to have! I have a working solution, but
using UDEV would seem more adequate.
But: I cannot find a serial number for my hard drives in the output. And
shouldn't there be a file named 'serial' in /sys? I have some, but not
for my block devices, only for USB and in /sys/{bus,pci}/drivers/.
BTW, sys-fs/udev-187 does not have the 'udevinfo' command, it seems to be
'udevadm info' now.
Wonko