libretro / Lakka-LibreELEC

Lakka is a lightweight Linux distribution that transforms a small computer into a full blown game console.
https://www.lakka.tv
1.75k stars 289 forks source link

Hotkey to control screen brightness not working - Lenovo Thinkpad w520 #141

Closed CarlUpright closed 7 years ago

CarlUpright commented 7 years ago

I'm using Build Apr 24 2017 on Linux (Lakka live usb) on a Lenovo Thinkpad w520. When i press volume - and + , or when i press Fn + Home or Fn + End (supposed to be the brightness control hotkeys), nothing happen.

I made a hotkey for the volume control, so that's no big deal, but my screen is dimmed to the minimum.

Is there a little script i could use to create a hotkey to control the screen brightness? or maybe i need to use a different display driver ?

kivutar commented 7 years ago

It's certainly the kind of screen where a systemd unit is setting the brightness during the boot.

https://www.google.fr/search?q=Lenovo+Thinkpad+w520+linux+screen+brightness&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&ei=l5o_WZOgLKLVXr6igfAP

You can try to add acpi_osi="!Windows 2012" thinkpad-acpi.brightness_enable=1 in the syslinux configuration files on the first partiton of the USB.

If it's not enough, try this command in the CLI, maybe using SSH from another PC:

echo 100 > /proc/acpi/video/VID1/LCD0/brightness
CarlUpright commented 7 years ago

Solution 1 didn't work. Here https://mzanfardino.wordpress.com/2015/02/10/linux-enabling-brightness-control-for-thinkpad-w520/ the user say he also added

BoardName "Quadro 1000M"
Option "RegistryDwords" "EnableBrightnessControl=1"

to the file /etc/X11/xorg.conf . I don't see that file in Lakka.


Solution 2 also didn't work. here's what's written :

Lakka (community) Version: 2.0
Lakka:~ # echo 100 > /proc/acpi/video/VID1/LCD0/brightness
**-sh: can't create /proc/acpi/video/VID1/LCD0/brightness: nonexistent directory**
Lakka:~ # 
CarlUpright commented 7 years ago

i found out that this command works in the CLI using SSH : echo XXX > /sys/class/backlight/intel_backlight/brightness

Where XXX is a value between 0 (backlight off) and max_brightness (4437 for this particular model).

So it seams like it is really the Fn hotkey that isn't working with Lakka (no problem in win 7, or Ubuntu). Is there a way to create a hotkey in Lakka to send the command to max out the display ? or to create a new value in the menu ?

kivutar commented 7 years ago

For now let try the autostart service to automatically set the brightness on boot.

CarlUpright commented 7 years ago

i don't know how to do that, can you assist me ?

kivutar commented 7 years ago

Yes, first read this http://www.lakka.tv/doc/Accessing-Lakka-command-line-interface/

CarlUpright commented 7 years ago

that's already done and i'm there :)

kivutar commented 7 years ago

OK, use nano to create the autostart.sh

nano .config/autostart.sh

Paste the content:

echo 4437 > /sys/class/backlight/intel_backlight/brightness

And save with CTRL+X

Then enable the service:

systemctl enable autostart

And reboot to check if it worked

CarlUpright commented 7 years ago

Done. It is now booting at maximum brightness. That's good enough for me on that laptop, I'll try to boot it on different PC to see if that still works.

On the side, i think i need to compile the ThinkPad ACPI Extras Driver to activate all my Fn keys. I never compiled anything.

Thank you !

kivutar commented 7 years ago

Yeah forget it, in Lakka compiling doesn't work exactly like on the other linux distributions. If this workaround works for you, it's already lucky :)

ricsif commented 3 years ago

@kivutar @CarlUpright Thanks for the steps, it solved similar brightness problem on Lenovo T430 (I have two, faced the issue only on one of them). Despite the following error, after reboot .config/autostart.sh was executed.

Lakka:~ # systemctl enable autostart
Failed to enable unit: File autostart.service: No such file or directory