When I use the attached python script in SHR , I get the following error in
every Kernel. Sometimes 16 or 32 values get lost as you can see in the log.
This doesn't happen if I set the sample_rate to 100 Hz. Is this a known
hardware/kernel/python problem ?
What does the number in
/sys/class/i2c-adapter/i2c-0/0-0073/lis302dl.1/overruns
in the new kernels mean?
Log:
counter | ms | diff in ms | x | y | z
41 263.997 2.388 18 90 882
42 347.221 83.224 18 90 918 <- losing ~32 values
43 349.708 2.487 36 90 900
44 352.107 2.399 18 90 900
45 354.591 2.484 18 90 900
46 357.038 2.447 18 90 900
47 359.495 2.457 18 90 882
48 361.899 2.404 36 90 900
49 364.37 2.471 36 90 900
50 366.799 2.429 36 90 918
51 369.281 2.482 18 90 918
52 371.728 2.447 18 108 918
53 374.136 2.408 36 90 882
54 376.588 2.452 18 108 900
55 379.019 2.431 36 108 882
56 381.475 2.456 18 90 900
57 383.966 2.491 18 90 900
58 386.368 2.402 18 90 918
59 428.008 41.64 18 90 882 <- losing ~ 16 values
60 430.444 2.436 18 90 900
61 432.861 2.417 18 72 918
62 435.409 2.548 18 108 900
63 437.771 2.362 18 108 900
64 440.251 2.48 36 90 900
65 442.677 2.426 18 90 882
66 445.115 2.438 36 108 882
67 447.578 2.463 18 90 900
68 449.976 2.398 36 90 900
69 491.626 41.65 18 90 900 <- losing ~ 16 values
Greets
Michael
#!/usr/bin/python
import struct
from math import sqrt
x = 0
y = 0
z = 0
timeold=0
timediff=0
counter=0
secondsensorfile = "/dev/input/event2"
#int, int, short, short, int
fmt = 'iihhi'
#open file in binary mode
in_file = open(secondsensorfile,"rb")
event = in_file.read(16)
while event:
(time1,time2, type, code, value) = \
struct.unpack(fmt,event)
time = time2 / 1000.0
if type == 2:
if code == 0:
x = value
if code == 1:
y = value
if code == 2:
z = value
if type == 0 and code == 0:
timediff = time - timeold
timeold = time
counter = counter + 1
print counter,time,timediff, x, y, z
event = in_file.read(16)
in_file.close()