Friday 22 May 2015

iio-sensor-proxy 1.0 is out!

Modern (and some less modern) laptops and tablets have a lot of builtin sensors: accelerometer for screen positioning, ambient light sensors to adjust the screen brightness, compass for navigation, proximity sensors to turn off the screen when next to your ear, etc.

Enabling

We've supported accelerometers in GNOME/Linux for a number of years, following work on the WeTab. The accelerometer appeared as an input device, and sent kernel events when the orientation of the screen changed.

Recent devices, especially Windows 8 compatible devices, instead export a HID device, which, under Linux, is handled through the IIO subsystem. So the first version of iio-sensor-proxy took readings from the IIO sub-system and emulated the WeTab's accelerometer: a few too many levels of indirection.

The 1.0 version of the daemon implements a D-Bus interface, which means we can support more than accelerometers. The D-Bus API, this time, is modelled after the Android and iOS APIs.

Enjoying

Accelerometers will work in GNOME 3.18 as well as it used to, once a few bugs have been merged[1]. If you need support for older versions of GNOME, you can try using version 0.1 of the proxy.


Orientation lock in action


As we've adding ambient light sensor support in the 1.0 release, time to put in practice best practice mentioned by Owen's post about battery usage. We already had code like that in gnome-power-manager nearly 10 years ago, but it really didn't work very well.

The major problem at the time was that ambient light sensor reading weren't in any particular unit (values had different meanings for different vendors) and the user felt that they were fighting against the computer for the control of the backlight.

Richard fixed that though, adapting work he did on the ColorHug ALS sensor, and the brightness is now completely in the user's control, and adapts to the user's tastes. This means that we can implement the simplest of UIs for its configuration.

Power saving in action

This will be available in the upcoming GNOME 3.17.2 development release.

Looking ahead

For future versions, we'll want to export the raw accelerometer readings, so that applications, including games, can make use of them, which might bring up security issues. SDL, Firefox, WebKit could all do with being adapted, in the near future.

We're also looking at adding compass support (thanks Elad!), which Geoclue will then export to applications, so that location and heading data is collected through a single API.

Richard and Benjamin Tissoires, of fixing input devices fame, are currently working on making the ColorHug-ALS compatible with Windows 8, meaning it would work out of the box with iio-sensor-proxy.

Links

We're currently using GitHub for bug and code tracking. Releases are mirrored on freedesktop.org, as GitHub is known to mangle filenames. API documentation is available on developer.gnome.org.

[1]: gnome-settings-daemon, gnome-shell, and systemd will need patches

15 comments:

Søren Hauberg said...

This is fantastic! I'm really looking forward to having this running on my laptop. Any chance that it'll work with Fedora 22?

Bastien Nocera said...

Søren: It will "work" in Fedora, except that the GNOME shipped in Fedora 22 won't support it. It will be a Fedora 23/GNOME 3.18 feature.

Unknown said...

Great news! Precisely last month I was thinking about the support ambient light sensors in Gnome.
My MacBook Pro have a built-in sensor and exist some ways to play with this on Linux but not in a convenient way with Gnome. On the other hand, I was planning to craft an Android app to share ambient light sensor data with an desktop PC and adjust brightness and contrast automatically using the old DDC Control, that works perfect with my Dell monitor. I wonder If those features will be supported by Gnome in a near future. Thanks!

Bastien Nocera said...

Miguel: the sensors in the MacBooks will work, but there are no plans to control stand-alone monitors via such crude controls. If they had their own sensors and allowed the backlight to be changed however...

There's certainly nothing stopping you from wiring this up though.

Unknown said...
This comment has been removed by a blog administrator.
Mcat said...

The problem I see is that "automatic brightness" is confusing: what does that mean? It doesn't convey any connection to ambient light.

Writing labels is hard :)

Unknown said...
This comment has been removed by a blog administrator.
Unknown said...
This comment has been removed by a blog administrator.
Unknown said...
This comment has been removed by a blog administrator.
Bastien Nocera said...

Mcat: Feel free to file a bug about that :)

Rahman said...
This comment has been removed by the author.
Rahman said...
This comment has been removed by the author.
Rahman said...

Excellent work, mate! If I may ask you, will gnome enable color customization for a theme something like a made by Sam Hewitt in here http://snwh.org/paper/ . Unfortunately, I see the theme color only applies on a few applications (calculator, editor) but does not apply on most application (directory explorer, gimp, Firefox and others).

I really like if gnome will support such color customization for all application so users will have more choice to modernize their desktop look.

One more request, :), please support transparency, something like windows Aura will be amazing. Thanks.

Bastien Nocera said...

Rahman: this has nothing to do with the content of this post.

Robert said...
This comment has been removed by a blog administrator.