How to access registered I2C device in linux kernel from user space

I want to be able to change registers in an I2C slave. The device has a driver in its kernel, and the driver registers the I2C client with its address.

The driver is very simple and outputs all the functionality of the device. I want to access registers from user space, but when I try to access it with I2C-dev I get an error - device or resource busy.

I don't want to add functionality to the driver, and I prefer to write a user-space application to change device registers.

How do I use I2C-dev to change registers in such a case?

+3


source to share


1 answer


So, after researching I2C-dev, I was able to overcome this issue. I noticed the I2C_SLAVE_FORCE flag inside the ioctl function. With the flag set, the function will ignore if the I2C address is already registered.



+1


source







All Articles