0

I am currently testing some things with an accelerometer and its iio buffer and there is something that confuses me. The sensor does have four different scan elements: x, y, z and a timestamp. The indices of those values are:

x = 0, y = 1, z = 2 and time = 3. So far so good. If I enable all available scan elements the order of the entries is set according to the description.

everything enabled:

0000010 f758 011c 3f64 c0b0 be90 0bfe 499f 0004
0000020 f724 0134 3f58 c0b0 3f2f 10ab 499f 0004

But once I have gaps, for example if I disable the scan element for y, the z value jumps onto index 1 and my buffer looks like this:

x, z and time:

0000010 f720 3f70 0000 0000 722a 5c13 4946 0004
0000020 f728 3f74 0000 0000 0958 60c0 4946 0004

z and time:

0000010 3f6c 0000 0000 0000 ca0b 6ef1 48be 0004
0000020 3f44 0000 0000 0000 edf7 739e 48be 0004

only x and z:

0000010 f720 3f48 f748 3f54 f744 3f5c f75c 3f68
0000020 f750 3f78 f738 3f80 f718 3f64 f700 3f50

I could not find further information on this but I am a bit confused and surprised that the scan elements do not respect their given index once the timestamp is activated and there is an index gap. Is this the normal behavior or is this some stuff that the current sensor driver mixes up?

creolo
  • 318
  • 1
  • 8
  • Which kernel version you are using? It was recently a big refactoring inside IIO subsystem to make sure timestamp is always aligned. – 0andriy Aug 20 '21 at 08:11
  • We are currently on verion 4.19.0. I am just wondering if this is normal behavior or a bug in the sensor driver – creolo Aug 20 '21 at 08:31
  • Can you reproduce this on the latest vanilla (v5.14-rc6)? And I'm wondering why you use **0**, when v4.19.y stable is nowadays at **204**. – 0andriy Aug 20 '21 at 09:19
  • Since I was not in involed in chosing the kernel version I am not totally aware of the reasons for that choice. I am sure there are some, but I did not deal with this. I will have a look if I can test it on the latest vanilla and I will let you know – creolo Sep 08 '21 at 14:53

0 Answers0