From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Macfarlane Date: Fri, 29 Apr 2005 00:59:47 +0000 Subject: Re: udev: rules using multiple sysfs directories Message-Id: <200504290159.48665.typo@mcflan.org> List-Id: References: <200504282041.56905.typo@mcflan.org> In-Reply-To: <200504282041.56905.typo@mcflan.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.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?id5hix _______________________________________________ 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