mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kay Sievers" <kay.sievers@vrfy.org>
To: "Manuel Reimer" <Manuel.Spam@nurfuerspam.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: udev: Inconsistency between %b and %p?
Date: Fri, 7 Sep 2007 03:03:33 +0200	[thread overview]
Message-ID: <3ae72650709061803u7ed2ff21v511f219e742ecd7a@mail.gmail.com> (raw)
In-Reply-To: <fbppo0$rli$1@sea.gmane.org>

On 9/6/07, Manuel Reimer <Manuel.Spam@nurfuerspam.de> wrote:
> Andreas Schwab wrote:
> >> As I would prefer to use the USB device information (idVendor, idProduct)
> >> to detect the device, I also tried this one:
> >>
> >> ATTRS{idVendor}=="0dda", ATTRS{idProduct}=="2005", SUBSYSTEM=="scsi",
> >> ACTION=="add", PROGRAM+="/usr/bin/test.sh %b %p"
> >>
> >> Now this version returns the USB device ID ($NUM-$NUM) to the test script,
> >> but the device path (%p) is still OK and still goes down up to the SCSI
> >> device ID.
> >>
> >> Why does %b not return the SCSI device ID in the second rule?
> >
> > Because ATTRS has matched the USB device, not the SCSI device.
>
> Yes, that's right, but "SUBSYSTEM" matched the SCSI device...
>
> If I use udevinfo, then this tool tells me:
>
> | A rule to match, can be composed by the attributes of the device
> | and the attributes from one single parent device.
>
> So I thought, that I've matched the SCSI device now. To prove this, I
> just replaced "SUBSYSTEM=="scsi"" with "SUBSYSTEM=="usb"" and removed
> the "S" in the "ATTRS" of the above rule, and now, I get the USB-device
> in %b (as expected) and the path in %p only goes down up to the USB
> device ID.
>
> So, if all rules match for the same device, then %b and %p are both
> pointing to this, right, device.
>
> If I try to match, using one of the parent devices (using the "S"
> "extension" to the property names) and the device, to match to, itself,
> then the two are inconsistent. Then, %b holds the device name of the
> parent and %p holds the patch of the device, I want to match.
>
> For me, this looks like a bug, or am I wrong?

It's fine. $id, like some other values too, is a value of the device
where all keys successful matched while walking up the chain of
devices.

Seems you are looking for the name of the device you received the
event for, so just use $kernel instead.

Kay

  parent reply	other threads:[~2007-09-07  1:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-06 15:33 Manuel Reimer
2007-09-06 15:57 ` Andreas Schwab
2007-09-06 21:05   ` Manuel Reimer
2007-09-06 21:46     ` Andreas Schwab
2007-09-06 21:59       ` Manuel Reimer
2007-09-07  1:03     ` Kay Sievers [this message]
2007-09-11 14:11       ` Manuel Reimer

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=3ae72650709061803u7ed2ff21v511f219e742ecd7a@mail.gmail.com \
    --to=kay.sievers@vrfy.org \
    --cc=Manuel.Spam@nurfuerspam.de \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®