Enabling Sensors in Celadon
This tutorial explains about sensors usage in project Celadon.
Sensors are integrated into platforms powered by Intel using Integrated
Sensor Hub (ISH). In the host OS, sensors are populated using the Linux
IIO subsystem. If a platform has support for sensors, we can find the
sensor devices in
/sys/bus/iio/devices/. Please refer to
https://docs.kernel.org/hid/intel-ish-hid.html for more information
about the ISH module.
Sensors support in CiV
CiV has support for sensors and uses the sensor mediation HAL to access IIO-based sensor devices available on host OS. The current implementation of the mediation HAL is based on Android Sensor HAL 2.0. Figure 1 illustrates the block diagram of sensors implementation in CiV.
To communicate with Host OS IIO sensor devices, the mediation HAL uses
the libiio library with a network back end. We require the libiio daemon
(iiod) to be run on the host before launching CiV. The source code path
of the sensors HAL is
the GitHub project reference is
Currently CiV has support for the following sensors:
Geomagnetic rotation vector
Enabling sensors in CiV
By default, Celadon has support for sensors. To enable sensors,
add sensors information in
mixins.spec as shown below:
The sepolicy configuration for the sensor mediation HAL is present in
To disable sensors in CiV, assign false to the sensors filed in
your lunch target’s
Run the following command to update mixin changes:
Starting the IIO daemon
Start the IIO daemon to provide access to sensors for CiV running as Guest.
The IIO daemon is an open-source project developed by Analog Devices. To start iio-daemon(iiod), we must build it from source code. Follow the steps below to clone, build, and run iiod.
git clone https://github.com/analogdevicesinc/libiio.git
git checkout tags/v0.19 -b v0.19
mkdir build && cd build && cmake .. && make && sudo make install
sudo iiod &
Confirm that iiod is running by running the following command:
$ps -aux | grep -i iiod
Validating sensors in CiV
After following the steps to enable sensors, confirm that the sensors are up and running in CiV by running the steps shown below.
Connect to CiV using adb and run
$dumpsys sensorservice to check the
list of supported sensors and their data in Android. Figure 2 shows an
example of the output to verify sensors from the host OS.
Here is a snapshot of Accelerometer data in dumpsys output.
Figure 4 shows an example of the sensor data reading from the third-party Sensors Toolbox Android app.