Edit: Go to bottom to read resolution:

am trying to make a stable link to read t-sensor

$ sudo nano /etc/udev/rules.d/t_sensor-temp-stable-path.rules
ACTION=="add", SUBSYSTEM=="hwmon", KERNEL=="hwmon*", ENV{HWMON_NAME}=="asusec", SYMLINK+="t_sensor_temp", RUN+="/bin/sh -c 'ln -s /sys/class/hwmon/%k/temp2_input /dev/t_sensor_temp'"
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

expected result, t-sensor temp2_input file is now linked in /dev/t_sensor_temp

actual result no link in /dev

 $ cat /dev/t_sensor_temp
cat: /dev/t_sensor_temp: No such file or directory

even after rebooting,and running $ sudo udevadm control --reload-rules $ sudo udevadm trigger its still failing to create link.

i have stable links in /dev for gpu and cpu which work perfectly

Edit: so i may of resolved the issue and am adding this to maybe help others in the future worth noting i preface “may of” as im not sure if when a hardware change acures that udev will continue to link to hwmon* temp2_input

i first changed the rule

 ACTION=="add", SUBSYSTEM=="hwmon", ATTRS{name}=="asusec", SYMLINK+="t_sensor_temp", RUN+="/bin/sh -c 'ln -s /sys/class/hwmon/%k/temp2_input /dev/t_sensor_temp'"

kernel is now not present, “ENV{HWMON}” is now “ATTRS{name}” but with these edits the link still was not created. once i ran the command sudo udevadm trigger --action=add --subsystem-match=hwmon --attr-match=name=asusec then the symbolic link was created. its been frustrating but glad we got the in the end.

if someone can shine a light on the strange behavior that would be great.

            • squid_slime@lemmy.worldOP
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              8 months ago

              i appreciate the link but sadly this isnt the same issue, so what i am attempting is to create a stable symlink from hwmon* as hwmon* has a tendency to move around with changes with hardware, like right now t_sensor is /sys/class/hwmon/hwmon4 but after boot it could change to hwmon2 or 3 etc etc so setting a udev rule that will search for ENV name “asusec” (stored in dir containing t_sensor) as a means to point to the correct hwmon* dir on boot to then create a symlink. in my case i have created stable symlinks for gpu, cpu and am attempting the same for t_sensor but weirdly it wont work for this one component.

              Edit: fixed it i hope, if your interested in the saga then feel free to read my edited post