Ambient light sensor support in GNOME 3.18

gnomesensors

I have a Dell XPS 13 Laptop (old series) with ArchLinux and Gnome 3.18.
I've read in official gnome 3.18 release notes that

If a light sensor is present, GNOME will now automatically adjust the
display brightness in order to adjust for the ambient light level.

Can be tested using a ColorHugALS device for those who don't have
built in hardware.

Windows 8 compatible hardware is supported.

A switch in the control center's power panel allows automatic display
brightness to be turned on/off.

My ambient light sensor is not supported by Linux kernel out of the box, however I have compiled and installed / loaded this module and now my sensor appears as /sys/bus/acpi/devices/ACPI0008:00/. For example I can do

$ cat /sys/bus/acpi/devices/ACPI0008:00/iio\:device0/in_illuminance_raw
153

and read current raw illuminance.

However this seems not to be detected / supported by gnome as I still don't get a "switch in the control center's power panel" and display brightness is not automatically adjusted.

enter image description here

How can I make it work?

Best Answer

In the end I managed to get it working thanks to the support of one of the iio-sensor-proxy and kernel developers.

In my case I had to pull iio-sensor-proxy from git and apply this patch:

diff --git a/src/drv-iio-poll-light.c b/src/drv-iio-poll-light.c
index c2c5821..b568e78 100644
--- a/src/drv-iio-poll-light.c
+++ b/src/drv-iio-poll-light.c
@@ -37,7 +37,7 @@ iio_poll_light_discover (GUdevDevice *device)
        return FALSE;

    path = g_build_filename (g_udev_device_get_sysfs_path (device),
-                "in_illuminance_input",
+                "in_illuminance_raw",
                 NULL);
    ret = g_file_test (path, G_FILE_TEST_IS_REGULAR);
    g_free (path);
@@ -130,7 +130,7 @@ iio_poll_light_open (GUdevDevice        *device,

    drv_data->interval = get_interval (device);
    drv_data->input_path = g_build_filename (g_udev_device_get_sysfs_path (device),
-                        "in_illuminance_input",
+                        "in_illuminance_raw",
                         NULL);

    return TRUE;

Compiled and installed as per README instruction and finally enabled iio-sensor-proxy.service Now I have automatic brightness adjustment working.

Finally, the dev has submitted a patch to linux kernel that in future will enable iio-sensor-proxy working out of the box also on computers having similar ALS without requiring to patch iio-sensor-proxy.

Related Question