Question

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!

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top