]> git.ipfire.org Git - thirdparty/systemd.git/commit
[PATCH] udev - udevinfo with device chain walk
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Fri, 23 Jan 2004 11:01:02 +0000 (03:01 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:18 +0000 (21:13 -0700)
commit034f35d7e634d3900c32e58e791bf631f30a1e57
treeb1025c2ec57bb84babf4898b49e28fe26f6a30c3
parent7b15897b464e246c7342b9bf2098fd5d91b64cca
[PATCH] udev - udevinfo with device chain walk

udevinfo is now capable to print "all" attributes along the device chain
of a sysfs device. Just like udev itself it walks the chain upwards and
prints all usable attributes in the udev key format.
So it should be easy to find unique attributes to compose a rule.

All multiline attribute values and values containing non printable
characters are skipped now. I hope nothing useful gets lost with this :)

NOTE:
  The BUS value corresponding with the attributes is printed for every
  device. Don't specify BUS= in a rule and mix SYSFS_attributes from
  different busses, the rule can't match.

./udevinfo /sys/block/sda/sda1

device '/sys/block/sda/sda1' has major:minor 8:1
  looking at class device '/sys/block/sda/sda1':
    SYSFS_dev="8:1"
    SYSFS_start="32"
    SYSFS_size="160"
    SYSFS_stat="       0        0        0        0"

follow the class device's "device"
  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32/32:0:0:0':
    BUS="scsi"
    ID="32:0:0:0"
    SYSFS_detach_state="0"
    SYSFS_type="0"
    SYSFS_model="USB 2 HS-CF"
    SYSFS_vendor="SMSC    "
    SYSFS_max_sectors="240"
    SYSFS_device_blocked="0"
    SYSFS_queue_depth="1"
    SYSFS_scsi_level="3"
    SYSFS_rev="1.25"
    SYSFS_online="1"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32':
    BUS=""
    ID="host32"
    SYSFS_detach_state="0"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0':
    BUS="usb"
    ID="1-1.3:1.0"
    SYSFS_detach_state="0"
    SYSFS_bInterfaceNumber="00"
    SYSFS_bAlternateSetting=" 0"
    SYSFS_bNumEndpoints="02"
    SYSFS_bInterfaceClass="08"
    SYSFS_bInterfaceSubClass="06"
    SYSFS_bInterfaceProtocol="50"
    SYSFS_iInterface="00"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3':
    BUS="usb"
    ID="1-1.3"
    SYSFS_detach_state="0"
    SYSFS_bNumConfigurations="1"
    SYSFS_bNumInterfaces=" 1"
    SYSFS_bConfigurationValue="1"
    SYSFS_bmAttributes="80"
    SYSFS_bMaxPower=" 96mA"
    SYSFS_idVendor="0424"
    SYSFS_idProduct="20fc"
    SYSFS_bcdDevice="0125"
    SYSFS_bDeviceClass="00"
    SYSFS_bDeviceSubClass="00"
    SYSFS_bDeviceProtocol="00"
    SYSFS_speed="12"
    SYSFS_manufacturer="SMSC"
    SYSFS_product="USB 2 Flash Media Device"
    SYSFS_serial="0305037000C2"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
    BUS="usb"
    ID="1-1"
    SYSFS_detach_state="0"
    SYSFS_bNumConfigurations="1"
    SYSFS_bNumInterfaces=" 1"
    SYSFS_bConfigurationValue="1"
    SYSFS_bmAttributes="e0"
    SYSFS_bMaxPower=" 64mA"
    SYSFS_idVendor="03eb"
    SYSFS_idProduct="3301"
    SYSFS_bcdDevice="0300"
    SYSFS_bDeviceClass="09"
    SYSFS_bDeviceSubClass="00"
    SYSFS_bDeviceProtocol="00"
    SYSFS_speed="12"
    SYSFS_product="Standard USB Hub"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1':
    BUS="usb"
    ID="usb1"
    SYSFS_detach_state="0"
    SYSFS_bNumConfigurations="1"
    SYSFS_bNumInterfaces=" 1"
    SYSFS_bConfigurationValue="1"
    SYSFS_bmAttributes="40"
    SYSFS_bMaxPower="  0mA"
    SYSFS_idVendor="0000"
    SYSFS_idProduct="0000"
    SYSFS_bcdDevice="0206"
    SYSFS_bDeviceClass="09"
    SYSFS_bDeviceSubClass="00"
    SYSFS_bDeviceProtocol="00"
    SYSFS_speed="12"
    SYSFS_manufacturer="Linux 2.6.2-rc1-p4 uhci_hcd"
    SYSFS_product="UHCI Host Controller"
    SYSFS_serial="0000:00:1d.0"

  looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0':
    BUS="pci"
    ID="0000:00:1d.0"
    SYSFS_detach_state="0"
    SYSFS_vendor="0x8086"
    SYSFS_device="0x2482"
    SYSFS_subsystem_vendor="0x1014"
    SYSFS_subsystem_device="0x0220"
    SYSFS_class="0x0c0300"
    SYSFS_irq="9"

  looking at the device chain at '/sys/devices/pci0000:00':
    BUS=""
    ID="pci0000:00"
    SYSFS_detach_state="0"
extras/udevinfo/udevinfo.c