5

I have a new Lenovo Ideapad 500S with a fresh Ubuntu 16.04.1 running on it. Unfortunately, the brightness up/down keys don't work. (They work fine in Windows.)

Running acpi_listen shows me generated events for volume up/down keys, but not for brightness up/down. Running xev also did not give me any output for the brightness up/down keys.

After editing the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub several times with options like acpi_backlight=vendor,video.use_native_backlight=1, acpi_osi=Linux and acpi_osi=, I can confirm that this changes the soft links in /sys/class/backlight/ and I currently only have intel_backlight there.

Running echo <NUM> | sudo tee /sys/class/backlight/intel_backlight/brightness works fine and changes the brightness, and so does changing it from Settings > Brightness and Lock.

Nothing inside Ubuntu seems to be able to detect these keys, so I'm not sure making any changes in the grub config will matter at all.

Please let me know if someone knows how to fix this and also if any additional information will be useful in debugging this issue.

Update:

Adding acpi_osi=Linux acpi_backlight=intel_backlight to the line in grub seems to make the brightness down key generate something in xev (though nothing in acpi_listen yet). The output is:

KeyPress event, serial 37, synthetic NO, window 0x3c00001,
    root 0xd3, subw 0x0, time 391361, (728,884), root:(793,936),
    state 0x0, keycode 120 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x3c00001,
    root 0xd3, subw 0x0, time 391368, (728,884), root:(793,936),
    state 0x0, keycode 120 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Additional outputs:

$ lspci -nnk | grep -iA2 vga
00:02.0 VGA compatible controller [0300]: Intel Corporation Sky Lake Integrated Graphics [8086:1916] (rev 07)
    Subsystem: Lenovo Skylake Integrated Graphics [17aa:3828]
    Kernel driver in use: i915_bpo
Vivek Ghaisas
  • 256
  • 1
  • 3
  • 12

2 Answers2

1

I finally solved this using a couple of workarounds.

The first step was making the keys detectable. I had a laptop of a similar model (Lenovo Z400) and I looked at what keycodes were generated for it. Based on that, I put this in my /etc/rc.local/:

setkeycodes e054 225 # Brightness up -> brightness up
setkeycodes e04c 224 # Brightness down -> brightness down

The second step was making the keys change the brightness. I first noticed that running xdotool key 232 and xdotool key 233 increased and decreased the brightness perfectly (including the change notification in Unity). Then I tried two things to get the brightness to work.

First, I noticed that xev now showed me the events XF86MonBrightnessUp and XF86MonBrightnessDown for the two keys, which means everything was working fine at the X level. So I simply used Ubuntu's shortcut manager and registered the two keys (which were read as their XF86 equivalents) to the xdotool commands. This worked great!

However, some weeks later, due to some packages/drivers I changed, xev stopped reporting the XF86 events and so the above method did not work. However, acpi_listen showed that video/brightnessdown and video/brightnessup events were being generated, so then, after some googling, I put the following in a new file, /etc/acpi/events/ideapad-monitor-brightness-up:

# same event as reported by acpi_listen
event=video/brightnessup BRTUP 00000086 00000000 K
action=su vivek -c "export DISPLAY=:0.0; xdotool getactivewindow && xdotool key 233 2>&1 > /tmp/log"
# The redirection into /tmp/log probably doesn't make any difference

and also an equivalent ideapad-monitor-brightness-down file with xdotool key 232 and that solved the problem. Haven't had any problems since. :)

Vivek Ghaisas
  • 256
  • 1
  • 3
  • 12
0

I haven't had problems with brightness keys since 2012 with my older laptop (Toshiba Satellite Core 2 Duo) under Ubuntu 14.04 but it appears many users have. The most popular solution is to create the file by typing:

sudo touch /usr/share/X11/xorg.conf.d/20-intel.conf

then edit the file using:

gksu gedit /usr/share/X11/xorg.conf.d/20-intel.conf

then populate the file with:

Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"
EndSection

Save and reboot.

Note the BusID should match the output of:

lspci -nnk | grep -iA2 vga

Also replace intel_backlight above with what appears in lspci command if different.

Another option to try is change grub command line with acpi_backlight=vendor.

Update

I just stumbled across this Ubuntu webpage on brightness keys: https://wiki.ubuntu.com/Kernel/Debugging/Backlight

When I upgrade to Ubuntu 16.04 it brought with it Kernel 16.04 and I had all types of problems with suspend/resume, thin fonts, black screens instead of wallpaper, higher than normal CPU usage and hotter than normal temperatures. I wrote up many of the steps I took in this answer: Ubuntu 15.10: Various "types" of freezes and now unexpected shutdown which solved most my problems on an Intel Ivy Bridge platform and it may very well help your Sky Lake platform.

WinEunuuchs2Unix
  • 99,709
  • 34
  • 237
  • 401
  • I had tried both of these earlier, but I tried them again. Didn't notice any change in the behaviour. Brightness still doesn't change, `acpi_listen` still doesn't notice anything and `xev` gives me the same output as in the question update. :/ – Vivek Ghaisas Sep 28 '16 at 23:47
  • Try using the grub kernel parameter `acpi_osi= ` (blank) and remove `acpi_backlight=vendor` if it's still there. – WinEunuuchs2Unix Sep 28 '16 at 23:56
  • Tried this once before and again now. Didn't fix the issue. – Vivek Ghaisas Sep 29 '16 at 00:13
  • The only other option I can think of is grub kernel parameter `intel_idle.max_cstate=1`. It will make your laptop run a little hotter and battery will drain faster so if it doesn't work remove it. I did find one user who claims this works `quite splash acpi_osi=Linux acpi_osi=’!Windows 2012′ acpi=force acpi_enforce_resources=lax drm.vblankoffdelay=1 acpi_backlight=vendor video.use_native_backlight=1` – WinEunuuchs2Unix Sep 29 '16 at 00:32
  • @VivekGhaisas I updated the answer with all I can think of tonight. Sorry you didn't have success to date :( – WinEunuuchs2Unix Sep 29 '16 at 01:36
  • I've posted a follow-up as an answer for how I finally solved the problem. Thanks a lot for your help! – Vivek Ghaisas Dec 10 '16 at 16:06