Ubuntu – Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

backlightbrightnessnvidiaxfce

I have an old laptop, oldtimer linux fellow, and updated it to xubuntu 18.04.

After some sleep/resume problems with the proprietary nvidia-340 driver, I decided to try the nouveau. Sleep/resume ok. But there is a new problem: the brightness.

Using the proprietary driver, with Option "RegistryDwords" "EnableBrightnessControl=1" in the xorg.conf, the Fn-bright-up and Fn-bright-down keys work out of the box.

With the nouveau driver they don't.

$ ls /sys/class/backlight/

returns acpi_video0 and nv_backlight.

As expected nothing can be done using acpi_video0.

But, surprise! The nv_backlight is working:

$ echo 20 | sudo tee /sys/class/backlight/nv_backlight/brightness

works!

But I don't know how to make my friend xfce knows that the Fn-bright-up and Fn-bright-down should talk with /sys/class/backlight/nv_backlight/brightness instead of /sys/class/backlight/acpi_video0/brightness.

Thank you.

Best Answer

  • The nouveau driver now (some time ago it didn't) creates the /sys/class/backlight/nv_backlight and it works. So passing acpi_backlight=vendor to the kernel disables the /sys/class/backlight/acpi_video0. Without acpi_video0, the backlight_helper_get_best_backlight() will return the nv_backlight out of the box.

    So, open /etc/default/grub, edit:

    GRUB_CMDLINE_LINUX_DEFAULT="[...] acpi_backlight=vendor"
    

    Save and sudo update-grub.