Skip to content

iio-poll-accel: Use thread to poll accelerometer's data

Jian-Hong Pan requested to merge github/fork/starnight/I245 into master

We have some Acer Veriton Z4660G and Z4860G AIO desktops which equip with an accelerometer SMO8840.

We found it takes more than 2 seconds to poll accelerometer's one axis data.

date;
cat /sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-7/i2c-SMO8840:00/iio:device0/in_accel_x_raw;
date

Thu Nov 15 12:28:33 CST 2018 1 Thu Nov 15 12:28:36 CST 2018

Reading 3 axes takes almost 7 seconds. The IO blocks the single thread main event loop.

This patch uses another thread for reading the accelerator's values. The read values will be saved in the middle variables. poll_orientation function only reads the middle values and will not block main event loop long time. #245 (closed)

Signed-off-by: Jian-Hong Pan jian-hong@endlessm.com

Merge request reports