I want to name a (USB) device persistently depending on the port it is connected to. Using udevadmin I found the following info# udevadm info --name=input/event3 | grep ID_PATHE: ID_PATH=platform-ci_hdrc.1-usb-0:1.1.4:1.0E: ID_PATH_TAG=platform-ci_hdrc_1-usb-0_1_1_4_1_0So the device seems to have properities ID_PATH and ID_PATH_TAG, which look like what I want.I added to a matching udev.ruleSYMLINK+=foo-%E{ID_PATH_TAG} foo1-$env{ID_PATH} foo2-$env{ID_PATH_TAG}(The 3 variants where just trying desperately... one should be enough once it works.)The rule gets executed and the there is no error in the log (log level = debug).However, the created symbolic links are called/dev/foo-/dev/foo1-/dev/foo2-So it looks like the properties ID_PATH and ID_PATH_TAG are not yet set when my rule gets executed. Do I need to pay attention to any ordering?
udev fails to create persistenly named symlink using ID_PATH
udev
I saw that existing rules using ID_PATH are all 60-* or higher. Mine was 45-* for no particular except historic reasons.Renaming my rules file shows that it's the rule number that makes the difference:59-foo.rules: ID_PATH/ID_PATH_TAG expand to empty string60-foo.rules: ID_PATH/ID_PATH_TAG expand to empty string61-foo.rules: ID_PATH/ID_PATH_TAG expand correctlyThe explanation is in 60-persistent-input.rules containingSUBSYSTEMS==pci|usb|platform|acpi, IMPORT{builtin}=path_idI could not find documentation for the builtins, but I'm guessing that the path_id builtin puts ID_PATH/ID_PATH_TAG into the environment.