Hugo Meric wrote: > > Thank you for the advice. So today I try and I finally got something > (using code on the internet: > http://www.stlinux.com/docs/manual/distribution/distribution_guide6.php#1124364 > ). The code seems right and the only problem is that I don't know how to > get the data at the end. > > After the call ioctl(file, I2C_RDWR, (unsigned long)&work_queue), the > datas are in work_queue (I hope so) but I don't know how to get the 6 > values of the HMC6343 sensor. That's a somewhat odd looking bit of code. I'm not remotely sure what they are doing with it. As I've never used this particular ioctl, Jean please correct me if I'm wrong. For some reason they've configured the messages to have length 0 and no associated data buffer. (work_queue.msgs[idx]).len = 0; //this next line is really odd. Either they were adressing a whole array //or something no where near standard. This should be fixed at the address //of the chip you are talking to. (work_queue.msgs[idx]).addr = start_address + idx; (work_queue.msgs[idx]).buf = NULL; so set len to 6 and the buf to point to a 6 byte character array. You'll also need to set .flags = I2C_M_RD in the msg in question in order to ensure a read occurs (rather than attempting to write the contents of buf. After the ioctl call, your data should be character array that you set the pointer buf to point at. Note you only want the one message to be sent after the delay after your command message (for which you can use a simple smbus write byte command). 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