STMicroelectronics / st-mems-android-linux-sensors-hal

stm mems sensors-hal for Android and Linux platforms.
Apache License 2.0
20 stars 6 forks source link

Attempting to add support for an ambient light sensor #1

Closed makinbacon21 closed 2 years ago

makinbacon21 commented 2 years ago

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!

ciocca-d commented 2 years ago

I have just added support for multi-hal 2.0 and 2.1, please check it out! I would suggest to use this approach (multi-hal) and get support from the other vendor for integrating the hal regarding the als sensor. As you can imagine we do not support sensors that are not STM.

makinbacon21 commented 2 years ago

Of course of course. Multi-hal will really help. Unfortunately there is no hal for this particular sensor that I could find so I shall go attempt to write it into a generic one. If you ever add an STM light sensor definition i could always cram it into there, could be easier, but I'll go the multi-hal route for now. Thanks!

ciocca-d commented 2 years ago

We don't have a plan right now to add an STM light sensor but it could happen sooner or later, stay tuned!