20.5 Debugging udev Events
The program udevmonitor can be used to visualize the
driver core events and the timing of the udev event processes.
UEVENT[1132632714.285362] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
UEVENT[1132632714.288166] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
UEVENT[1132632714.309485] add@/class/input/input6
UEVENT[1132632714.309511] add@/class/input/input6/mouse2
UEVENT[1132632714.309524] add@/class/usb_device/usbdev2.12
UDEV [1132632714.348966] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
UDEV [1132632714.420947] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
UDEV [1132632714.427298] add@/class/input/input6
UDEV [1132632714.434223] add@/class/usb_device/usbdev2.12
UDEV [1132632714.439934] add@/class/input/input6/mouse2
The UEVENT lines show the events the kernel has sent over
netlink. The UDEV lines show the finished udev event
handlers. The timing is printed in microseconds. The time between
UEVENT and UDEV is the time udev took
to process this event or the udev daemon has delayed its execution to
synchronize this event with related and already running events. For example,
events for hard disk partitions always wait for the main disk device event
to finish, because the partition events may rely on the data the main disk
event has queried from the hardware.
udevmonitor --env shows the complete event
environment:
UDEV [1132633002.937243] add@/class/input/input7
UDEV_LOG=3
ACTION=add
DEVPATH=/class/input/input7
SUBSYSTEM=input
SEQNUM=1043
PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
PHYSDEVBUS=usb
PHYSDEVDRIVER=usbhid
PRODUCT=3/46d/c03e/2000
NAME="Logitech USB-PS/2 Optical Mouse"
PHYS="usb-0000:00:1d.1-2/input0"
UNIQ=""
EV=7
KEY=70000 0 0 0 0 0 0 0 0
REL=103
udev also sends messages to syslog. The default syslog priority that
controls which messages are sent to syslog is specified in the udev
configuration file /etc/udev/udev.conf. The log
priority of the running daemon can be changed with udevcontrol
log_priority=level/number.