You are not logged in.
Hello dear Archers,
I'm trying to enable my laptop backlight adjustments via ACPI and the dedicated Fn+F5, Fn+F6 keys. I know this is a complicated topic and questions pop up now and then, e.g. https://bbs.archlinux.org/viewtopic.php?id=152836, or https://bbs.archlinux.org/viewtopic.php?id=178014 which leads to this kernel bug report. However I'm still trying. Here are a few facts and things that I tried so far.
My laptop model is
[snake@arch ~]$ cat /sys/class/dmi/id/{sys_vendor,product_name}
ASUSTeK COMPUTER INC.
G750JH
I'm running Arch with lightdm for display manager and Cinnamon for desktop manager.
[snake@arch ~]$ uname -a
Linux arch 4.10.13-1-ARCH #1 SMP PREEMPT Thu Apr 27 12:15:09 CEST 2017 x86_64 GNU/Linux
My video card is
[snake@arch ~]$ lspci | grep -i vga
01:00.0 VGA compatible controller: NVIDIA Corporation GK104M [GeForce GTX 780M] (rev a1)
[snake@arch ~]$ lsmod | grep -i nvidia
nvidia_drm 49152 1
nvidia_modeset 794624 5 nvidia_drm
nvidia 12197888 82 nvidia_modeset
drm_kms_helper 126976 1 nvidia_drm
drm 303104 4 nvidia_drm,drm_kms_helper
My kernel 4.10.13 is rather new, in the sense that all the patches mentioned in that kernel bug report are already applied to it. I verified the sources.
xbacklight worked right away, and kept working in all kernel and module configurations I tried. So at least I'm not stuck with blinding brightness. My keyboard backlight also worked right away, including the Fn+F3 and Fn+F4 shortcuts, a slider in the Cinnamon power applet, and on-screen notifications.
I can make my Fn+F5 and Fn+F6 keys send their key codes to Linux by supplying the acpi_osi= kernel option.
When I start my kernel with the default command line I get two backlight devices but neither of them affects the screen brightness. The Cinnamon power applet displays a slider for screen brightness but that slider does nothing.
[snake@arch ~]$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux root=UUID=3966528f-3ecc-4db2-92aa-758074660fbd rw
[snake@arch ~]$ ls /sys/class/backlight/
acpi_video0 acpi_video1
[snake@arch ~]$ cat /sys/class/backlight/acpi_video0/{max,actual}_brightness
100
24
[snake@arch ~]$ echo 50 | sudo tee /sys/class/backlight/acpi_video0/brightness
50
[snake@arch ~]$ cat /sys/class/backlight/acpi_video1/{max,actual}_brightness
100
32
[snake@arch ~]$ echo 50 | sudo tee /sys/class/backlight/acpi_video1/brightness
50
When I start with the acpi_backlight=vendor option I get only one backlight device. Which does not work sadly. The brightness slider in Cinnamon is still present and still does nothing.
[snake@arch ~]$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux root=UUID=3966528f-3ecc-4db2-92aa-758074660fbd rw acpi_backlight=vendor
[snake@arch ~]$ ls /sys/class/backlight/
asus-nb-wmi
[snake@arch ~]$ cat /sys/class/backlight/asus-nb-wmi/{max,actual}_brightness
100
100
[snake@arch ~]$ echo 50 | sudo tee /sys/class/backlight/asus-nb-wmi/brightness
50
[snake@arch ~]$ cat /sys/class/backlight/asus-nb-wmi/actual_brightness
100
I had limited success with nvidiabl. I had to fix quite a few typos in PKGBUILD and I had to add my laptop model to nvidiabl-laptops.h:
NVIDIABL_DECLARE_LAPTOP_MODEL("ASUSTeK COMPUTER INC.", "G750", PCI_ANY_ID, NVIDIABL_SC_EPD, NVIDIABL_AUTO, NVIDIABL_AUTO, 125000),
Loading this module adds /sys/class/backlight/nvidia_backlight/ that actually works. If I load it manually after booting with acpi_backlight=vendor I can run rmmod asus-nb-wmi to remove the WMI entry. When I do that (load nvidiabl manually and nvidia_backlight is the only entry in /sys/class/backlight) even the Cinnamon brightness slider starts to work.
Unfortunately the system does not seem to recognize the nvidia_backlight as a backlight controller. When I start my kernel with no options systemd starts three systemd-backlight@.service instances and Cinnamon displays the screen brightness slider.
[snake@arch ~]$ systemctl --type=service | grep backlight
systemd-backlight@backlight:acpi_video0.service loaded active exited Load/Save Screen Backlight Brightness of backlight:acpi_video0
systemd-backlight@backlight:acpi_video1.service loaded active exited Load/Save Screen Backlight Brightness of backlight:acpi_video1
systemd-backlight@leds:asus::kbd_backlight.service loaded active exited Load/Save Screen Backlight Brightness of leds:asus::kbd_backlight
However when I start with acpi_backlight=none to suppress the non-working acpi_video* the service is not created for nvidia_backlight and there is no screen brightness slider in Cinnamon's power applet.
[snake@arch ~]$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux root=UUID=3966528f-3ecc-4db2-92aa-758074660fbd rw acpi_osi= acpi_backlight=none
[snake@arch ~]$ ls /sys/class/backlight/
nvidia_backlight
[snake@arch ~]$ systemctl --type=service | grep backlight
systemd-backlight@leds:asus::kbd_backlight.service loaded active exited Load/Save Screen Backlight Brightness of leds:asus::kbd_backlight
Interestingly the Fn+F5 and Fn+F6 do work in this configuration but without any onscreen display from Cinnamon. I suspect that X intercepts these key codes and calls xbacklight to handle them.
So it looks like I'm really close. All I need is to make the system recognize /sys/class/backlight/nvidia_backlight as a proper brightness driver. Is anybody familiar with how this detection works? I might be able to hack nvidiabl sources if it's something simple like providing additional metadata in some files inside the nvidia_backlight directory.
Last edited by snake.scaly (2017-05-10 06:31:07)
Offline
I was able to solve my problem by loading nVidia drivers at boot. The complication was that Grub somehow interfered with early driver loading. So it only started working correctly after I switched to systemd-boot. Here's my exact solution:
Switch to sydtemd-boot for loading your system.
Enable nVidia KMS during boot.
I kept the acpi_osi= kernel option to enable brightness keys on my keyboard but removed the acpi_backlight option. With this setup I still end up with two entries in /sys/class/backlight, the acpi_video0 and acpi_video1. However both are working now. That is, changing brightness in any of them changes brightness of my laptop screen. Services that restore brightness upon reboot also work correctly.
It also works with the kernel option acpi_backlight=vendor. In this case I only get one backlight class, asus-nb-wmi. However when I press the brightness keys the screen brightness changes but Cinnamon does not display the brightness on-screen notification. I guess the Asus backlight driver intercepts these keys and handles them internally so Cinnamon does not receive any keypresses.
Offline