commit | b44006c1fb5099eaab8ca5c5edd302ef80e0b928 | [log] [tgz] |
---|---|---|
author | Harvey Yang <chenghaoyang@chromium.org> | Tue May 19 09:29:02 2020 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Jun 05 12:52:56 2020 |
tree | de4a9a1b708b8e01d559abc97f469ac32b7e2605 | |
parent | 05525b64db0aec09f27a445fb59c53be7c8b531c [diff] |
libmems: Add Fake Data of ReadSample This commit adds fake data of ReadSample for polling on the fd IioDevice provides and returning fake data. Two methods in FakeIioDevice to disable and add failed samples are also added. BUG=chromium:971175 TEST=builds Change-Id: Iad0dd340ff593cf9008920a36c7778aac1317e75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2208328 Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Tested-by: Cheng-Hao Yang <chenghaoyang@chromium.org> Auto-Submit: 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: 3dfaed61cf7c3b9902b70138d0d3abb2afeec288
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.