5

Udev is hard to debug. – The virgin environment during system boot always deviates at least a little from the environment during a later re-run.

Thus, I’m trying to write udev-rules with the understanding of udev instead of trial-and-error.

One big problem is: Which udev-attributes are available during hot-/cold-plug?

The confusion comes from these two commands:

udevadm test /sys/class/net/wlx801f024ddc32
udevadm info --attribute-walk --path=/sys/class/net/wlx801f024ddc32

Both, for example, list SUBSYSTEM, which I know is available for udev-rules. But only the former has DEVTYPE (at least for wlan devices), while only the latter has KERNEL.

I actually need DEVTYPE (being “wlan”) during boot, but it seems not available when the rules kick in...

Robert Siemer
  • 1,885
  • 1
  • 23
  • 29

1 Answers1

3

Here is my understanding:

  • udevadm info -a : shows the attributes ATTRS{} and the device hierarchy.
  • udevadm test : shows the ENV{} variables during udev processing.

They do not show the same type of information. Your DEVTYPE variable may exist and should be tested as ENV{DEVTYPE}=="wlan". However, it should be taken into account that ENV{} variables are created progressively during the udev processing. Therefore, the order of your rule matters and it should appear after ENV{DEVTYPE} has been created by another rule.

You can analyze the file 'udev_actions.txt' from the command below in order to deduce how things are ordered. Then you can decide the best number for your '.rules' file in order to test ENV{DEVTYPE}.

$ sudo udevadm test $DEVPATH 1> udev_ENV.txt 2> udev_actions.txt
Olivier
  • 131
  • 2