You are not logged in.

#1 2011-06-25 07:47:27

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Need help with udev rule for hwmon devices

On my system, 4 modules are loaded for hardware monitoring: thermal, asus_atk0110, k8temp and it87. They each create a symlink in /sys/class/hwmon that links to a directory containing various system information like temperatures, voltages, fan speed, etc.

(x86_64) PWD: /sys/class/hwmon 
665 eric@ovide $ ls -l
total 0
lrwxrwxrwx 1 root root 0 Jun 25 02:23 hwmon0 -> ../../devices/virtual/hwmon/hwmon0/
lrwxrwxrwx 1 root root 0 Jun 25 02:53 hwmon1 -> ../../devices/LNXSYSTM:00/device:00/PNP0A08:00/ATK0110:00/hwmon/hwmon1/
lrwxrwxrwx 1 root root 0 Jun 25 02:23 hwmon2 -> ../../devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/
lrwxrwxrwx 1 root root 0 Jun 25 03:22 hwmon3 -> ../../devices/platform/it87.656/hwmon/hwmon3/
(x86_64) PWD: /sys/class/hwmon 
666 eric@ovide $ ls *
hwmon0:
name  power/  subsystem  temp1_crit  temp1_input  uevent

hwmon1:
device      fan2_label  fan3_min    fan5_label  fan6_min    in0_label  in1_min    in3_label  temp1_crit   temp2_label
fan1_input  fan2_max    fan4_input  fan5_max    fan7_input  in0_max    in2_input  in3_max    temp1_input  temp2_max
fan1_label  fan2_min    fan4_label  fan5_min    fan7_label  in0_min    in2_label  in3_min    temp1_label  uevent
fan1_max    fan3_input  fan4_max    fan6_input  fan7_max    in1_input  in2_max    name       temp1_max
fan1_min    fan3_label  fan4_min    fan6_label  fan7_min    in1_label  in2_min    power/     temp2_crit
fan2_input  fan3_max    fan5_input  fan6_max    in0_input   in1_max    in3_input  subsystem  temp2_input

hwmon2:
device  power/  subsystem  uevent

hwmon3:
device  power/  subsystem  uevent

Depending on the order in which udev load them, the symlinks order will change. So sometime conky, which use the information from 2 of the modules, won't be able to start. And I would be interested  in setting up the fancontrol daemon which would use that information too.

Therefore I need to write a udev rule that will load each of the 4 modules in the same order. I did the usual wiki/web search but no success. All the examples I found are for network names or devices and symlinks that are created in /dev instead of /sys. Below are some of the rules I tried so far but none of them work, i.e., nothing happens.  I was able to rename my wireless device so I suppose my method is correct; I just don't have the correct rule.

SUBSYSTEM=="hwmon", KERNEL=="hwmon5", DRIVER=="thermal",  NAME="hwmon5"
KERNEL=="hwmon?", SUBSYSTEM=="hwmon", DRIVER=="*", ATTR{name}=="atk0110", NAME="hwmon6"
KERNELS=="ATK0110:00", SUBSYSTEMS=="acpi", DRIVERS=="ATK0110", NAME="hwmon6"
SUBSYSTEM=="hwmon",  DRIVER=="asus_atk0110", ATTR{name}=="atk0110", KERNEL="hwmon5"

Any idea on what might be missing or wrong? Thanks in advance.

Offline

#2 2011-07-01 00:40:42

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Need help with udev rule for hwmon devices

FTR: On IRC, brain0 told me that you cannot use NAME= to change names and that it is wrong to assume the 'hwmonN' name is persistent.  Basically there is no clear API.

I guess I'll just reload them in the correct order and start fancontrol manually.  As I don't boot too often, the trouble will be minimal.

Offline

Board footer

Powered by FluxBB