I2C_SLAVE ioctl purpose
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing code for implementing a simple i2c read/write function using the general linux i2c driver linux/i2c-dev.h I am confused about the ioctl : I2C_SLAVE The kernel documentation states as follows : You can do plain i2c transactions by using read(2) and write(2) calls. You do not need to pass the address byte; instead, set it through ioctl I2C_SLAVE before you try to access the device However I am using the ioctl I2C_RDWR where I again set the slave address using i2c_msg.addr . The kernel documentation also mentions the following :