Android传感器硬件抽象层 [英] Android sensors hardware abstraction layer

查看:150
本文介绍了Android传感器硬件抽象层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Android(Samsung Galaxy S3上的Jelly Bean)中的传感器数据采集.我是Android/Linux内部人员的新手.

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

我正在尝试阅读有关传感器样本如何从驱动程序扩展到用户空间的Android资源.作为参考,请此处. 我可以从SensorManager一直到SensorService.我可以看到内核模块加载基础结构,事件输入设备的注册以及驱动程序(例如Galaxy S3的开源加速度计驱动程序)中的input_report_rel()函数调用. 但是我介于两者之间,即在硬件抽象层中迷路了. SensorService(借助SensorDevice)最终通过struct sensor_poll_device_t中的函数指针调用HAL.头文件位于/hardware/libhardware/include/hardware中.

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.

HAL在哪里实施? HAL与内核的输入子系统之间的交互是如何进行的? SensorService如何发现平台中可用的传感器以及可以从用户区访问它们的文件?

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?

感谢任何帮助!

推荐答案

有关Android Sensors HAL适用位置及其职责的高层地图,请查看我2012年Design West演示文稿中的幻灯片将传感器集成到Android硬件中.

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.

幻灯片详细介绍了如何使用广泛可用的SensorBase类读取基于输入事件的传感器驱动程序,以及HAL如何实现get_sensors_list函数以使SensorService知道此特定设备具有哪些传感器.

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.

这篇关于Android传感器硬件抽象层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆