* Udev rule $attr substitution
@ 2010-12-21 18:47 Josua Dietze
2010-12-21 20:25 ` Josua Dietze
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Josua Dietze @ 2010-12-21 18:47 UTC (permalink / raw)
To: linux-hotplug
Hi, everyone!
I'm scratching my head over this:
Rule line:
KERNEL="ttyUSB*" RUN+="myprog %p %s{idVendor} %s{idProduct}"
%p expands to something like:
/devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.2/ttyUSB2/tty/ttyUSB2
But the %s (or $attr) format string will not be substituted with anything when
using udev version 157. The same rule works fine with version 125.
When doing the attribute walk with "udevadm info", the attributes are of course
found in the parent chain.
Did I miss something?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
@ 2010-12-21 20:25 ` Josua Dietze
2010-12-22 8:51 ` Martin Pitt
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Josua Dietze @ 2010-12-21 20:25 UTC (permalink / raw)
To: linux-hotplug
Never mind, I figured it out.
It was all a problem of not-quite-accurate man pages.
I found the man page (well, xml file) in the git tree and just added an ATTRS
match to the top level USB device.
This worked:
KERNEL="ttyUSB*", ATTRS{bNumConfigurations}="*", RUN+="myprog %p %s{idVendor}
%s{idProduct}"
Sorry for the noise, thanks anyway.
But I might add that there is certainly some documentation lacking on this one,
practially everything I found was outdated or inaccurate ...
Josua Dietze
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
2010-12-21 20:25 ` Josua Dietze
@ 2010-12-22 8:51 ` Martin Pitt
2010-12-22 11:35 ` Josua Dietze
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Martin Pitt @ 2010-12-22 8:51 UTC (permalink / raw)
To: linux-hotplug
Hello Josua,
Josua Dietze [2010-12-21 21:25 +0100]:
> I found the man page (well, xml file) in the git tree and just added
> an ATTRS match to the top level USB device.
>
> This worked:
> KERNEL="ttyUSB*", ATTRS{bNumConfigurations}="*", RUN+="myprog %p
> %s{idVendor} %s{idProduct}"
Right, you need to "select" the parent device of which you need the
id* attribute.
> But I might add that there is certainly some documentation lacking
> on this one, practially everything I found was outdated or
> inaccurate ...
This is indeed a common trap, so some time ago I tried to point this
out more clearly in the manpage:
$attr{file}, %s{file}
The value of a sysfs attribute found at the device, where all keys
of the rule have matched. If the matching device does not have such
an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS
test selected a parent device, use the attribute from that parent
device.
This tries to point out that this won't match attributes from any
parent device. Do you think this paragraph is unclear? If so, do you
have a suggestion how to improve it? Or did you not see it in the
first place?
Thank you,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
2010-12-21 20:25 ` Josua Dietze
2010-12-22 8:51 ` Martin Pitt
@ 2010-12-22 11:35 ` Josua Dietze
2010-12-22 15:58 ` Martin Pitt
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Josua Dietze @ 2010-12-22 11:35 UTC (permalink / raw)
To: linux-hotplug
Am 22.12.2010 09:51, schrieb Martin Pitt:
>> But I might add that there is certainly some documentation lacking
>> on this one, practially everything I found was outdated or
>> inaccurate ...
>
> This is indeed a common trap, so some time ago I tried to point this
> out more clearly in the manpage:
>
> $attr{file}, %s{file}
> The value of a sysfs attribute found at the device, where all keys
> of the rule have matched. If the matching device does not have such
> an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS
> test selected a parent device, use the attribute from that parent
> device.
>
> This tries to point out that this won't match attributes from any
> parent device. Do you think this paragraph is unclear? If so, do you
> have a suggestion how to improve it? Or did you not see it in the
> first place?
The entry in the current man page is fine.
I was broadly referring to the documentation floating around in the
Web, examples, howtos and forum discussions. Nothing of your
responsibility, really.
What's a bit unfortunate though is the discrepancy between man pages
and functionality of versions before the man page correction.
OpenSUSE 11.3 ships with v. 157 which claims to do the upward chain
search for $attr but doesn't.
Maybe an "official" udev page consisting of the current man page and
two or three additional notes regarding changes in previously
available features would help. Or does it exist and I missed it?
Just my 2c,
Josua Dietze
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
` (2 preceding siblings ...)
2010-12-22 11:35 ` Josua Dietze
@ 2010-12-22 15:58 ` Martin Pitt
2010-12-22 17:40 ` Josua Dietze
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Martin Pitt @ 2010-12-22 15:58 UTC (permalink / raw)
To: linux-hotplug
Hello Josua,
Josua Dietze [2010-12-22 12:42 +0100]:
> What's a bit unfortunate though is the discrepancy between man pages
> and functionality of versions before the man page correction.
That's right, there was a time when the manpage was still wrong. The
manpage was fixed in August:
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;hƒ184d008ba2
> Maybe an "official" udev page consisting of the current man page and
> two or three additional notes regarding changes in previously
> available features would help. Or does it exist and I missed it?
The one I quoted from is the official manpage, as it is released
upstream in the last few versions (>= 162).
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
` (3 preceding siblings ...)
2010-12-22 15:58 ` Martin Pitt
@ 2010-12-22 17:40 ` Josua Dietze
2010-12-22 17:46 ` Kay Sievers
2010-12-26 14:59 ` Kay Sievers
6 siblings, 0 replies; 8+ messages in thread
From: Josua Dietze @ 2010-12-22 17:40 UTC (permalink / raw)
To: linux-hotplug
Am 22.12.2010 16:58, schrieb Martin Pitt:
> Josua Dietze [2010-12-22 12:42 +0100]:
>> Maybe an "official" udev page consisting of the current man page and
>> two or three additional notes regarding changes in previously
>> available features would help. Or does it exist and I missed it?
>
> The one I quoted from is the official manpage, as it is released
> upstream in the last few versions (>= 162).
I was thinking of something that would come up if you google for "udev man page"
or "udev home"; this will hardly work for a XML file in a git tree ...
But it's no big deal either; I mean, I found it eventually, right? Those who
really care will arrive there sooner or later.
Thanks for your time!
Josua Dietze
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
` (4 preceding siblings ...)
2010-12-22 17:40 ` Josua Dietze
@ 2010-12-22 17:46 ` Kay Sievers
2010-12-26 14:59 ` Kay Sievers
6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2010-12-22 17:46 UTC (permalink / raw)
To: linux-hotplug
On Wed, Dec 22, 2010 at 18:40, Josua Dietze <digidietze@draisberghof.de> wrote:
> Am 22.12.2010 16:58, schrieb Martin Pitt:
>
>> Josua Dietze [2010-12-22 12:42 +0100]:
>>>
>>> Maybe an "official" udev page consisting of the current man page and
>>> two or three additional notes regarding changes in previously
>>> available features would help. Or does it exist and I missed it?
>>
>> The one I quoted from is the official manpage, as it is released
>> upstream in the last few versions (>= 162).
>
>
> I was thinking of something that would come up if you google for "udev man
> page" or "udev home"; this will hardly work for a XML file in a git tree ...
>
> But it's no big deal either; I mean, I found it eventually, right? Those who
> really care will arrive there sooner or later.
>
> Thanks for your time!
We sync (make doc-sync in the tree) the generated html from the libs
the git tree to kernel.org for libudev and gudev:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/
http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/
Should be easy to let xmlto create html pages for theman pages and
sync them to:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/
at the same time.
Kay
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Udev rule $attr substitution
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
` (5 preceding siblings ...)
2010-12-22 17:46 ` Kay Sievers
@ 2010-12-26 14:59 ` Kay Sievers
6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2010-12-26 14:59 UTC (permalink / raw)
To: linux-hotplug
On Wed, Dec 22, 2010 at 18:46, Kay Sievers <kay.sievers@vrfy.org> wrote:
> On Wed, Dec 22, 2010 at 18:40, Josua Dietze <digidietze@draisberghof.de> wrote:
>> Am 22.12.2010 16:58, schrieb Martin Pitt:
>>
>>> Josua Dietze [2010-12-22 12:42 +0100]:
>>>>
>>>> Maybe an "official" udev page consisting of the current man page and
>>>> two or three additional notes regarding changes in previously
>>>> available features would help. Or does it exist and I missed it?
>>>
>>> The one I quoted from is the official manpage, as it is released
>>> upstream in the last few versions (>= 162).
>>
>>
>> I was thinking of something that would come up if you google for "udev man
>> page" or "udev home"; this will hardly work for a XML file in a git tree ...
>>
>> But it's no big deal either; I mean, I found it eventually, right? Those who
>> really care will arrive there sooner or later.
>>
>> Thanks for your time!
>
> We sync (make doc-sync in the tree) the generated html from the libs
> the git tree to kernel.org for libudev and gudev:
> http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/
> http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/
> Should be easy to let xmlto create html pages for theman pages and
> sync them to:
> http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/
> at the same time.
It's here now:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/
Cheers,
Kay
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-12-26 14:59 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 18:47 Udev rule $attr substitution Josua Dietze
2010-12-21 20:25 ` Josua Dietze
2010-12-22 8:51 ` Martin Pitt
2010-12-22 11:35 ` Josua Dietze
2010-12-22 15:58 ` Martin Pitt
2010-12-22 17:40 ` Josua Dietze
2010-12-22 17:46 ` Kay Sievers
2010-12-26 14:59 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).