Commands in User Space

Linux provides some useful I2C related commands in the file system helping us control I2C bus.

The following code blocks provide some simple examples.
  • To detect all the registered I2C adapters:
    i2cdetect -l 
  • To detect all the client devices mounted on the specified I2C adapter:
    i2cdetect -y -r [i2c_adpter_index]
  • To read the address from the specified I2C client:
    i2cget -y [i2c_adpter_index] [i2c_client address] [address]
  • To write the address to the specified I2C client:

    i2cset -y [i2c_adpter_index] [i2c_client address] [address] [value]