I need send raw buffer of data on I2c In fedora OS

32 views Asked by At

I need send buffer of characters to i2c on fedora OS. I am using following code:

file = open(path, O_RDWR);
union i2c_smbus_data dt[3];
dt[0].byte = 0xe7 ; 
dt[1].byte = 0x3f ; 
dt[2].byte = 0x00 ; 
args.read_write = I2C_SMBUS_WRITE;
args.command = 0x0d;
args.size = 4;
args.data = dt;
ioctl(file,I2C_SMBUS,&args);

It seems working only up to 3 bytes, then i am not sure what it sends. Is there any code that i can use it? Thanks,

1

There are 1 answers

0
albert waissman On

Turns out that i can simply use write(file, *buff , int len) function to send buffer to /dev/i2c-.. device directly after setting device address with ioctl.