Linux sysfs driver questions

By edwaughcloudcycleco , 29 December 2020

I have a couple of questions about the Linux driver interface from user space. We have been looking at your example:

https://github.com/InvenSenseInc/public.MA_Lite.android_sensors_hal/blob/master/iam20680/sensors/linux/test-sensors-sysfs/test-sensors-sysfs.c

and converting it into Python. Would be happy to share when we are done if you are interested?

Our questions are:

• Are writes to the underlying buffer atomic? i.e. am I always guaranteed to get whole packets when I read the buffer or is it possible to get partial packets?
• You iterate through the read array one byte at a time checking for the header (0x0100/0x0200) but these characters are not unique and could be found at non-header locations in the buffer. How to you avoid becoming out of synchronisation? Are there underlying properties of the buffer that make this ok?
• Is there a way to read temperature from the device as part of the same file read loop?
• What is the purpose of the EMPTY and END data packets? When can I expect them to occur?
• Is there a way to access the self-test mode through this driver?
• My expectation is that the accelerometer and gyro are read simultaneously on the device however they come out with slightly different timestamps. Is correct or a characteristic of the way the driver is working?

phpbb Topic ID
38797