title: Android sensors hardware abstraction layer
body: <p>I'm working on sensor data acquisition in Android (Jelly Bean on Samsung Galaxy S3). I'm new to Android/Linux internals.</p>
  
  <p>I'm trying to read Android sources on how the sensor samples rise from the drivers to userspace. As a reference take a look <a href="http://processors.wiki.ti.com/index.php/Android_Sensor_PortingGuide" rel="nofollow">here</a>.
  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.</p>
  
  <p>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?</p>
  
  <p>Any kind of help is appreciated!</p>