FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 12-26-2010, 10:58 PM
 
Default 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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101226155808.3cf50372@windy.deldotd.com">http://lists.debian.org/20101226155808.3cf50372@windy.deldotd.com
 
Old 12-27-2010, 02:17 PM
Camaleón
 
Default 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:

sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
ATTRS{serial}=="0000:00:1a.7"

But not my internal hard disks, neither from udevinfo:

sm01@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial
sm01@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial
sm01@stt008:~$

Nor from sysfs:

sm01@stt008:~$ ls -l /sys/block/sda | grep -i serial
sm01@stt008:~$ ls -l /sys/block/sdb | grep -i serial
sm01@stt008:~$

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.12.27.15.17.01@gmail.com">http://lists.debian.org/pan.2010.12.27.15.17.01@gmail.com
 
Old 12-27-2010, 03:18 PM
Camaleón
 
Default matching udev attribute keys

On Mon, 27 Dec 2010 16:09:06 -0800, briand wrote:

> On Mon, 27 Dec 2010 15:17:01 +0000 (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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.12.27.16.18.08@gmail.com">http://lists.debian.org/pan.2010.12.27.16.18.08@gmail.com
 
Old 12-27-2010, 05:04 PM
Tom H
 
Default matching udev attribute keys

On Mon, Dec 27, 2010 at 7:07 PM, <briand@aracnet.com> wrote:
> On Mon, 27 Dec 2010 15:17:01 +0000 (UTC)
> Camaleón <noelamac@gmail.com> 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:
>>
>> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
>> * * ATTRS{serial}=="0000: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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTim8qtooEZCJH6-HKLegFhGAOJbpSd0iYQ2W7vok@mail.gmail.com">http://lists.debian.org/AANLkTim8qtooEZCJH6-HKLegFhGAOJbpSd0iYQ2W7vok@mail.gmail.com
 
Old 12-27-2010, 05:20 PM
Tom H
 
Default matching udev attribute keys

On Mon, Dec 27, 2010 at 10:17 AM, Camaleón <noelamac@gmail.com> 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:
>
> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
> * *ATTRS{serial}=="0000:00:1a.7"
>
> But not my internal hard disks, neither from udevinfo:
>
> sm01@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial
> sm01@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial
> sm01@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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/AANLkTinMhx7ZUaVT0M4XajĘaJ=GhfSSTF__=MQER=T@mail.g mail.com
 
Old 12-27-2010, 06:26 PM
Camaleón
 
Default 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 <noelamac@gmail.com> 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:
>>
>> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
>> * *ATTRS{serial}=="0000:00:1a.7"
>>
>> But not my internal hard disks, neither from udevinfo:
>>
>> sm01@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial
>> sm01@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial
>> sm01@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_xxxxxxxx
S: disk/by-id/scsi-SATA_ST3500320NS_xxxxxxxx
S: disk/by-path/pci-0000: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_xxxxxxxx
E: ID_SERIAL_SHORT=xxxxxxxx
E: ID_TYPE=disk
E: ID_BUS=scsi
E: ID_ATA_COMPAT=ST3500320NS_xxxxxxx
E: ID_PATH=pci-0000: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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.12.27.19.26.59@gmail.com">http://lists.debian.org/pan.2010.12.27.19.26.59@gmail.com
 
Old 12-27-2010, 11:07 PM
 
Default matching udev attribute keys

On Mon, 27 Dec 2010 15:17:01 +0000 (UTC)
Camaleón <noelamac@gmail.com> 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:
>
> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
> ATTRS{serial}=="0000: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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101227160727.701782ad@windy.deldotd.com">http://lists.debian.org/20101227160727.701782ad@windy.deldotd.com
 
Old 12-27-2010, 11:09 PM
 
Default matching udev attribute keys

On Mon, 27 Dec 2010 15:17:01 +0000 (UTC)
Camaleón <noelamac@gmail.com> 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:
>
> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
> ATTRS{serial}=="0000: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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101227160906.7ce0a9cb@windy.deldotd.com">http://lists.debian.org/20101227160906.7ce0a9cb@windy.deldotd.com
 
Old 12-29-2010, 07:24 AM
Tom H
 
Default matching udev attribute keys

On Mon, Dec 27, 2010 at 2:26 PM, Camaleón <noelamac@gmail.com> wrote:
> On Mon, 27 Dec 2010 13:20:37 -0500, Tom H wrote:
>> On Mon, Dec 27, 2010 at 10:17 AM, Camaleón <noelamac@gmail.com> 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:
>>>
>>> sm01@stt008:~$ udevinfo -a -p /sys/block/sdc | grep serial
>>> * *ATTRS{serial}=="0000:00:1a.7"
>>>
>>> But not my internal hard disks, neither from udevinfo:
>>>
>>> sm01@stt008:~$ udevinfo -a -p /sys/block/sda | grep serial
>>> sm01@stt008:~$ udevinfo -a -p /sys/block/sdb | grep serial
>>> sm01@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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTin1AY8o8iZdrxDOT9yxJ9RLswFAHOJiL5cnJ9Mu@mail .gmail.com">http://lists.debian.org/AANLkTin1AY8o8iZdrxDOT9yxJ9RLswFAHOJiL5cnJ9Mu@mail .gmail.com
 

Thread Tools




All times are GMT. The time now is 05:15 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org