linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Macfarlane <typo@mcflan.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev: rules using multiple sysfs directories
Date: Fri, 29 Apr 2005 00:59:47 +0000	[thread overview]
Message-ID: <200504290159.48665.typo@mcflan.org> (raw)
In-Reply-To: <200504282041.56905.typo@mcflan.org>

On Thursday 28 April 2005 22:44, Kay Sievers wrote:
> How does:
>   tree /sys/...
> of this device look like?
>
> What does:
>   udevinfo -a -p /sys/xxx...
> print for this device?

See at the bottom of this message.

> I never tried this, but:
>   SYSFS{product/value}
> may work to go into subdirs?

Not sure exactly you mean, in terms of syntax. I've just tried  
SYSFS{1.0/bInterfaceProtocol}  but it didn't seem to work. 

udevinfo says: "Only attributes within one device section may be used 
together in one rule, to match the device for which the node will be 
created."  - that seems to indicate it won't work. 

I've had a brief delve into the source and it looks unlikely to work 
either. It appears to search for attribute names in a pre-existing 
list, and everything between the curly braces counts as the attribute 
name (btw, I'm looking at ver 056, which is what my distro (debian 
testing) uses). So adding '/' is probably not going to work.

It walks the tree and breaks out of the loop once all the key-value 
pairs are matched, but it does all the SYSFS pairs in one loop. So 
unless all the SYSFS attributes are matched at one level, then the 
whole rule fails to match.


Cheers,
James.


Trees
-----


/sys/class/input/
[...]
|-- event2
|   |-- dev
|   |-- device 
-> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.0
|   `-- driver -> ../../../bus/usb/drivers/usbhid
|-- event3
|   |-- dev
|   |-- device 
-> ../../../devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.1
|   `-- driver -> ../../../bus/usb/drivers/usbhid

and:
/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/
|-- 2-1.2:1.0
|   |-- bAlternateSetting
|   |-- bInterfaceClass
|   |-- bInterfaceNumber
|   |-- bInterfaceProtocol
|   |-- bInterfaceSubClass
|   |-- bNumEndpoints
|   |-- detach_state
|   |-- driver -> ../../../../../../../bus/usb/drivers/usbhid
|   `-- power
|       `-- state
|-- 2-1.2:1.1
|   |-- bAlternateSetting
|   |-- bInterfaceClass
|   |-- bInterfaceNumber
|   |-- bInterfaceProtocol
|   |-- bInterfaceSubClass
|   |-- bNumEndpoints
|   |-- detach_state
|   |-- driver -> ../../../../../../../bus/usb/drivers/usbhid
|   `-- power
|       `-- state
|-- bConfigurationValue
|-- bDeviceClass
|-- bDeviceProtocol
|-- bDeviceSubClass
|-- bMaxPower
|-- bNumConfigurations
|-- bNumInterfaces
|-- bcdDevice
|-- bmAttributes
|-- configuration
|-- detach_state
|-- devnum
|-- driver -> ../../../../../../bus/usb/drivers/usb
|-- idProduct
|-- idVendor
|-- manufacturer
|-- maxchild
|-- power
|   `-- state
|-- product
|-- speed
`-- version

udevinfo output
---------------

device '/sys/class/input/event2' has major:minor 13:66
  looking at class device '/sys/class/input/event2':
    SUBSYSTEM="input"
    SYSFS{dev}="13:66"

follow the class device's "device"
  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2/2-1.2:1.0':
    BUS="usb"
    ID="2-1.2:1.0"
    DRIVER="usbhid"
    SYSFS{bAlternateSetting}=" 0"
    SYSFS{bInterfaceClass}="03"
    SYSFS{bInterfaceNumber}="00"
    SYSFS{bInterfaceProtocol}="01"
    SYSFS{bInterfaceSubClass}="01"
    SYSFS{bNumEndpoints}="01"
    SYSFS{detach_state}="0"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.2':
    BUS="usb"
    ID="2-1.2"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="00"
    SYSFS{bDeviceProtocol}="00"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="100mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 2"
    SYSFS{bcdDevice}="0001"
    SYSFS{bmAttributes}="a0"
    SYSFS{configuration}="USB to PS2 Adaptor  v1.12"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="7"
    SYSFS{idProduct}="0001"
    SYSFS{idVendor}="0518"
    SYSFS{manufacturer}="Composite USB PS2 Converter"
    SYSFS{maxchild}="0"
    SYSFS{product}="USB to PS2 Adaptor  v1.12"
    SYSFS{speed}="1.5"
    SYSFS{version}=" 1.10"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1':
    BUS="usb"
    ID="2-1"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="09"
    SYSFS{bDeviceProtocol}="01"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="100mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 1"
    SYSFS{bcdDevice}="0100"
    SYSFS{bmAttributes}="e0"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="2"
    SYSFS{idProduct}="0058"
    SYSFS{idVendor}="0409"
    SYSFS{manufacturer}="NEC Corporation"
    SYSFS{maxchild}="4"
    SYSFS{product}="USB2.0 Hub Controller"
    SYSFS{speed}="480"
    SYSFS{version}=" 2.00"

  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:1d.7/usb2':
    BUS="usb"
    ID="usb2"
    DRIVER="usb"
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="09"
    SYSFS{bDeviceProtocol}="01"
    SYSFS{bDeviceSubClass}="00"
    SYSFS{bMaxPower}="  0mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 1"
    SYSFS{bcdDevice}="0206"
    SYSFS{bmAttributes}="e0"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="1"
    SYSFS{idProduct}="0000"
    SYSFS{idVendor}="0000"
    SYSFS{manufacturer}="Linux 2.6.10blackrock20041231 ehci_hcd"
    SYSFS{maxchild}="6"
    SYSFS{product}="Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI 
Controller"
    SYSFS{serial}="0000:00:1d.7"
    SYSFS{speed}="480"
    SYSFS{version}=" 2.00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.7':
    BUS="pci"
    ID="0000:00:1d.7"
    DRIVER="ehci_hcd"
    SYSFS{class}="0x0c0320"
    SYSFS{detach_state}="0"
    SYSFS{device}="0x24cd"
    SYSFS{irq}="11"
    SYSFS{local_cpus}="1"
    SYSFS{subsystem_device}="0x0001"
    SYSFS{subsystem_vendor}="0x1179"
    SYSFS{vendor}="0x8086"

  looking at the device chain at '/sys/devices/pci0000:00':
    BUS=""
    ID="pci0000:00"
    DRIVER="unknown"
    SYSFS{detach_state}="0"




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id\x105hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2005-04-29  0:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 19:41 udev: rules using multiple sysfs directories James Macfarlane
2005-04-28 20:28 ` Ian Pilcher
2005-04-28 21:44 ` Kay Sievers
2005-04-29  0:59 ` James Macfarlane [this message]
2005-04-29 12:55 ` Ian Pilcher
2005-04-29 17:13 ` James Macfarlane
2005-04-29 18:15 ` Kay Sievers
2005-04-29 20:09 ` Greg KH
2005-04-30  0:44 ` Ian Pilcher

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=200504290159.48665.typo@mcflan.org \
    --to=typo@mcflan.org \
    --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).