GithubHelp home page GithubHelp logo

stmicroelectronics / st-mems-android-linux-sensors-hal Goto Github PK

View Code? Open in Web Editor NEW
18.0 13.0 6.0 689 KB

stm mems sensors-hal for Android and Linux platforms.

License: Apache License 2.0

C++ 94.90% Makefile 1.72% CMake 2.31% C 1.07%
iio sensors mems stm android hal android-hal mems-sensors stmicroelectronics

st-mems-android-linux-sensors-hal's Introduction

stm-sensors-hal-iio documentation

Introduction

This repository hosts the STMicroelectronics HAL (Hardware Abstraction Layer) for mems sensors running in Android or Linux systems based on the STMicroelectronics github hosted IIO drivers.

This HAL implementation is leaning on the Linux IIO framework to gather data from sensor device drivers.

You can find a list of sensors supported directly into the source code here.

Architecture

Four different components can be identified:

core
This is the main component of the HAL. All the adapter components are interacting with the core in order to send commands and receive sensors data and events.
android multi-hal (Android 11 and above)
Android multi-hal adapter.
android hidl 2.0 (Android 11 and above)
Android HIDL 2.0 adapter (full treble).
android aidl (Android 13 and above)
Android AIDL AIDL adapter (full treble).
android legacy (Android 10 and inferior)
Android legacy (pre full treble) adapter.
linux
Linux implementation adapter.

Android

HAL is compiled using different makefiles in order to support the two different modes. Fortunately this is transparent at the end for the build system, correct declaration is needed in order to choose the version to build and install.

In Android legacy mode (pre full treble) the HAL is build as dynamic library (.so) and the Android framework or HIDL 1.0 service load the library at runtime. In Android HIDL 2.0 and AIDL (full treble) mode, HAL is build as an executable and a service is created to run within it.

You can find the related documentation for Android here:

Linux

In Linux, HAL is build as an executable using cmake. Current version does list the sensors found and exit, user needs to implement the final application.

Here you can find the related documentation.

Core

This is the main component of the project. All the ‘wrappers’ are using this component for sending commands and receive data stream.

Here you can find the related documentation.

st-mems-android-linux-sensors-hal's People

Contributors

ciocca-d avatar cioccad avatar mariotesi avatar mems-jenkins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

st-mems-android-linux-sensors-hal's Issues

Support for lsm6dsv32x ?

Hi folks, I'm trying to use the hal and just realized it doesn't seem to support the lsm6dsv32x sensor, only the 16x. What would involve adding support for the 32x?

I've tried adding it to SensorsSupported.cpp and SensorsSupported.h like this:

/* LSM6DSV32X */
   SensorsSupported::Accel("lsm6dsv32x_accel", "LSM6DSV32X Accelerometer Sensor", 0.0f),
   SensorsSupported::Gyro("lsm6dsv32x_gyro", "LSM6DSV32X Gyroscope Sensor", 0.0f),
   SensorsSupported::InternalTemperature("lsm6dsv32x_temp", "LSM6DSV32X Temperature Sensor", 0.0f),

It seems like the HAL can find the sensors but when trying to sample it's stuck. These are the multihal logs:

06-05 18:01:51.283  2914  2914 I [email protected]: gyroscope rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.284  2914  2914 I [email protected]: magnetometer rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.285  2914  2914 I [email protected]: accelerometer rotation matrix: 1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000
06-05 18:01:51.285  2914  2914 I [email protected]: gyroscope placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.285  2914  2914 I [email protected]: magnetometer placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.286  2914  2914 I [email protected]: pressure placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.286  2914  2914 I [email protected]: accelerometer placement: 0.000000, 0.000000, 0.000000
06-05 18:01:51.296  2914  2914 D [email protected]: found 8 IIO devices available under /sys/bus/iio/devices
06-05 18:01:51.306  2914  2914 E [email protected]: lsm6dsv32x_temp: unable to set full scale.
...
06-05 18:01:51.354  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: injection mode not available
06-05 18:01:51.355  2914  2914 I [email protected]: accel calibration library: stm-accel-lib-mock
06-05 18:01:51.356  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: injection mode not available
06-05 18:01:51.356  2914  2914 I [email protected]: gyro calibration library: stm-gyro-lib-mock
06-05 18:01:51.357  2914  2914 I [email protected]: sensors fusion (6X) library: stm-sensors-fusion-6X-lib-mock
06-05 18:01:51.357  2914  2914 I [email protected]: sensors fusion (9X) library: stm-sensors-fusion-9X-lib-mock
06-05 18:01:51.364  2914  2914 E [email protected]: selftest functions cannot be loaded correctly
06-05 18:01:51.364  2914  2914 D [email protected]: 7 sensors available and ready
06-05 18:01:51.366  2914  2914 I [email protected]: timesync library: stm-timesync-lib-mock
06-05 18:01:51.367  2914  2914 W [email protected]: failed to load gyro bias
06-05 18:01:51.367  2914  2914 W [email protected]: failed to load accel bias

...
06-05 18:20:03.110  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:03.115  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:03.116  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:03.136  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:09.521  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:09.531  2914  2914 W [email protected]: failed to save accel bias
06-05 18:20:09.531  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:09.546  2914  2914 W [email protected]: failed to save gyro bias
06-05 18:20:23.983  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:23.988  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:24.004  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:24.014  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-on
06-05 18:20:26.102  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:26.122  2914  2914 W [email protected]: failed to save accel bias
06-05 18:20:26.122  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:26.143  2914  2914 W [email protected]: failed to save gyro bias
06-05 18:20:26.144  2914  2914 D [email protected]: LSM6DSV32X Gyroscope Sensor: power-off
06-05 18:20:30.802  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:30.802  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: changed pollrate to 60.002400Hz, timeout=0ms
06-05 18:20:30.803  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:30.821  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-on
06-05 18:20:35.831  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-off
06-05 18:20:35.846  2914  2914 W [email protected]: failed to save accel bias
06-05 18:20:35.846  2914  2914 D [email protected]: LSM6DSV32X Accelerometer Sensor: power-off

Error multi-hal build android.hardware.sensors has a conflict

During the build i got the following error:

getDeviceHalManifest: -2147483648 VINTF parse error: Cannot add manifest fragment /vendor/etc/vintf/manifest/android.hardware.
[email protected]:HAL "android.hardware.sensors" has a conflict.

The content of the file [email protected] is the same as [email protected] located into st/sensors-hal/2.0

android.hardware.sensors hwbinder 2.0 ISensors default

I have not seen/found anything in the documentation about this error, is there any aditional information about it?

Adding HAL layer in android 12

Hi All,
I am trying to add the HAL layer in android 12
I have tried with HIDL as well as with the multi-hal but nothing is working as expected

When I check it from Linux kernel device is probed and events are generated but not able to add at HAL layer
can anyone please help me to add this to androd 12

Your help is much appreciated!!!

Attempting to add support for an ambient light sensor

For an open source project, we had added sysfs-based support for an ROHM ALS sensor to the old version of the HAL. Unfortunately, I'm having some trouble getting the old sensor into the new HAL because so much changed. I want to use the 2.0 version of the HAL with our new Android 11 (LineageOS 18.1-based) ROM, but it's proving somewhat difficult to translate over. Reference commit: https://gitlab.thomasmak.in/switchroot-staging/android_hardware_stmicroelectronics_sensorhal_iio/-/commit/6ba0faff22decdd4be480650c2f987859880e6fc

I have most of the sensor definition stuff ported, but the actual Light.cpp and Light.h themselves are proving difficult. Awful WIP attempt: https://gitlab.thomasmak.in/switchroot-staging/android_hardware_st-mems-android-linux-sensors-hal/-/commit/9351685d97a60bbd15108eda97c19a29cffd6603

If you could provide any insight, that would be most helpful. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.