Cooperate with sysfs Kernel I2C driver from C application side

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Cooperate with sysfs Kernel I2C driver from C application side

跳至解决方案
1,135 次查看
Anton_K
Contributor III

Hello, I'm using i.MX8 yocto build and able to select supported MISC I2C drivers as the Kernel driver. Actually I2C driver located on the kernel/drivers/misc/bh1770glc.c and I can see some sysfs attributes to configure and cooperate with physical I2C slave. 
My question is how am I able to write my own C application to access the sysfs control attribute from struct attribute_group list? Can someone help my to search some C API or examples of how to control I2C devices as the Kernel driver via sysfs attributes for example?
Thanks in advance, Anton!

0 项奖励
回复
1 解答
1,109 次查看
Anton_K
Contributor III
Oh, I've found good solution here: https://github.com/mozcelikors/tea5767_kernel_driver

It's the way to access the files on /sys/class/i2c-dev/i2c-3/device/3-0038/bh1770glc/. All files here are the attributes of sysfs group.

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,110 次查看
Anton_K
Contributor III
Oh, I've found good solution here: https://github.com/mozcelikors/tea5767_kernel_driver

It's the way to access the files on /sys/class/i2c-dev/i2c-3/device/3-0038/bh1770glc/. All files here are the attributes of sysfs group.
0 项奖励
回复