Android sensors hardware abstraction layer

白昼怎懂夜的黑 提交于 2020-12-14 12:59:46

问题


I'm working on sensor data acquisition in Android (Jelly Bean on Samsung Galaxy S3). I'm new to Android/Linux internals.

I'm trying to read Android sources on how the sensor samples rise from the drivers to userspace. As a reference take a look here. I can go all the way from the SensorManager down to the SensorService. I can see the kernel module loading infrastructure, the registration of the event input device and the input_report_rel() function calls in the drivers (e.g. the open-sourced accelerometer driver of Galaxy S3). But I get lost in between, i.e. in the hardware abstraction layer. SensorService (with the aid of SensorDevice) ultimately calls into the HAL through function pointers in struct sensors_poll_device_t. The header files are in /hardware/libhardware/include/hardware.

Where is the HAL implemented? How's the interaction among the HAL and the kernel's input subsystem performed? How is the SensorService discovers which sensors are available in the platform and the files to access them from userland?

Any kind of help is appreciated!


回答1:


For a high level map of where the Android Sensors HAL fits in and what its responsibilities are take a look at the slides from my Design West presentation in 2012 Integrating Sensors Into Android Hardware.

The slides detail how the widely available SensorBase class can be used to read Input Event based sensor drivers, and how the HAL implements the get_sensors_list function to let the SensorService know what sensors this particular device has.




回答2:


I know that beaglebone (a TI development board), the sensors HAL source code is located at /device/ti/am335xevm/libsensors/ .searching the keyword 'libsensors' is a simple way.



来源:https://stackoverflow.com/questions/13704591/android-sensors-hardware-abstraction-layer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!