Jean Delvare wrote: > On Tue, 07 Jul 2009 11:38:46 +0000, Jonathan Cameron wrote: >> Basically it's protocol is a standard smbus type write byte command >> (address 0x19) followed by a delay (command specific) and then >> a read of multiple bytes (number is command dependant.) >> >> Unfortunately the device doesn't seem do anything helpful like notify >> you of how many bytes it is sending (as per smbus block read). >> >> I fear to make this work you'll need to write a kernel space driver. >> The first step is a conventional smbus send byte command. Follow this >> with a suitable delay. The second will need to make use of >> i2c_transfer with a msg looking something like >> >> char bob[6]; >> struct i2c_msg read_msg = { >> .addr = 0x19, >> .flags = I2C_M_RD, >> .len = 6, // as appropriate to the command >> .buf = bob, >> }; >> >> then i2c_transfer(adap, &read_msg, 1); >> >> should do the job. > > Note: this could be done from userspace too if needed. The i2c-dev > interface supports raw reads and writes. > Good point, I'd missed that functionality (did seem a little odd that I couldn't find it!) Method's much the same, but involves using the relevant ioctl (I2C_RDWR), in conjunction iwth an appropriately filled i2c_rdwr_ioctl_data structure. The i2c_smbus_access function in i2c-dev.h (lm-sensors version) is similar enough to show how to do it. Jonathan -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html