commit | 3695df9b73af3b889d1ceebf85ea84fb55c825a8 | [log] [tgz] |
---|---|---|
author | Harvey Yang <chenghaoyang@chromium.org> | Wed Aug 26 02:46:15 2020 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Aug 27 22:49:03 2020 |
tree | 3be383939d0149bf6df1d0d564d48b1e5f2f326e | |
parent | 992954e3695beb3bbc71dc8d8b9b7a3d7d428bd1 [diff] |
libmems: Define /sys/bus/iio/devices as a Constant It can also be used in mems_setup. BUG=b:165960403 TEST=builds and run Change-Id: I05c0ffa1ffb72bcd7ae3d7ddff7dab3ba5b584fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2377329 Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org> Tested-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Commit-Queue: Cheng-Hao Yang <chenghaoyang@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 36779e92c46ea463b5edc459b72ee35881b2c4e4
Project goal and motivation
This library provides a set of wrapper and test helpers around libiio.
It is meant to provide a common foundation for Chrome OS to access and interface IIO sensors, with:
At the root of the hierarchy, there exists the IioContext
, which represents the IIO devices currently available on the system. These can be retrieved by name and inspected, via instances of IioDevice
.
An IioDevice
allows reading and writing attributes of an IIO device via type-safe helper APIs. It also offers support for configuring the buffer and trigger of an IIO device, which we use in order to allow the Chrome UI to read accelerometer data and support screen rotation.
An IioDevice
also exposes a list of IioChannel
s, which can individually be enabled and disabled.
Useful mocks for the core classes are provided, such that a test author can focus on the logic of the unit tests and share a common testing language with other engineers working in this space. Sharing the foundation of testing IIO sensor access helps ensure that any improvement in this area can benefit all clients.