SDL2 Introducing Sensors API

Written by Michael Larabel in Free Software on 22 August 2018 at 12:04 AM EDT. 1 Comment
The SDL2 library that offers a cross-platform hardware abstraction layer primarily and primarily used by Linux/Windows/macOS/iOS/Android games now has a sensor API.

Initial work landed in SDL2 on Tuesday by Sam Lantinga for offering a hardware sensor API as their latest major addition to the library. The API is quite generic in being able to query the number of supported sensors, sensor names, types of sensors, read the sensor data, etc.

There's only a dummy sensor driver so far and some Android bits (Update: the initial iOS sensor bits have now landed), but it does appear that the SDL2 sensor API is primarily focused on mobile games with sensors like gyros and accelerometers. Nevertheless, great to see this new API being added to SDL2 for offering more portability by games (or other software) making use of these device sensors.

Those wanting to check out the merged bits can find it via the LibSDL Mercurial repository.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week