linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Udev rule $attr substitution
Date: Wed, 22 Dec 2010 08:51:13 +0000	[thread overview]
Message-ID: <20101222085113.GB2227@piware.de> (raw)
In-Reply-To: <4D10F63F.9030005@draisberghof.de>

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)

  parent reply	other threads:[~2010-12-22  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101222085113.GB2227@piware.de \
    --to=martin.pitt@ubuntu.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).