We have released a sensor framework, referred to as DASH (Dynamic Android Sensor HAL), as an open source GitHub project. This actually means that we are the first manufacturer to release such a sensor framework. By making this open source, we hope that custom ROM developers will gain a lot from using it, and we also hope to see the community of developers help us improve the framework by contributing back (which we’ve already seen from CyanogenMod team). In this article, Oskar Anderö, a Sony Mobile software engineer, explains how DASH works, and how developers can contribute.
We have previously announced the open sourcing of the Dynamic Android Sensor HAL, internally called DASH for short. The sensor HAL is the software layer giving applications direct access to the sensor components. DASH was invented as a way to use the same sensor HAL implementation across multiple devices and hardware. When doing bring-ups of new Android platforms, we had to reinvent the wheel every time when it came to sensors. Nowadays, it is only a matter of enabling the sensors we need for that specific platform and configuring them according to their mounting and specifications.
As a next step, we are now making DASH available as an open source project on GitHub. Here, custom ROM developers can find the source code files and “make” files for the sensors in Xperia™ smartphones, which is used to enable and disable multiple sets of sensors for each device, including the accelerometer, proximity sensor, ambient light sensor, magnetometer, gyroscope, and pressure sensor. We plan to keep adding more sensor code as we release new phones. Anyone in the Android open community is free to contribute their own sensor implementations and other improvements to the DASH code.
What is DASH?
DASH is an Android sensor HAL implementation that has scalability and configurability in its design. Constructing a generic framework that lets the board configuration define which sensors to enable reduces the code maintenance and the integration costs. The DASH implementation further adds functionality for configuring sensors at run-time. By having DASH released as open source, there will be a robust sensor HAL implementation that the public can use. Anyone can make improvements, such as adding new features and bug fixing. And through GitHub, developers working with sensor libraries can quickly integrate a sensor HAL solution.
Key properties of the DASH
Some of the important features provided by this sensor HAL implementation include:
- Dynamic attachment of sensors using registration calls at run-time – The library framework provides a method for registering sensors at run-time, rather than statically link them at compile-time. This allows for an easier way to configure which sensors are available in the system.
- Scalability and clear modularisation – The aim has been to have a software design that is intuitive and scales well as more sensors and configurations are added.
- Clear static library interface – To calibrate sensor data, different calibration libraries could be needed. Libraries come in all flavors, from open source to binary. Using DASH makes it easier to connect the sensors to fusion libraries.
- Run-time configuration files – DASH provides a unified way for the sensors to define its’ own configuration options. These options are stored on the file system and will be read at run-time.
In order to use DASH, first a developer will need to clone the DASH code from our GitHub. Further instructions can be found at GitHub’s Git Reference site. When it comes to integration, the DASH is no different from any other sensor HAL implementation. It should simply be placed in the appropriate directory in the Android tree and the module name (sensors.default) should be added to the PRODUCT_PACKAGES.
There are some compile-time make variables that need to be set before building. For instance, each sensor has its own build flag, so the developer should enable the appropriate sensors. An example of a make configuration file can be found in the source: docs/sensors.mk.example.
Run-time configuration is done using a configuration file that is placed on the target’s file system. Each sensor wrapper defines its own configuration parameters. A configuration file example can be found in the sensors.conf.example of the docs directory for DASH. Details about the structure of the code can be found in the DASH README file on GitHub. Additional information about the project can be found at the DASH wiki page.
Ongoing collaboration with Android community
In collaboration with the developer community, we intend to build up and maintain a generic implementation by adding support for more hardware and features. Independent developers are already making open source contributions, such as the FreeXperia team, who are working with CyanogenMod to provide aftermarket firmware for Android devices. And through our close dialogue with the FreeXperia team, we are aware of the requests to share more code for the sensors. Now that we are able to do share code in a more controlled and collaborative way, the feedback from the team is that this is a very welcome initiative by the developer community.
– “It is great to see Sony open up the sensor framework, it will really help us when working with the CyanogenMod ROMs, and allows us to contribute back.” Alin Jerpelea, FreeXperia developer.
DASH can also help third-party sensor manufacturers and sensor fusion library developers as an Android sensor HAL implementation that they can work with and contribute to. A FAQ and help for GitHub is available, but if developers have a specific DASH question or issue, log it on the DASH issues page, or leave us a comment below.
- Read about the sensor HAL for 2011 Xperia phones.
- Access the open source Dynamic Android Sensor HAL (DASH) project on GitHub.
- Learn how to get and create GitHub projects on GitHub’s Git Reference site.
- Check out our other open developer community initiatives.
- Read more about how we are supporting the open developer community.