tomsom / yoga-linux

Run Linux on the Lenovo Yoga 7 14 (14ARB7) with AMD Ryzen 6800U (Rembrand).
https://github.com/tomsom/yoga-linux/wiki
58 stars 1 forks source link

Keyboard backlight change UI #39

Closed sidevesh closed 1 year ago

sidevesh commented 1 year ago

I have an AMD 5800O Yoga 7 14ACN6, which is similar to this. One minor issue in interest of listing everything is that while the keyboard backlight changing works via the Fn+Space shortcut, it does not reflect in UI and no pop up / osd is shown in gnome. In my older laptops the keyboard backlight changes would show an osd, This is something listed in the last point at https://github.com/PJungkamp/yoga9-linux#extra-features:

The ACPI can also control the keyboard backlight setting (Off/Low/High/Auto) but I have not written a patch for that yet.

DOes this work normally in 14ARB7 for y'all ?

stuarthayhurst commented 1 year ago

Do you have anything in /sys/class/leds/platform::kbd_backlight/? If you do, what's the value of /sys/class/leds/platform::kbd_backlight/max_brightness?

sidevesh commented 1 year ago

/sys/class/leds/platform::kbd_backlight does not exist on my system

stuarthayhurst commented 1 year ago

Do you have any messages about Unknown keyboard type in dmesg?

EDIT: Unknown keyboard might also be useful too

sidevesh commented 1 year ago
[sidevesh@Lenovo-Yoga-7 ~]$ sudo dmesg | grep 'Unknown'
[    5.601817] lenovo-ymc 06129D99-6083-4164-81AD-F092F9D773A6: Unknown key 0 pressed
[    5.605022] ideapad_acpi VPC2004:00: Unknown keyboard backlight value: 3
stuarthayhurst commented 1 year ago

Ah, I think you had it in auto mode when the device started, causing the get function to fail, so the initial value was an error, so the init failed and the keyboard wasn't registered.

I guess my code to handle AUTO is broken :/ I'll try patch this and send you something for testing, thanks for catching this

EDIT: Never mind, it seems we use max_brightness before it gets set. No idea how this works on my system...

stuarthayhurst commented 1 year ago

Here's a ~completely untested~ patch written for 6.6: 0001-platform-x86-ideapad-laptop-Set-max_brightness-befor.patch.txt

@sidevesh Can you give that a test please? If it doesn't work for you I'll write another :)

EDIT: Tested on my system, no regressions. Sent upstream anyway, as it needed to be fixed, whether or not it actually caused your issue. As I mentioned earlier, if it doesn't work for you I'll keep troubleshooting :) https://lore.kernel.org/platform-driver-x86/20231112152851.17687-2-stuart.a.hayhurst@gmail.com/T/#u

EDIT 2: Accepted into platform-drivers-x86

sidevesh commented 1 year ago

@stuarthayhurst sorry for the delay, I will test out the patch this weekend and let you know if the issue gets fixed or if I encounter any issues, thanks for resolving this so quickly!

PJungkamp commented 1 year ago
[sidevesh@Lenovo-Yoga-7 ~]$ sudo dmesg | grep 'Unknown'
[    5.601817] lenovo-ymc 06129D99-6083-4164-81AD-F092F9D773A6: Unknown key 0 pressed
[    5.605022] ideapad_acpi VPC2004:00: Unknown keyboard backlight value: 3

Same problem here. I totally forgot about this thread as I'm kind of busy recently. I'll try your patch right away and report back.

PJungkamp commented 1 year ago

It's working beautifully! GNOME 45 just hit nixpkgs-unstable and upon reading the release notes I remembered this issue. Thank you very much for your work on this.

The ACPI does not seem to provide an event when the keyboard backlight is changed using the keyboard shortcut (fn+space). I have seen that there's another "custom" HID device on the Intel ISH that's able to report these changes. (The Lenovo tools in Windows show updates of the backlight)

Maybe I'll give this another go myself if I've got some time (this and some sensible reporting of an auto mode).