I am supposed to write a simple write and read program for i2c but the problem is that I don't have the device at hand presently to test it so I need my code to be perfect.
I am confused about the function of the I2C_SLAVE ioctl. From what I read,this ioctl is used to set the slave address.
But we pass the slave address again when performing read/write using ioctl I2C_RDWR via Addr in the structure i2c_msg. In the linux documentation it is mentioned the address set using I2C_RDWR has precedence over address set by I2C_SLAVE.
So then,what is the function of I2C_SLAVE command? Is it required?