udev

Read: Writing udev rules

Network

Disk

$ /lib/udev/vol_id -t /dev/sdb

vfat

$ /lib/udev/vol_id -t /dev/sda1

ext3

$ udevinfo -a -p /sys/class/scsi_disk/0\:0\:0\:0/

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/scsi_disk/0:0:0:0':
    KERNEL=="0:0:0:0"
    SUBSYSTEM=="scsi_disk"
    DRIVER==""
    ATTR{allow_restart}=="0"
    ATTR{FUA}=="0"
    ATTR{cache_type}=="write back"
 
  looking at parent device '/devices/pci0000:00/0000:00:1f.1/host0/target0:0:0/0:0:0:0':
    KERNELS=="0:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{ioerr_cnt}=="0x0"
    ATTRS{iodone_cnt}=="0x60ce5"
    ATTRS{iorequest_cnt}=="0x60ce5"
    ATTRS{iocounterbits}=="32"
    ATTRS{timeout}=="30"
    ATTRS{state}=="running"
    ATTRS{rev}=="AM10"
    ATTRS{model}=="SAMSUNG HM080HC "
    ATTRS{vendor}=="ATA     "
    ATTRS{scsi_level}=="6"
    ATTRS{type}=="0"
    ATTRS{queue_type}=="none"
    ATTRS{queue_depth}=="1"
    ATTRS{device_blocked}=="0"
 
  looking at parent device '/devices/pci0000:00/0000:00:1f.1/host0/target0:0:0':
    KERNELS=="target0:0:0"
    SUBSYSTEMS==""
    DRIVERS==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1f.1/host0':
    KERNELS=="host0"
    SUBSYSTEMS==""
    DRIVERS==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1f.1':
    KERNELS=="0000:00:1f.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="ata_piix"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00008086d000024CAsv00001014sd0000052Dbc01sc01i8a"
    ATTRS{local_cpus}=="1"
    ATTRS{irq}=="11"
    ATTRS{class}=="0x01018a"
    ATTRS{subsystem_device}=="0x052d"
    ATTRS{subsystem_vendor}=="0x1014"
    ATTRS{device}=="0x24ca"
    ATTRS{vendor}=="0x8086"
 
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

USB

/sys/class/usb_host/

$ ls /sys/class/usb_host/

drwxr-xr-x 2 root root 0 usb_host1/
drwxr-xr-x 2 root root 0 usb_host2/
drwxr-xr-x 2 root root 0 usb_host3/
drwxr-xr-x 2 root root 0 usb_host4/

$ udevinfo -a -p /sys/class/usb_host/usb_host1/

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_host/usb_host1':
    KERNEL=="usb_host1"
    SUBSYSTEM=="usb_host"
    DRIVER==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7':
    KERNELS=="0000:00:1d.7"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00008086d000024CDsv00001014sd0000052Ebc0Csc03i20"
    ATTRS{local_cpus}=="1"
    ATTRS{irq}=="11"
    ATTRS{class}=="0x0c0320"
    ATTRS{subsystem_device}=="0x052e"
    ATTRS{subsystem_vendor}=="0x1014"
    ATTRS{device}=="0x24cd"
    ATTRS{vendor}=="0x8086"
 
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

/sys/class/usb_device/

$ ls /sys/class/usb_device/

drwxr-xr-x  2 root root 0 usbdev1.1/
drwxr-xr-x  2 root root 0 usbdev1.21/
drwxr-xr-x  2 root root 0 usbdev1.22/
drwxr-xr-x  2 root root 0 usbdev1.23/
drwxr-xr-x  2 root root 0 usbdev2.1/
drwxr-xr-x  2 root root 0 usbdev3.1/
drwxr-xr-x  2 root root 0 usbdev4.1/

$ udevinfo -a -p /sys/class/usb_device/usbdev1.21/

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_device/usbdev1.21':
    KERNEL=="usbdev1.21"
    SUBSYSTEM=="usb_device"
    DRIVER==""
    ATTR{dev}=="189:20"
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3':
    KERNELS=="1-3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="USBV1.00"
    ATTRS{product}=="ROCK MP3"
    ATTRS{manufacturer}=="RockChip"
    ATTRS{maxchild}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="21"
    ATTRS{speed}=="480"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="0100"
    ATTRS{idProduct}=="3203"
    ATTRS{idVendor}=="071b"
    ATTRS{bMaxPower}=="400mA"
    ATTRS{bmAttributes}=="80"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="0000:00:1d.7"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{manufacturer}=="Linux 2.6.20-gentoo ehci_hcd"
    ATTRS{maxchild}=="6"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="1"
    ATTRS{speed}=="480"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0206"
    ATTRS{idProduct}=="0000"
    ATTRS{idVendor}=="0000"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7':
    KERNELS=="0000:00:1d.7"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00008086d000024CDsv00001014sd0000052Ebc0Csc03i20"
    ATTRS{local_cpus}=="1"
    ATTRS{irq}=="11"
    ATTRS{class}=="0x0c0320"
    ATTRS{subsystem_device}=="0x052e"
    ATTRS{subsystem_vendor}=="0x1014"
    ATTRS{device}=="0x24cd"
    ATTRS{vendor}=="0x8086"
 
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

$ udevinfo -a -p /sys/class/scsi_disk/15\:0\:0\:0/

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/scsi_disk/15:0:0:0':
    KERNEL=="15:0:0:0"
    SUBSYSTEM=="scsi_disk"
    DRIVER==""
    ATTR{allow_restart}=="0"
    ATTR{FUA}=="0"
    ATTR{cache_type}=="write through"
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/host15/target15:0:0/15:0:0:0':
    KERNELS=="15:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{ioerr_cnt}=="0x1"
    ATTRS{iodone_cnt}=="0x24"
    ATTRS{iorequest_cnt}=="0x24"
    ATTRS{iocounterbits}=="32"
    ATTRS{timeout}=="30"
    ATTRS{state}=="running"
    ATTRS{rev}=="1.00"
    ATTRS{model}=="USB MP3         "
    ATTRS{vendor}=="RockChip"
    ATTRS{scsi_level}=="3"
    ATTRS{type}=="0"
    ATTRS{queue_type}=="none"
    ATTRS{queue_depth}=="1"
    ATTRS{device_blocked}=="0"
    ATTRS{max_sectors}=="240"
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/host15/target15:0:0':
    KERNELS=="target15:0:0"
    SUBSYSTEMS==""
    DRIVERS==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/host15':
    KERNELS=="host15"
    SUBSYSTEMS==""
    DRIVERS==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0':
    KERNELS=="1-3:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb-storage"
    ATTRS{modalias}=="usb:v071Bp3203d0100dc00dsc00dp00ic08isc06ip50"
    ATTRS{bInterfaceProtocol}=="50"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceClass}=="08"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceNumber}=="00"
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1/1-3':
    KERNELS=="1-3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="USBV1.00"
    ATTRS{product}=="ROCK MP3"
    ATTRS{manufacturer}=="RockChip"
    ATTRS{maxchild}=="0"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="21"
    ATTRS{speed}=="480"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bcdDevice}=="0100"
    ATTRS{idProduct}=="3203"
    ATTRS{idVendor}=="071b"
    ATTRS{bMaxPower}=="400mA"
    ATTRS{bmAttributes}=="80"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="0000:00:1d.7"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{manufacturer}=="Linux 2.6.20-gentoo ehci_hcd"
    ATTRS{maxchild}=="6"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="1"
    ATTRS{speed}=="480"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0206"
    ATTRS{idProduct}=="0000"
    ATTRS{idVendor}=="0000"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
 
  looking at parent device '/devices/pci0000:00/0000:00:1d.7':
    KERNELS=="0000:00:1d.7"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00008086d000024CDsv00001014sd0000052Ebc0Csc03i20"
    ATTRS{local_cpus}=="1"
    ATTRS{irq}=="11"
    ATTRS{class}=="0x0c0320"
    ATTRS{subsystem_device}=="0x052e"
    ATTRS{subsystem_vendor}=="0x1014"
    ATTRS{device}=="0x24cd"
    ATTRS{vendor}=="0x8086"
 
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.