|
|
Log in / Subscribe / Register

Ambient light adjustment on the desktop

By Nathan Willis
June 3, 2015

Many current smartphones and tablets are able to automatically adjust their screen brightness in response to ambient lighting conditions. Doing so is often to help reduce battery usage, but it also provides a more eye-pleasing (or, to put it another way, a less eye-straining) user experience. Both issues are of concern to laptop users as well, but desktop Linux environments have not historically supported such a feature. Recently, Richard Hughes released a small, inexpensive hardware add-on that make automatic backlight adjustment possible.

[ColorHug ALS sensor]

The device is called the ColorHug ALS (for "ambient light sensor"). Hughes announced it in March 2015, with an initial batch of just 42 units. The ALS uses the same light sensor that Hughes has previously employed in his first-generation ColorHug devices. Around the same time, he announced the first test units of a significant update to the ColorHug that makes use of a more sophisticated light sensor. Consequently, the ColorHug ALS may be, in part, a way to make use of unused stock from the old model—in which case it is possible that, when the first batch is gone, a second batch may never appear (although the designs and schematics are freely available to anyone wishing to make their own).

On the other hand, the ColorHug ALS is used with the same client software package (colorhug-client) as the ColorHug colorimeter, which could perhaps be repurposed as an ambient light sensor should the user be so inclined. Hardware details aside, though, it is the software side of the project that is the most interesting. The device is physically tiny; it plugs into a USB-A port and less than half of the circuit board sticks out beyond the edge of the port—just enough for the light sensor and a status LED that blinks when inserted.

Version 0.2.6 and newer of colorhug-client includes a tool called colorhug-backlight that polls the device for an ambient-light reading, then adjusts the display backlight setting in order to compensate for any changes since the last measurement. The user needs to manually adjust the brightness to their personal preference; the utility just makes adjustments to keep it at the same relative level as conditions change. The tool also provides a time-series plot of the readings over the past few minutes, should one desire to see some context.

[ColorHug backlight utility]

I tested out the device and tool on a laptop (running GNOME 3.14, which is the minimum required version, although I did have to manually update the colord and gusb packages to the versions that were included on the USB stick that shipped with the device). Under normal conditions, the brightness adjustments are subtle enough that one might not even notice them happening. A sudden, drastic change might make for a different experience, of course. Users whose computing environments include strobe lights might find the device's response time less satisfactory, but those users clearly have bigger issues to worry about.

Moving forward, though, requiring the installation and usage of a custom utility to maintain proper backlight levels is hardly the ideal solution. To that end, Hughes noted in his original blog post that the goal was to get the backlight-control framework moved upstream into GNOME control center.

The next big improvement on that front came on May 27, when he announced a new version of the ALS firmware. This firmware revision is the work of Benjamin Tissoires, and it implements the Sensor Human Interface Device (HID) API that Microsoft is promoting to Windows 8 equipment manufacturers. Consequently, the same code (presumably GNOME control center, at some reasonably near point in the future) would be able to monitor the ColorHug ALS or the built-in light sensors of many recent laptops. Thus, a great many more users will be able to take advantage of automatic brightness adjustments.

Users on desktop machines, though, appear to be out of luck for the time being. Obviously battery life is not of concern to anyone running on wall power, but lighting conditions can and do change in offices and homes as well. Unfortunately, external displays do not provide the same sort of access to backlight adjustments that laptop screens do—so, even with an ambient light reading, other steps would be required to keep the brightness level consistent. Hughes noted this in an email to the colorhug-users mailing list. In a follow-up message, he added that supporting external monitors under X11 would require "several hundred hours" of additional work. The task would be far simpler under Wayland, he said, but at present there are not enough Wayland-only systems to justify the effort.

On May 22, Bastien Nocera announced the 1.0 release of his iio-sensor-proxy project, which provides a general framework for monitoring a variety of environmental sensors (as distinct from internal hardware health sensors like CPU thermometers, which have been well-supported on Linux systems for quite some time). Ambient light sensors are among the first sensors supported by iio-sensor-proxy, and Nocera's announcement included a preview image of how the support may look in GNOME 3.18: a simple toggle switch labeled "Automatic brightness" underneath the existing screen-brightness slider.

Widespread support for this sort of feature may someday be taken for granted. Until then, the ColorHug ALS remains an inexpensive (£20) and simple way to keep one's screen brightness even. It will be interesting to see how much further the project can go, though: the light sensor in the ColorHug ALS reports RGB color readings as well as overall luminosity; one could conceivably use it to make adjustments that take the color of the room light into account as well. There have been allusions to such uses on the colorhug-users mailing list; suffice it to say that a number of people are interested in having their Linux distribution respond more readily to the real-world conditions surrounding the user—which is always a positive step.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2015, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds