| 1 | Debugging the udev event processing
 | 
|---|
| 2 | ===================================
 | 
|---|
| 3 | 
 | 
|---|
| 4 | To visualize the driver core events and the udev event processes, use:
 | 
|---|
| 5 |   udevmonitor
 | 
|---|
| 6 | 
 | 
|---|
| 7 | it prints:
 | 
|---|
| 8 |   UEVENT[1132632714.285362] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
 | 
|---|
| 9 |   UEVENT[1132632714.288166] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
 | 
|---|
| 10 |   UEVENT[1132632714.309485] add@/class/input/input6
 | 
|---|
| 11 |   UEVENT[1132632714.309511] add@/class/input/input6/mouse2
 | 
|---|
| 12 |   UEVENT[1132632714.309524] add@/class/usb_device/usbdev2.12
 | 
|---|
| 13 |   UDEV  [1132632714.348966] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2
 | 
|---|
| 14 |   UDEV  [1132632714.420947] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
 | 
|---|
| 15 |   UDEV  [1132632714.427298] add@/class/input/input6
 | 
|---|
| 16 |   UDEV  [1132632714.434223] add@/class/usb_device/usbdev2.12
 | 
|---|
| 17 |   UDEV  [1132632714.439934] add@/class/input/input6/mouse2
 | 
|---|
| 18 | 
 | 
|---|
| 19 | UEVENT lines show the events the kernel sends over netlink, the UDEV lines
 | 
|---|
| 20 | show the finished udev event handlers. The timing is printed in microseconds.
 | 
|---|
| 21 | The time between UEVENT and UDEV is the time udev took to process this event
 | 
|---|
| 22 | or was queued to synchronize it with other events.
 | 
|---|
| 23 | 
 | 
|---|
| 24 | If called with:
 | 
|---|
| 25 |   udevmonitor --env
 | 
|---|
| 26 | 
 | 
|---|
| 27 | it prints the whole event environment:
 | 
|---|
| 28 |   UDEV  [1132633002.937243] add@/class/input/input7
 | 
|---|
| 29 |   UDEV_LOG=3
 | 
|---|
| 30 |   ACTION=add
 | 
|---|
| 31 |   DEVPATH=/class/input/input7
 | 
|---|
| 32 |   SUBSYSTEM=input
 | 
|---|
| 33 |   SEQNUM=1043
 | 
|---|
| 34 |   PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0
 | 
|---|
| 35 |   PHYSDEVBUS=usb
 | 
|---|
| 36 |   PHYSDEVDRIVER=usbhid
 | 
|---|
| 37 |   PRODUCT=3/46d/c03e/2000
 | 
|---|
| 38 |   NAME="Logitech USB-PS/2 Optical Mouse"
 | 
|---|
| 39 | 
 | 
|---|
| 40 | 
 | 
|---|
| 41 | Udev also sends messages to syslog according to the configured debugging
 | 
|---|
| 42 | level. Udev specific tools which are called, also respect the setting
 | 
|---|
| 43 | of udev_log. But there might be some which need special actions to make
 | 
|---|
| 44 | them verbose.
 | 
|---|
| 45 | 
 | 
|---|
| 46 | Set  udevs loglevel in the damon at runtime with:
 | 
|---|
| 47 |   udevcontrol log_priority=<level>
 | 
|---|
| 48 | 
 | 
|---|
| 49 | Enable logging permanently, set (it may make udev _very_ slow):
 | 
|---|
| 50 |   udev_log=info in /etc/udev/udev.conf.
 | 
|---|
| 51 | 
 | 
|---|
| 52 | 
 | 
|---|
| 53 | For further processing of the logging output you should get a clean logfile at
 | 
|---|
| 54 | next boot. Just move the old logfile away. (Syslog will still use the moved file
 | 
|---|
| 55 | until it's restarted).
 | 
|---|
| 56 | 
 | 
|---|
| 57 | The script 'show_event_log' provided along with this file, can be used to
 | 
|---|
| 58 | extract info out of /var/log/messages. Call it:
 | 
|---|
| 59 |   show_event_log <first> [<last> [<list of event types>] ]
 | 
|---|
| 60 | <first> is the sequence number of the first event you are interested in.
 | 
|---|
| 61 | <last>  is the number of the last event. You may write 'last' literally. It may
 | 
|---|
| 62 |         also be omitted if you want to see a single event. 
 | 
|---|
| 63 | <list>  is a list of event types you like to see. If you omit it, you get most
 | 
|---|
| 64 |         events, not all. Some are exclude by default. Use " " as list if you
 | 
|---|
| 65 |         want to see really all. Or edit the list of skipped events in the first
 | 
|---|
| 66 |         lines of the script
 | 
|---|
| 67 | 
 | 
|---|
| 68 | If you don't use /var/log/messages as the logfile you may set the environment
 | 
|---|
| 69 | variable MESSAGES=<logfile>.
 | 
|---|
| 70 | 
 | 
|---|