Re: matching udev attribute keys
On Mon, Dec 27, 2010 at 2:26 PM, Camaleón wrote: > On Mon, 27 Dec 2010 13:20:37 -0500, Tom H wrote: >> On Mon, Dec 27, 2010 at 10:17 AM, Camaleón wrote: >>> On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: >>> how do I know that "SerialNumber" is a valid udev key other than the fact that it is listed in dmesg when the device is plugged in. >>> >>> For instance, my USB key has at least one "ATTRS{serial}" value: >>> >>> s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial >>> ATTRS{serial}==":00:1a.7" >>> >>> But not my internal hard disks, neither from udevinfo: >>> >>> s...@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial >>> s...@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial >>> s...@stt008:~$ >> >> Question: >> >> You use the equivalent of "udevadm info --attribute-walk >> --path=/sys/block/sda". >> >> What if you use "udevadm info --query=property --path=/sys/block/sda" >> and it outputs an "ID_SERIAL"? Can it be used in a udev rule? > > I'd say yes, provided it is an ENV (E) key and you write the propper rule: > > http://www.reactivated.net/writing_udev_rules.html#env Thanks. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktin1ay8o8izdrxdot9yxj9rlswfahojil5cnj...@mail.gmail.com
Re: matching udev attribute keys
On Mon, 27 Dec 2010 13:20:37 -0500, Tom H wrote: > On Mon, Dec 27, 2010 at 10:17 AM, Camaleón wrote: >> On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: >> >>> how do I know that "SerialNumber" is a valid udev key other than the >>> fact that it is listed in dmesg when the device is plugged in. >> >> For instance, my USB key has at least one "ATTRS{serial}" value: >> >> s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial >> ATTRS{serial}==":00:1a.7" >> >> But not my internal hard disks, neither from udevinfo: >> >> s...@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial >> s...@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial >> s...@stt008:~$ > > Question: > > You use the equivalent of "udevadm info --attribute-walk > --path=/sys/block/sda". > > What if you use "udevadm info --query=property --path=/sys/block/sda" > and it outputs an "ID_SERIAL"? Can it be used in a udev rule? I'd say yes, provided it is an ENV (E) key and you write the propper rule: http://www.reactivated.net/writing_udev_rules.html#env Look: stt008:~# udevadm info --query all --name=/dev/sdb P: /block/sdb N: sdb S: block/8:16 S: disk/by-id/ata-ST3500320NS_ S: disk/by-id/scsi-SATA_ST3500320NS_ S: disk/by-path/pci-:00:1f.2-scsi-1:0:0:0 E: ID_VENDOR=ATA E: ID_MODEL=ST3500320NS E: ID_REVISION=SN06 E: ID_SERIAL=SATA_ST3500320NS_ E: ID_SERIAL_SHORT= E: ID_TYPE=disk E: ID_BUS=scsi E: ID_ATA_COMPAT=ST3500320NS_xxx E: ID_PATH=pci-:00:1f.2-scsi-1:0:0:0 "P" must be "path", "N" must be "name", "S" must be "symlink" and "E" has to be "environment". Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pan.2010.12.27.19.26...@gmail.com
Re: matching udev attribute keys
On Mon, Dec 27, 2010 at 10:17 AM, Camaleón wrote: > On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: > >> how do I know that "SerialNumber" is a valid udev key other than the >> fact that it is listed in dmesg when the device is plugged in. > > For instance, my USB key has at least one "ATTRS{serial}" value: > > s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial > ATTRS{serial}==":00:1a.7" > > But not my internal hard disks, neither from udevinfo: > > s...@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial > s...@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial > s...@stt008:~$ Question: You use the equivalent of "udevadm info --attribute-walk --path=/sys/block/sda". What if you use "udevadm info --query=property --path=/sys/block/sda" and it outputs an "ID_SERIAL"? Can it be used in a udev rule? -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktinmhx7zuavt0m4xajÊaj=ghfsstf__=mqe...@mail.gmail.com
Re: matching udev attribute keys
On Mon, Dec 27, 2010 at 7:07 PM, wrote: > On Mon, 27 Dec 2010 15:17:01 + (UTC) > Camaleón wrote: >> On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: >> >> > how do I know that "SerialNumber" is a valid udev key other than the >> > fact that it is listed in dmesg when the device is plugged in. >> >> Available information for the sysfs attributes can be fetched (if >> present): >> >> http://reactivated.net/writing_udev_rules.html#sysfstree >> >> For what I see, this means that you can use both ("sysfstree" >> attribute values and "udevinfo" ones) for writing rules, just ensure >> the attribute you are going to use is present in one of the locations >> from where udev gathers the data. >> >> For instance, my USB key has at least one "ATTRS{serial}" value: >> >> s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial >> ATTRS{serial}==":00:1a.7" >> > > This is the problem, I can't get the above format because I can't find > the udevinfo program ! > > I'm running unstable and the package search says it doesn't exist. > > Is there some way to use udev to give the same format ? udevadm info ... -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/aanlktim8qtooezcjh6-hklegfhgaojbpsd0iyq2w7...@mail.gmail.com
Re: matching udev attribute keys
On Mon, 27 Dec 2010 16:09:06 -0800, briand wrote: > On Mon, 27 Dec 2010 15:17:01 + (UTC) Camaleón wrote: > >> On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: >> >> > how do I know that "SerialNumber" is a valid udev key other than the >> > fact that it is listed in dmesg when the device is plugged in. >> >> (...) >> >> Available information for the sysfs attributes can be fetched (if >> present): >> >> http://reactivated.net/writing_udev_rules.html#sysfstree (...) > the scroogle provides: > > $ udevinfo -a -p $(udevinfo -q path -n /dev/ttyS1) # NOTE: Debian sid > has renamed this utility to udevadm. The equivalent command is below: # > udevadm info --name=/dev/ttyS1 --attribute-walk http://wiki.debian.org/udev Then use the suggested tool, it should be same with another name ;-) Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pan.2010.12.27.16.18...@gmail.com
Re: matching udev attribute keys
On Mon, 27 Dec 2010 15:17:01 + (UTC) Camaleón wrote: > On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: > > > how do I know that "SerialNumber" is a valid udev key other than the > > fact that it is listed in dmesg when the device is plugged in. > > (...) > > Available information for the sysfs attributes can be fetched (if > present): > > http://reactivated.net/writing_udev_rules.html#sysfstree > > For what I see, this means that you can use both ("sysfstree" > attribute values and "udevinfo" ones) for writing rules, just ensure > the attribute you are going to use is present in one of the locations > from where udev gathers the data. > > For instance, my USB key has at least one "ATTRS{serial}" value: > > s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial > ATTRS{serial}==":00:1a.7" > the scroogle provides: $ udevinfo -a -p $(udevinfo -q path -n /dev/ttyS1) # NOTE: Debian sid has renamed this utility to udevadm. The equivalent command is below: # udevadm info --name=/dev/ttyS1 --attribute-walk Brian -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20101227160906.7ce0a...@windy.deldotd.com
Re: matching udev attribute keys
On Mon, 27 Dec 2010 15:17:01 + (UTC) Camaleón wrote: > On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: > > > how do I know that "SerialNumber" is a valid udev key other than the > > fact that it is listed in dmesg when the device is plugged in. > > (...) > > Available information for the sysfs attributes can be fetched (if > present): > > http://reactivated.net/writing_udev_rules.html#sysfstree > > For what I see, this means that you can use both ("sysfstree" > attribute values and "udevinfo" ones) for writing rules, just ensure > the attribute you are going to use is present in one of the locations > from where udev gathers the data. > > For instance, my USB key has at least one "ATTRS{serial}" value: > > s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial > ATTRS{serial}==":00:1a.7" > This is the problem, I can't get the above format because I can't find the udevinfo program ! I'm running unstable and the package search says it doesn't exist. Is there some way to use udev to give the same format ? Thanks for the examples. Brian -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20101227160727.70178...@windy.deldotd.com
Re: matching udev attribute keys
On Sun, 26 Dec 2010 15:58:08 -0800, briand wrote: > how do I know that "SerialNumber" is a valid udev key other than the > fact that it is listed in dmesg when the device is plugged in. (...) Available information for the sysfs attributes can be fetched (if present): http://reactivated.net/writing_udev_rules.html#sysfstree For what I see, this means that you can use both ("sysfstree" attribute values and "udevinfo" ones) for writing rules, just ensure the attribute you are going to use is present in one of the locations from where udev gathers the data. For instance, my USB key has at least one "ATTRS{serial}" value: s...@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial ATTRS{serial}==":00:1a.7" But not my internal hard disks, neither from udevinfo: s...@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial s...@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial s...@stt008:~$ Nor from sysfs: s...@stt008:~$ ls -l /sys/block/sda | grep -i serial s...@stt008:~$ ls -l /sys/block/sdb | grep -i serial s...@stt008:~$ Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/pan.2010.12.27.15.17...@gmail.com
matching udev attribute keys
Hi all, how do I know that "SerialNumber" is a valid udev key other than the fact that it is listed in dmesg when the device is plugged in. I cannot for the life of me get a udev rule for a device to match on the serial number, even though the number is in the dmesg file. I know that my rule works because I removed the SerialNumber attribute, and matched on the KERNEL device only, which worked flawlessly. I've notice that sudo udevadm info --query=property --name=/dev/disk/by-label/NAME produces ID_SERIAL ID_SERIAL_SHORT etc... none of which seem to match what I find in the rules files, e.g. SerialNumber. Can someone bridge the gap ? How do I ensure that the ATTR keyword I use is something that udev will really match on ? Thanks, Brian P.S. yes I've tried using ATTRS{ID_SERIAL_SHORT}, etc..., WHICH IS FROM udevadm info, and nothing other than the kernel device works. However the information IS showing up in the dmesg output. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20101226155808.3cf50...@windy.deldotd.com