Improve lid closure detection with illuminance sensor?

Does anyone know if there is an attempt of improving the lid closure detection with the illuminance sensor? i.e. using the light sensor as a second factor to confirm the lid is closed, which is checked only after the hall sensor triggered.

In my case I’m using the framework 13 above another laptop and sometimes it triggers the hall sensor accidentaly.

1 Like

Both the hall sensor and the illuminance sensor would only give you inferred / deduced assruance that the lid is closed. The more direct way is a hinge angle sensor.

Sure, but I don’t think we have these today, right? I’m more curious if anyone have a better solution for the current product.

The more one is willing to settle for less, the less likely you’ll get more.

The workaround of using the illuminance sensor in your case likely requires more effort than just not stacking the laptops (or stack with a gap…e.g. placing a laptop case between them). Better spend the effort to suggest the hinge sensor as a feature request in one of the polls.

What OS are you on?
Not aware of any attempt at using the light sensor for secondary confirmation, but I would think it’s something that could be done without too much trouble, at least in Linux.

In Linux, I believe you can get the light level like so

# Get the current light level from illuminance sensor
cat /sys/bus/iio/devices/iio:device0/in_illuminance_raw

Just need to find a good reading that works for screen closed. I’d suggest checking the reading with the lid closed in the brightest room you will ever use your laptop in. Due to light leakage through the gap, it might not be as close to zero as one might think.

Turning off the screen would be done differently depending on the OS or distro.

If using Linux and Xorg, this should turn off the screen

sleep 1; xset dpms force off;

wiki.archlinux.org/title/Display_Power_Management_Signaling