[root@localhost rules.d]# udevinfo -a -p $(udevinfo -q path -n /dev/hda1)
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 '/block/hda/hda1':
KERNEL=="hda1" SUBSYSTEM=="block" DRIVER==""
ATTR{stat}==" 1133 2268 2 4" ATTR{size}=="208782"
ATTR{start}=="63" ATTR{dev}=="3:1" looking at parent device '/block/hda':
KERNELS=="hda" SUBSYSTEMS=="block" DRIVERS==""
ATTRS{stat}=="28905 18814 1234781 302540 34087 133247 849708 981336 0 218340 1283968"
ATTRS{size}=="117210240" ATTRS{removable}=="0"
ATTRS{range}=="64" ATTRS{dev}=="3:0"
looking at parent device '/devices/pci0000:00/0000:00:1f.1/ide0/0.0':
KERNELS=="0.0" SUBSYSTEMS=="ide" DRIVERS=="ide-disk"
ATTRS{modalias}=="ide:m-disk" ATTRS{drivename}=="hda"
ATTRS{media}=="disk"
looking at parent device '/devices/pci0000:00/0000:00:1f.1/ide0':
KERNELS=="ide0" SUBSYSTEMS=="" DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:1f.1':
KERNELS=="0000:00:1f.1" SUBSYSTEMS=="pci" DRIVERS=="PIIX_IDE"
ATTRS{broken_parity_status}=="0" ATTRS{enable}=="1"
ATTRS{modalias}=="pci:v00008086d000024CAsv0000144Dsd0000C009bc01sc01i8a"
ATTRS{local_cpus}=="1" ATTRS{irq}=="11" ATTRS{class}=="0x01018a"
ATTRS{subsystem_device}=="0xc009" ATTRS{subsystem_vendor}=="0x144d"
ATTRS{device}=="0x24ca" ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00" SUBSYSTEMS=="" DRIVERS==""
举一个例子:假设你想修改USB扫描仪的配置。通过一系列的尝试,你已经为这个扫描仪标识了Linux设备文件(每次打开扫描仪时,名字都会变)。你可以使 用上面的命令替换这个正确的Linux设备文件名,然后定位输出的采用SYSFS{idVendor}行和SYSFS{idProduct}行。最后你可 以使用这些信息来为这个扫描仪创建新的选项。
SYSFS{idVendor}=="0686", SYSFS{idProduct}=="400e",
SYMLINK+="scanner", MODE="0664", group="scanner"上面的例子表示将扫描仪的组设置为scanner,访问权限设置为0664,同时创建一个/dev/scanner的符号连接。