frank-zago/ch341-i2c-spi-gpio

open i2c device using ioctl is not supported

axet opened this issue · 1 comments

axet commented

Hello!

I'm trying to setup mlx90640 i2c device using CH341T-V3 usb stick. When device opened via ioctl command I get following:

I2C device tree: '/dev/i2c-7'
Starting...
Configured...0
refresh = 0
Ioctl read i2c error:: Operation not supported

Checking the source code it seems like ioctl call failed:

        ioctl_msg[0].len	= 	len;
        ioctl_msg[0].addr	= 	device->addr;
        ioctl_msg[0].buf	=	buf;
        ioctl_msg[0].flags	=	flags | I2C_M_RD;

        /* Package to i2c message to operation i2c device */
        ioctl_data.nmsgs	=	1;
        ioctl_data.msgs		=	ioctl_msg;

        ioctl(device->bus, I2C_RDWR, (unsigned long)&ioctl_data) == -1

I'm not sure if drive fully support linux i2c bus commands or not.

Full source:

i2c bus drivers do not support ioctl directly; this is done through the i2c core. There could be a parameter that the driver doesn't like though, or a missing option. ???