[Letux-kernel] iio-input-bridge

H. Nikolaus Schaller hns at goldelico.com
Thu Jan 31 16:18:23 CET 2019


Hi,
you may know (or not yet) that we have a special driver in Letux Kernel
which allows to map data from iio accelerometer chips to /input/events.

It started after we found that the BMA150 input driver (drivers/misc) was
not the proper way to read out the BMA180 installed in GTA04 devices.

We did present the accelerometer as /dev/input/accel and e.g. MokoMaze
did make use of it. AFAIR, Replicant for GTA04 also has a driver.

Basically the relation of iio and input event drivers is similar to an Ethernet
and TCP socket. While iio provides raw data, input is event driven (changes)
and has an abstraction to a specific device.

So we lost the input events for the BMA180 but there was an existing
iio driver to provide raw data. Therefore I wrote the iio-input-bridge
extension that brings back an /dev/input/event for accelerometers.

I have  now completely reworked the code, so that it
* has a better code structure
* cleanly handles multiple iio accelerometers and separates input event files
* is more robust with races in open/close
* reads the mount-matrix property of an iio chip and applies it so that
  we get orientation of gravity independently of how the chips are installed.

Then I have added support to all iio chips we use in Letux devices
(bma180, bno055, bmc160, itg3200 etc.) and added preliminary  device
tree information.

What we are missing is the proper mount-matrix for all devices and
sensors. This seems to be a trial-and-eror task - and the specification
is not even 100% precise. Because of this I have also tried to improve
the mount-matrix description.

Please take a look at:

	http://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-accelerometer-matrix

which is my work-in progress branch based on letux-5.0-rc4. It works
for GTA04 and should also work with Pyra (not yet tested).

The plan is to collect your feedback, then squash these
WIP-patches into a small set of clean patches.

Finally, I want to submit it to LKML and the input mailing list for further
discussion with maintainers and the broader public and we will see
if others like this approach as well.

BR,
Nikolaus

If you want to learn about input devices (which include accelerometers):

	http://www.infradead.org/~mchehab/kernel_docs_pdf/linux-input.pdf



More information about the Letux-kernel mailing list