Monitor-sensor doesn't work (Framework laptop)

I’m trying to get ambient light sensor readings on my Framework 13" 12th gen. Arch wiki says it should work out of the box with iio-sensor-proxy, so I enabled hardware.sensor.iio.enable in my configuration. monitor-sensor doesn’t seem to work though, when I run it it gets stuck here:

$ monitor-sensor --light
    Waiting for iio-sensor-proxy to appear

If I try to start iio-sensor-proxy.service in another terminal while monitor-sensor is running:

sudo systemctl start iio-sensor-proxy

monitor-sensor prints this and exits:

$ monitor-sensor --light
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared

** (monitor-sensor:223017): WARNING **: 19:16:23.572: Failed to claim light sensor: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.228 was not provided by any .service files

I’m on Hyprland, I’ve only seen people use iio-sensor-proxy on Gnome in the forums. Am I doing something wrong?

link to my system configuration

Hi steinunil,

I have no idea why yours is the only report about this and why there has not been any complaining. In fact, in Add support for Framework laptop, 12th gen Intel Core edition by ricci · Pull Request #461 · NixOS/nixos-hardware · GitHub which introduced the Framework 12 (and 13) support for NixOS, the hid-sensor-hub was blacklisted, which disables the ambient light sensor. This links to this discussion on the frame.work community discourse, which claims that on the Framework 12 (and 13 presumably) there is a driver issue which means that you can have brightness hotkeys or the ALS.

When you enable hardware.sensor.iio.enable this adds the hid-sensor-hub module but this is overridden by the blacklisting, so the module doesn’t get loaded, so iio-sensor-proxy doesn’t work.

You can manually modprobe hid-sensor-hub and then restart the iio-sensor-proxy service which will no longer stop immediately, and monitor-sensor can talk to it. And the brightness hotkeys still work so I don’t know what people are talking about in the other thread.

Once you fix this you may find that the ALS always reports 0s. I am stuck investigating this. But at least it’s progress.

On Apr 1 a “refactor” was merged, which actually changes the blacklist to only take effect prior to kernel 6.8.

So upgrading to linux 6.8 or higher may fix this problem.

Edit: I was able to do this by adding

boot.kernelPackages = pkgs.linuxPackages_latest;

to my configuration.nix. (Possibly I will regret this one day. I’m not sure why it’s not the default.) But doing this got me past the monitor-sensor-not-workin issue.

1 Like

Nice, thank you for looking into this! I’ll try updating my kernel later and see if I can get the ambient light sensor to report something.

I also set the kernel packages to latest and after a reboot I can confirm the ambient light sensor does work! Had no problems with the brightness hotkeys either.

$ monitor-sensor --light
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has ambient light sensor (value: 0.000000, unit: lux)
    Light changed: 3.000000 (lux)
    Light changed: 1.000000 (lux)
    Light changed: 3.000000 (lux)
    Light changed: 1.000000 (lux)
    Light changed: 3.000000 (lux)