From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Adam Kropelin" Date: Fri, 03 Aug 2007 01:11:38 +0000 Subject: Re: Static naming for hiddev nodes Message-Id: <025601c7d56b$3e645c10$03c8a8c0@kroptech.com> List-Id: References: <01fe01c7d561$6a20b1a0$03c8a8c0@kroptech.com> In-Reply-To: <01fe01c7d561$6a20b1a0$03c8a8c0@kroptech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Kay Sievers wrote: > On 8/3/07, Adam Kropelin wrote: >> Kay Sievers wrote: >>> On 8/3/07, Adam Kropelin wrote: >>>> I'm attempting to establish static naming for some hiddev devices >>>> (UPSes) based on serial numbers. I used to be able to do this >>>> fairly easily many moons ago in the early days of udev. Revisiting >>>> it on a modern distro (RHEL5) I am unable to make it work. Here >>>> are the udev rules I've tried and what happened with each.... >>>> >>>> DRIVER=3D"hiddev", SYSFS{serial}=3D"JB0319039999", NAME=3D"ups1" >>>> - Does not match >>>> >>>> DRIVER=3D"usbhid", SYSFS{serial}=3D"JB0319039999", NAME=3D"ups1" >>>> - Does not match >>>> >>>> SYSFS{serial}=3D"JB0319039999", NAME=3D"ups1" >>>> - Matches, but results in a device node for the usbdev not for >>>> the hiddev >>>> >>>> BUS=3D"usb", SYSFS{serial}=3D"JB0319039999", NAME=3D"ups1" >>>> - Matches, but results in a device node for the usbdev not for >>>> the hiddev >>>> >>>> SUBSYSTEM=3D"usb", SYSFS{serial}=3D"JB0319039999", NAME=3D"ups1" >>>> - Does not match >>>> >>>> I admit to being almost completely lost in the sysfs hierarchy. I'd >>>> be happy to post a subtree if someone can suggest which one would >>>> be helpful. It is worth noting that the default rules create >>>> correct and working hiddev* nodes...I'm just trying to given them >>>> persistent names. >>> >>> What is the "original" device node name, you expect and want to >>> rename? >> >> hiddev0 >> >>> What does: >>> udevmonitor --env --kernel >>> print when you connect the device? >> >> My udevmonitor does not appear to support the --kernel option, but >> here is output from --env: > >> UDEV [1186101575.338918] add@/class/usb/hiddev0 >> UDEV_LOG=3D3 >> ACTION=ADd >> DEVPATH=3D/class/usb/hiddev0 >> SUBSYSTEM=3Dusb >> SEQNUM(33 >> PHYSDEVPATH=3D/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2.3/1-2.3:1.0 >> PHYSDEVBUS=3Dusb >> PHYSDEVDRIVER=3Dusbhid >> MAJOR=180 >> MINOR=96 >> UDEVD_EVENT=3D1 >> DEVNAME=3D/dev/hiddev0 > > What does: > udevinfo -a -p /class/usb/hiddev0 > print? [adk0212@mail etc]$ udevinfo -a -p /class/usb/hiddev0 Udevinfo starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/class/usb/hiddev0': KERNEL=3D"hiddev0" SUBSYSTEM=3D"usb" SYSFS{dev}=3D"180:96" looking at parent device=20 '/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2.3/1-2.3:1.0': ID=3D"1-2.3:1.0" BUS=3D"usb" DRIVER=3D"usbhid" SYSFS{modalias}=3D"usb:v051Dp0002d0106dc00dsc00dp00ic03isc00ip00" SYSFS{bInterfaceProtocol}=3D"00" SYSFS{bInterfaceSubClass}=3D"00" SYSFS{bInterfaceClass}=3D"03" SYSFS{bNumEndpoints}=3D"01" SYSFS{bAlternateSetting}=3D" 0" SYSFS{bInterfaceNumber}=3D"00" looking at parent device=20 '/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2.3': ID=3D"1-2.3" BUS=3D"usb" DRIVER=3D"usb" SYSFS{configuration}=3D"" SYSFS{serial}=3D"BB0100009999 " [I swapped UPSes at one point tonight, which is why this serial doesn't=20 match the udev rules I quoted earlier. I had the serial number right at=20 the time I did the test.] SYSFS{product}=3D"Back-UPS RS 1500 FW:8.g6 .D USB FW:g6 " SYSFS{manufacturer}=3D"American Power Conversion" SYSFS{maxchild}=3D"0" SYSFS{version}=3D" 1.10" SYSFS{devnum}=3D"5" SYSFS{speed}=3D"1.5" SYSFS{bMaxPacketSize0}=3D"8" SYSFS{bNumConfigurations}=3D"1" SYSFS{bDeviceProtocol}=3D"00" SYSFS{bDeviceSubClass}=3D"00" SYSFS{bDeviceClass}=3D"00" SYSFS{bcdDevice}=3D"0106" SYSFS{idProduct}=3D"0002" SYSFS{idVendor}=3D"051d" SYSFS{bMaxPower}=3D" 24mA" SYSFS{bmAttributes}=3D"a0" SYSFS{bConfigurationValue}=3D"1" SYSFS{bNumInterfaces}=3D" 1" looking at parent device '/devices/pci0000:00/0000:00:07.2/usb1/1-2': ID=3D"1-2" BUS=3D"usb" DRIVER=3D"usb" SYSFS{configuration}=3D"" SYSFS{product}=3D"USB2.0 Hub Controller" SYSFS{manufacturer}=3D"NEC Corporation" SYSFS{maxchild}=3D"4" SYSFS{version}=3D" 2.00" SYSFS{devnum}=3D"2" SYSFS{speed}=3D"12" SYSFS{bMaxPacketSize0}=3D"64" SYSFS{bNumConfigurations}=3D"1" SYSFS{bDeviceProtocol}=3D"00" SYSFS{bDeviceSubClass}=3D"00" SYSFS{bDeviceClass}=3D"09" SYSFS{bcdDevice}=3D"0100" SYSFS{idProduct}=3D"0058" SYSFS{idVendor}=3D"0409" SYSFS{bMaxPower}=3D"100mA" SYSFS{bmAttributes}=3D"e0" SYSFS{bConfigurationValue}=3D"1" SYSFS{bNumInterfaces}=3D" 1" looking at parent device '/devices/pci0000:00/0000:00:07.2/usb1': ID=3D"usb1" BUS=3D"usb" DRIVER=3D"usb" SYSFS{configuration}=3D"" SYSFS{serial}=3D"0000:00:07.2" SYSFS{product}=3D"UHCI Host Controller" SYSFS{manufacturer}=3D"Linux 2.6.18-8.1.8.el5 uhci_hcd" SYSFS{maxchild}=3D"2" SYSFS{version}=3D" 1.10" SYSFS{devnum}=3D"1" SYSFS{speed}=3D"12" SYSFS{bMaxPacketSize0}=3D"64" SYSFS{bNumConfigurations}=3D"1" SYSFS{bDeviceProtocol}=3D"00" SYSFS{bDeviceSubClass}=3D"00" SYSFS{bDeviceClass}=3D"09" SYSFS{bcdDevice}=3D"0206" SYSFS{idProduct}=3D"0000" SYSFS{idVendor}=3D"0000" SYSFS{bMaxPower}=3D" 0mA" SYSFS{bmAttributes}=3D"e0" SYSFS{bConfigurationValue}=3D"1" SYSFS{bNumInterfaces}=3D" 1" looking at parent device '/devices/pci0000:00/0000:00:07.2': ID=3D"0000:00:07.2" BUS=3D"pci" DRIVER=3D"uhci_hcd" SYSFS{broken_parity_status}=3D"0" SYSFS{modalias}=3D"pci:v00008086d00007020sv00000000sd00000000bc0Csc03i0= 0" SYSFS{local_cpus}=3D"ffffffff" SYSFS{irq}=3D"11" SYSFS{class}=3D"0x0c0300" SYSFS{subsystem_device}=3D"0x0000" SYSFS{subsystem_vendor}=3D"0x0000" SYSFS{device}=3D"0x7020" SYSFS{vendor}=3D"0x8086" looking at parent device '/devices/pci0000:00': ID=3D"pci0000:00" BUS=3D"" DRIVER=3D"" --Adam ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ 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