udevadm

 $ udevadm info -q path -n /dev/sdc
/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdc
[jshih@i7 ~]$ udevadm info -a -p  $(udevadm info -q path -n /dev/sdc)

Udevadm info 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 '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdc':
    KERNEL=="sdc"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{ro}=="0"
    ATTR{size}=="976773168"
    ATTR{stat}=="    1172       43     9062     4975        0        0        0        0        0     1307     4974"
    ATTR{range}=="16"
    ATTR{discard_alignment}=="0"
    ATTR{events}==""
    ATTR{ext_range}=="256"
    ATTR{events_poll_msecs}=="-1"
    ATTR{alignment_offset}=="0"
    ATTR{inflight}=="       0        0"
    ATTR{removable}=="0"
    ATTR{capability}=="50"
    ATTR{events_async}==""

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0':
    KERNELS=="10:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{rev}=="0001"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="0"
    ATTRS{model}=="3AS             "
    ATTRS{state}=="running"
    ATTRS{queue_type}=="none"
    ATTRS{iodone_cnt}=="0x4eb"
    ATTRS{iorequest_cnt}=="0x4eb"
    ATTRS{timeout}=="30"
    ATTRS{evt_media_change}=="0"
    ATTRS{max_sectors}=="240"
    ATTRS{ioerr_cnt}=="0x7"
    ATTRS{queue_depth}=="1"
    ATTRS{vendor}=="ST950042"
    ATTRS{device_blocked}=="0"
    ATTRS{dh_state}=="detached"
    ATTRS{iocounterbits}=="32"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0':
    KERNELS=="target10:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10':
    KERNELS=="host10"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0':
    KERNELS=="4-2:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb-storage"
    ATTRS{bInterfaceClass}=="08"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceProtocol}=="50"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceNumber}=="00"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2':
    KERNELS=="4-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{devpath}=="2"
    ATTRS{idVendor}=="174c"
    ATTRS{speed}=="5000"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="9"
    ATTRS{busnum}=="4"
    ATTRS{devnum}=="2"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="c0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="0"
    ATTRS{bcdDevice}=="0100"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{serial}=="0123456789ABCDEF"
    ATTRS{version}==" 3.00"
    ATTRS{urbnum}=="3770"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="ASMedia"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="55aa"
    ATTRS{bDeviceClass}=="00"
    ATTRS{product}=="AS2105"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4':
    KERNELS=="usb4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="03"
    ATTRS{devpath}=="0"
    ATTRS{idVendor}=="1d6b"
    ATTRS{speed}=="5000"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="9"
    ATTRS{authorized_default}=="1"
    ATTRS{busnum}=="4"
    ATTRS{devnum}=="1"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="2"
    ATTRS{bcdDevice}=="0306"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{serial}=="0000:04:00.0"
    ATTRS{version}==" 3.00"
    ATTRS{urbnum}=="96"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 3.6.7-4.fc17.x86_64 xhci_hcd"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="0003"
    ATTRS{bDeviceClass}=="09"
    ATTRS{product}=="xHCI Host Controller"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4/0000:04:00.0':
    KERNELS=="0000:04:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{irq}=="42"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0330"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpus}=="00000000,00000000,00000000,000000ff"
    ATTRS{device}=="0x7023"
    ATTRS{msi_bus}==""
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x1b6f"
    ATTRS{subsystem_device}=="0x5007"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:1c.4':
    KERNELS=="0000:00:1c.4"
    SUBSYSTEMS=="pci"
    DRIVERS=="pcieport"
    ATTRS{irq}=="16"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x060400"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{local_cpus}=="00000000,00000000,00000000,000000ff"
    ATTRS{device}=="0x1c18"
    ATTRS{msi_bus}=="1"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{vendor}=="0x8086"
    ATTRS{subsystem_device}=="0x5001"
    ATTRS{numa_node}=="-1"
    ATTRS{d3cold_allowed}=="0"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

[jshih@i7 ~]$ udevadm info -q path -n /dev/sdc
/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdc
[jshih@i7 ~]$ udevadm info -q env -n /dev/sdc
DEVLINKS=/dev/disk/by-id/ata-ST9500423AS_6WR0N60Q /dev/disk/by-id/wwn-0x5000c5004a982eb5 /dev/disk/by-path/pci-0000:04:00.0-usb-0:2:1.0-scsi-0:0:0:0
DEVNAME=/dev/sdc
DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdc
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=128
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=96
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=96
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_MODEL=ST9500423AS
ID_MODEL_ENC=ST9500423AS\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_TABLE_TYPE=dos
ID_PATH=pci-0000:04:00.0-usb-0:2:1.0-scsi-0:0:0:0
ID_PATH_TAG=pci-0000_04_00_0-usb-0_2_1_0-scsi-0_0_0_0
ID_REVISION=0001SD5M
ID_SERIAL=ST9500423AS_6WR0N60Q
ID_SERIAL_SHORT=6WR0N60Q
ID_TYPE=disk
ID_WWN=0x5000c5004a982eb5
ID_WWN_WITH_EXTENSION=0x5000c5004a982eb5
MAJOR=8
MINOR=32
SUBSYSTEM=block
TAGS=:systemd:
UDISKS_ATA_SMART_IS_AVAILABLE=1
UDISKS_PARTITION_TABLE=1
UDISKS_PARTITION_TABLE_COUNT=12
UDISKS_PARTITION_TABLE_SCHEME=mbr
UDISKS_PRESENTATION_NOPOLICY=0
USEC_INITIALIZED=966774215

No comments: