Cooperate with sysfs Kernel I2C driver from C application side

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cooperate with sysfs Kernel I2C driver from C application side

Jump to solution
499 Views
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 Kudos
Reply
1 Solution
473 Views
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.

View solution in original post

0 Kudos
Reply
1 Reply
474 Views
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 Kudos
Reply