I have a Raspberry Pi that is running the 'bookworm' version of the OS; the 64-bit version of the OS if that makes any difference. I've installed one of the SHT3X temperature & humidity sensors, and it is apparently working fine. It's connected via I2C interface (channel 0,
/dev/i2c-0
I believe). I can read temp & humidity from the files in sysfs
; I believe the sensor is working correctly.
I have found that there are two identical folders in sysfs
that contain the same output and control files for the SHT3X device:
### folder 1: /sys/devices/platform/soc/3f205000.i2c/i2c-0/0-0044/hwmon/hwmon2
$ ls -l
total 0
lrwxrwxrwx 1 root root 0 Jun 2 21:55 device -> ../../../0-0044
-rw-r--r-- 1 root root 4096 Jun 2 21:55 heater_enable
-r--r--r-- 1 root root 4096 Jun 2 21:55 humidity1_alarm
-r--r--r-- 1 root root 4096 Jun 2 21:55 humidity1_input
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_max
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_max_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_min
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_min_hyst
-r--r--r-- 1 root root 4096 Jun 2 21:55 name
lrwxrwxrwx 1 root root 0 Jun 2 21:55 of_node -> ../../../../../../../../firmware/devicetree/base/soc/i2c@7e205000/sht3x@44
drwxr-xr-x 2 root root 0 Jun 2 21:55 power
-rw-r--r-- 1 root root 4096 Jun 2 21:55 repeatability
lrwxrwxrwx 1 root root 0 Jun 2 21:55 subsystem -> ../../../../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Jun 2 21:55 temp1_alarm
-r--r--r-- 1 root root 4096 Jun 2 21:55 temp1_input
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_max
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_max_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_min
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_min_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:52 uevent
-rw-r--r-- 1 root root 4096 Jun 2 21:55 update_interval
### folder 2: /sys/class/hwmon/hwmon2
$ ls -l
total 0
lrwxrwxrwx 1 root root 0 Jun 2 21:55 device -> ../../../0-0044
-rw-r--r-- 1 root root 4096 Jun 2 21:55 heater_enable
-r--r--r-- 1 root root 4096 Jun 2 21:55 humidity1_alarm
-r--r--r-- 1 root root 4096 Jun 2 21:55 humidity1_input
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_max
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_max_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_min
-rw-r--r-- 1 root root 4096 Jun 2 21:55 humidity1_min_hyst
-r--r--r-- 1 root root 4096 Jun 2 21:55 name
lrwxrwxrwx 1 root root 0 Jun 2 21:55 of_node -> ../../../../../../../../firmware/devicetree/base/soc/i2c@7e205000/sht3x@44
drwxr-xr-x 2 root root 0 Jun 2 21:55 power
-rw-r--r-- 1 root root 4096 Jun 2 21:55 repeatability
lrwxrwxrwx 1 root root 0 Jun 2 21:55 subsystem -> ../../../../../../../../class/hwmon
-r--r--r-- 1 root root 4096 Jun 2 21:55 temp1_alarm
-r--r--r-- 1 root root 4096 Jun 2 21:55 temp1_input
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_max
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_max_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_min
-rw-r--r-- 1 root root 4096 Jun 2 21:55 temp1_min_hyst
-rw-r--r-- 1 root root 4096 Jun 2 21:52 uevent
-rw-r--r-- 1 root root 4096 Jun 2 21:55 update_interval
And there's more; e.g.:
### folder 3: /sys/devices/platform/soc/3f205000.i2c/i2c-0/0-0044/hwmon/hwmon2/subsystem/hwmon2
I realize there are symlinks involved, but is there a *true/immutable* location for these files in sysfs
? I've read some references on sysfs
(https://thelinuxcode.com/linux-sysfs-file-system/) , (https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html) , but found no explanation for this apparent duplication. Can someone explain the apparent redundancy, and if there is an immutable location for the files?
Asked by Seamus
(3772 rep)
Jun 3, 2024, 04:56 AM
Last activity: Jun 3, 2024, 05:33 AM
Last activity: Jun 3, 2024, 05:33 AM