1. Get the source code of I2C tools
Reference: http://lm-sensors.org/wiki/I2CTools
$ Wget http://dl.lm-sensors.org/i2c-tools/releases/i2c-tools-3.1.0.tar.bz2
2. Compile the source code
$ Tar-jxvf i2c-tools-3.1.0.tar.bz2
$ I2c-tools-3.1.0 CD
$ Cc = arm-None-Linux-gnueabi-GCC make (if not for embedded system, so without cc = arm-None-Linux-gnueabi-GCC)
Then you will get i2cdetct,
I2cget, i2cset,
I2cdump under tools directory.
3. Copy these tools to embedded system and use them
3.1 i2cdetect -- detect I2C Devices
$./I2cdetect-R 0
3.2 i2cdump -- dump I2C device information (EEPROM as an example)
$./I2cdump-F-Y 0 0x50 (0 is I2C bus number, 0x50 is the eeprom I2C address)
3.3 i2cset -- write some where (device 0x50, offset 0x3, value 0x5)
$. /I2cset-F-Y 0 0x50 0x3 0x5 (write address 0x3 with value 0x5 on I2C bus 0, the I2C device address is 0x50)
3.4 i2cget -- read some where (device 0x50, offset 0x3)
$./I2cget-F-Y 0 0x50 0x3 (read address 0x3 on I2C bus 0, the I2C device address is 0x50)