All pastes #709451 Raw Edit

Stuff

public html v1 · immutable
#709451 ·published 2007-09-24 18:13 UTC
rendered paste body
This article will attempt to help you get your hands around using UDEV commands, specifically udevinfo.I always like examples, so here goes;                   udevinfo -q all -n /dev/hda$ udevinfo -q all -n /dev/hdaP: /block/hdaN: hdaS: disk/by-id/ata-HDS728080PLAT20_PFD210S2UUUR7RS: disk/by-path/pci-0000:00:07.1-ide-0:0E: ID_TYPE=diskE: ID_MODEL=HDS728080PLAT20E: ID_SERIAL=PFD210S2STQR2RE: ID_REVISION=PF2OA21BE: ID_BUS=ataE: ID_PATH=pci-0000:00:07.1-ide-0:0Ok - from above we see;     P == Path # as in /sys/block/hda     N == Name # as in /dev/name     S == Symlink # as in /dev/disk/* (symlinks there)     E == Environment # as in the working root FS Envir. (see man lshal)-------------ok .. that's fine for block devices, and more, however for iface (eth0), this needs to be a bit modified. So;--------------                udevinfo -a -p /sys/class/net/eth0$ udevinfo -a -p /sys/class/net/eth0Udevinfo starts with the device specified by the devpath and thenwalks up the chain of parent devices. It prints for every devicefound, all possible attributes in the udev rules key format.A rule to match, can be composed by the attributes of the deviceand the attributes from one single parent device.  looking at device '/class/net/eth0':    KERNEL=="eth0"    SUBSYSTEM=="net"    DRIVER==""    ATTR{weight}=="0"    ATTR{tx_queue_len}=="1000"    ATTR{flags}=="0x1003"    ATTR{mtu}=="1500"    ATTR{carrier}=="1"    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"    ATTR{address}=="00:02:5c:2d:09:f6"    ATTR{type}=="1"    ATTR{features}=="0x0"    ATTR{ifindex}=="2"    ATTR{iflink}=="2"    ATTR{addr_len}=="6"  looking at parent device '/devices/pci0000:00/0000:00:0e.0':    KERNELS=="0000:00:0e.0"    SUBSYSTEMS=="pci"    DRIVERS=="natsemi"    ATTRS{modalias}=="pci:v0000100Bd00000020sv00001385sd0000F312bc02sc00i00"    ATTRS{local_cpus}=="1"    ATTRS{irq}=="11"    ATTRS{class}=="0x020000"    ATTRS{subsystem_device}=="0xf312"    ATTRS{subsystem_vendor}=="0x1385"    ATTRS{device}=="0x0020"    ATTRS{vendor}=="0x100b"  looking at parent device '/devices/pci0000:00':    KERNELS=="pci0000:00"    SUBSYSTEMS==""    DRIVERS==""-----------------As you an see, some key points of interest might be;    the IRQ (11 on my system for my NIC) , Driver (Module "natsemi", try    'lshal | grep driver' for a list of most modules being used for devices).----------------And there you have it .. please 'man udevinfo' for more (and all the variousudev* manpages .. see http://www.reactivated.net/writing_udev_rules.html - or locally /usr/share/doc/udev/writing_udev_rules/index.html).