commit | 206654e7ea0f77bb318d8846a655a01bf55bee23 | [log] [tgz] |
---|---|---|
author | Harvey Yang <chenghaoyang@chromium.org> | Mon Dec 21 06:52:32 2020 |
committer | Copybara-Service <copybara-worker@google.com> | Wed Dec 23 10:54:25 2020 |
tree | 69443c6697a9e2e5d4607a9da0836f4bc16a101d | |
parent | b98cf2dce37abbfb4a0c481110eef93ef2ce7db3 [diff] |
libmems: Support Device Name in FakeIioDevice::ReadStringAttribute BUG=b:174544536 TEST=builds Change-Id: I6838027a5f0b9a2463c9dcdbc8e2eaf80068ef33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2595758 Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Tested-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Commit-Queue: Cheng-Hao Yang <chenghaoyang@chromium.org> GitOrigin-RevId: d2c3c945c50b698fe37c60020c775900e3aaceab
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.