You are not logged in.

#1 2022-08-25 08:09:45

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,669
Website

[SOLVED] Check udev $devpath

I am trying to test whether a udev rule is applied correctly.
Here's the actual rule

ACTION=="add", SUBSYSTEM=="block", ENV{ID_MODEL}=="ADATA_IMSS316-256GD", RUN{program}+="/usr/bin/hdparm -S 0 $devpath"

I modified it to verify the device path:

ACTION=="add", SUBSYSTEM=="block", ENV{ID_MODEL}=="ADATA_IMSS316-256GD", RUN{program}+="/usr/bin/echo Device path: $devpath > /tmp/test"

I created the above rule in /etc/udev/rules.d/test.rules
But after a call to

# udevadm control --reload-rules && udevadm trigger

The file /tmp/test is not created.
How can I test whether the udev devpath is the correct one?

Solution:

# udevadm test /sys/class/block/sda

Last edited by schard (2022-08-25 08:22:04)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

Board footer

Powered by FluxBB