4

I love that I can now take advantage of the ambient light sensor on my Surface Pro 3, and use Automatic Brightness like I'm used to on my phone. It's now built-in (to GNOME at least) under the Automatic Brightness toggle, but alas, I quickly had to turn it off.

Granularity

The main problem is that it is not changing smoothly. The backlight jumps from one brightness level to the next, around every ~0.5sec, on it's way to the new target brightness. These jumps are super obvious compared to the smooth fading that I'm used to on Android, for instance.

I'm hoping there's a way I can change that to, say, adjusting the brightness by 1% or less each time, every 0.1 seconds or so. The smaller I can make one of them, the less small the other needs to be. Either way, I am certain that my backlight is capable of less noticeable increments than this - because I can achieve them manually using the brightness slider.

Variability

The other problem is that it's doing this all the time. I suspect this may have to do with the fact that I'm on a tablet, which isn't always stationed on a desk like a laptop, but often held in my hand. Perhaps it makes sense not to expect the lighting to change much with stationary setups, but when held, the slightest tilt can make the ambient light sensor come to very different conclusions (perhaps the ceiling light comes into view, or my hand casts a shadow, etcetera).

If I could solve the above issue by getting really small and slow adjustments, it should render this problem unnoticeable. But an alternative would simply be to alter the polling rate of the sensor, or to delay/average the values, so that short bursts of light/dark are ignored. My ambient light sensor may simply be too directional to solve it any other way.

What I've tried

I have iio-sensor-proxy installed, and I've researched this question for quite a while now, but no one online seems to detail the mechanism of the new auto brightness feature. Various answers suggest simply keeping it off. Obviously this is no real solution.

I can use xbacklight --set to change my brightness via script, and I'm sure I can make my own brightness script that polls the sensor data. This still seems like a step backwards, and I'm always weary of adding more constantly-running scripts that may not be doing things very efficiently. That said, I'd be open to expert script suggestions.

There also seems to be a lot online about third-party programs for Ubuntu that accomplish this task, but using the webcam as a makeshift ambient light sensor rather than a real one. I have a real one, so I want to use it.

Verax
  • 91

2 Answers2

3

First get the source and build deps: (In "Software & Updates" make sure you have "Source Code" checked off.)

apt source gnome-settings-daemon
sudo apt build-dep gnome-settings-daemon

Then in plugins/power/gsd-power-manager.c, change the value of GSD_AMBIENT_SMOOTH to a lower value. I'm using 0.05f and it might be a bit too low.

Save changes:

cd gnome-settings-daemon-*
dpkg-source --commit

You will be asked to name the patch and write a summary file.

Then rebuild:

debuild

The "debuild" command may need to be installed via sudo apt install devscripts.

Then install:

sudo dpkg -i ../gnome-settings-daemon_*.deb
Verax
  • 91
kapouer
  • 46
  • 1
    Hello and welcome to AU. Could you summarize your answer here so it remains valid even if the link disappears? – Marc Vanhoomissen Apr 30 '19 at 11:43
  • 1
    oh wow, I never would have figured that out. Perhaps that should be a natively customizable value. Anyway, I'll give it a try. – Verax May 16 '19 at 19:14
  • Mine was actually already 0.3f, so I'll try 0.1f. I made an edit to correct some things and add missing steps.

    However, the debuild fails for me: debuild: fatal error at line 1182: dpkg-buildpackage -us -uc -ui failed

    Apparently 8 tests fail, due to ValueError: Namespace UMockdev not available.

    – Verax Jan 04 '20 at 00:44
1

To add to the previous answer https://askubuntu.com/a/1139372/1083623 and answer the question by Verax in it's comments:

Install umockdev and it's GObject Introspection package

sudo apt install gir1.2-umockdev-1.0

I also had to use flags to disable digital signing during build:

sudo debuild -uc -us
sherpa57g
  • 11
  • 1