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

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

$
0
0
I had some time to verify this.

I installed a new image using Raspberry Pi Imager, On reboot I updated all the software packages and rebooted. When I look for the humirdity1_input files:

Code:

$ find /sys -name humidity1_input 2>/dev/null/sys/devices/platform/soc/3f804000.i2c/i2c-1/1-0044/hwmon/hwmon1/humidity1_input
Notice that the humidity1_input file has a parent directory of hwmon1.

I follow the steps to build a kernel from source using the bcm2711_defconfig

Code:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs<bunch of stuff>
I then installed the kernel and modules and dtb's and boot that kernel. I look for the humidity1_input:

Code:

$ find  /sys -name humidity1_input 2>/dev/null/sys/devices/platform/soc/3f804000.i2c/i2c-1/1-0044/hwmon/hwmon2/humidity1_input
Notice that now the humidity1_input has a parent directory of hwmon2 where previously it's parent directory was hwmon1.

It doesn't seem to change at each boot but when the kernel changes the parent directory can change.

I guess I'll have to have my app check for the directory in the /sys/devices/platform/soc/3f804000.i2c/i2c-1/1-0044/hwmon/ and then use that value to construct the path name to the humidity1_input file.

Thanks
Chris

Statistics: Posted by chriskot870 — Wed Sep 04, 2024 11:05 pm



Viewing all articles
Browse latest Browse all 4817

Trending Articles