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](http://processors.wiki.ti.com/index.php/Android_Sensor_PortingGuide).
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!