Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2468

Raspberry Pi OS • Re: How to access I2C device from user space

$
0
0
I ran into a weird thing.. From above I found the humidity and temperature in the following path:

Code:

$ cd /sys/bus/i2c/drivers/sht4x/1-0044/hwmon/hwmon2$ lsdevice  humidity1_input  name  of_node  power  subsystem  temp1_input  uevent  update_interval$ cat namesht4x
I have been building and booting from new kernels. I think after doing a fresh install and setting up config.txt to support i2c and the sht4x driver the location changed to;

/sys/bus/i2c/drivers/sht4x/1-0044/hwmon/hwmon1

I had to change my application to use the hwmon1 to get it to work.

Then after some more dinking around with the kernel it moved back to

/sys/bus/i2c/drivers/sht4x/1-0044/hwmon/hwmon2

I had to change my application back.

It seems weird that on different boots the device's data could appear in different paths.

Am I missing some way to find the device data at the same path on any reboot or kernel change?

I don't think I should have to change the code to use different paths on kernel changes.

Thanks
Chris

Statistics: Posted by chriskot870 — Wed Sep 04, 2024 6:58 am



Viewing all articles
Browse latest Browse all 2468

Trending Articles