2015年5月21日 星期四

Instantiating I2C device in Linux userspace


linux/Documentation/i2c/instantiating-devices

File new_device takes 2 parameters: the name of the I2C device (a string) and the address of the I2C device (a number, typically expressed in hexadecimal starting with 0x, but can also be expressed in decimal.)

File delete_device takes a single parameter: the address of the I2C device. As no two devices can live at the same address on a given I2C segment, the address is sufficient to uniquely identify the device to be
deleted.

Example:
# echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-3/new_device
 
echo 24c64  0x51 > /sys/bus/i2c/devices/i2c-0/new_device
echo 0x51 > /sys/bus/i2c/devices/i2c-0/delete_device

沒有留言: