Created attachment 303667 [details] Fix IRQ issues on keyboard for LG UltraPC 17U70P laptop for kernel 6.1.8 Hi, just the same as is currently happening with other laptops, the keyboard in this laptop is not detected under any currently available version of Linux. Following the instructions by Tamim Khan in bug 216158, comment 5 (https://bugzilla.kernel.org/show_bug.cgi?id=216158#c5) I executed the following commands using an external USB keyboard: cat /sys/firmware/acpi/tables/DSDT > dsdt.dat iasl -d dsdt.dat grep -A 40 PS2K dsdt.dsl | grep IRQ -A 1 Output: IRQ (Level, ActiveLow, Exclusive, ) {1} So as other people did, I followed the ideas behind the patches already available in that thread and created a patch for my laptop that fixed this issue for kernel 6.1.8, I'm attaching the patch to this bug report. A second issue I discovered after applying the patch is the backlit function, the available FN+F8 key combination is not working besides FN keys are already working for screen brightness and touchpad control, ie. Inside the /sys directory there are already a set of entries available (in theory) for keyboard backlit control: # ls -l /sys/class/leds/kbd_backlight/ -rw-r--r-- 1 root root 4096 ene 31 18:36 brightness -r--r--r-- 1 root root 4096 ene 31 18:36 brightness_hw_changed lrwxrwxrwx 1 root root 0 ene 31 18:52 device -> ../../../lg-laptop -r--r--r-- 1 root root 4096 ene 31 18:36 max_brightness drwxr-xr-x 2 root root 0 ene 31 18:52 power lrwxrwxrwx 1 root root 0 ene 31 18:52 subsystem -> ../../../../../class/leds -rw-r--r-- 1 root root 0 ene 31 18:52 trigger -rw-r--r-- 1 root root 4096 ene 31 18:36 uevent But until now I failed to turn on the backlit, using the FN key, using third party tools, or trying to write directly to those registers, ie: # echo 255 > /sys/class/leds/kbd_backlight/brightness (Being 255 the value of /sys/class/leds/kbd_backlight/max_brightness).
@Rubén Gómez: Just to make sure there is no miscommunication in the other bug ticket. Did you want me to send this patch into the kernel mailing list on your behalf or were you going to do this yourself? Tamim
(In reply to Tamim Khan from comment #1) > @Rubén Gómez: Just to make sure there is no miscommunication in the other > bug ticket. Did you want me to send this patch into the kernel mailing list > on your behalf or were you going to do this yourself? @Tamim Khan: Hi I was just waiting a little bit in case I could fix the backlit issue and submit a patch for both things at the same time. Do you think it should be better to go ahead and submit this patch now? If that's the case I'd very thankful if you could do that for me this time I'm a bit snowed under these days.
@Rubén Gómez: Nope, I don’t think there is any rush. I was just making sure you were not waiting on me to submit it. Let me know if you have any questions and I will try my best to answer. Thanks, Tamim
(In reply to Tamim Khan from comment #3) > Nope, I don’t think there is any rush. I was just making sure > you were not waiting on me to submit it. > Let me know if you have any questions and I will try my best to answer. @Thamim Khan: I've been working in the keyboard backlit issue, I tried to pull all the tricks available in my hat (read every available doc, using Linux detection tools, tracing events in Windows, even reverse engineering) but I failed in a very frustrating way. Who'd image that nowadays turning on a led would be so freaking hard. There's a compatibility driver already in the kernel named lg-laptop.c but unfortunately is only designed for the LG Gram series and at first I thought it was partially working in my laptop, now I realized that is not working at all and the FN are being handled from elsewhere. ("modprobe -r lg-laptop" doesn't affect the available FN keys). I'm stuck with this. :-\
(In reply to Tamim Khan from comment #3) > Let me know if you have any questions and I will try my best to answer. Finally I found the freaking keyboard codes! 0x80, 0xa4 and 0xa2 and it actually works!. I need to properly implement this in the current driver but feels awesome.
I created for myself this patch to force the keyboard backlit to turn on, in every boot. Guess is not enough to send it as a patch for the current LG Gram wmi module. The issue I'm facing is, LG Gram and LG UltraPC are sharing some GUIDs so I can't develop an indepenent module for this laptop, and right now I have little info about the WMI specifications, just manager to get the keyboard scancodes trought DotPeek last weekend. I'd appreciate some ideas about how to keep going on. Keyboard backlit patch: ``` diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c index 332868b140ed..6c80737d824b 100644 --- a/drivers/platform/x86/lg-laptop.c +++ b/drivers/platform/x86/lg-laptop.c @@ -241,6 +241,8 @@ static void wmi_notify(u32 value, void *context) static void wmi_input_setup(void) { acpi_status status; + const char *product; + union acpi_object *r; wmi_input_dev = input_allocate_device(); if (wmi_input_dev) { @@ -265,6 +267,13 @@ static void wmi_input_setup(void) (void *)2); if (ACPI_SUCCESS(status)) inited |= INIT_INPUT_WMI_2; + + product = dmi_get_system_info(DMI_PRODUCT_NAME); + if (product && strlen(product) >= 6 && strncmp(product, "17U70P", 6) == 0) { + r = lg_wmab(WM_KEY_LIGHT, WM_SET, 0xA2); + kfree(r); + pr_info("Enabled keyboard backlight (level low) for LG UltraPC 17U70P"); + } } else { pr_info("Cannot allocate input device"); } ```
@Rubén Gómez: If you share GUIDs your best option might be to just adapt this module to work for your laptop rather than writing a new one. I did notice a bunch of code in the LG Gram module related to changing and setting the brightness of the keyboard: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n631. Is it that your specific key codes are missing from the if/case statement or are you not even getting to this part due to the eventcode being completely different: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n224? I think at this point it might also be worthwhile to reach out to the author LG Gram module(Matan Ziv-Av <matan@svgalib.org>) and see his thoughts on your issues are. He will probably have better ideas then myself in regards to getting a more complete WMI specification for your laptop and if it makes more sense to make this into a new module or not. Tamim
(In reply to Tamim Khan from comment #7) @Tamim Khan: Many thanks for your answer and suggestions! I already tried to contact Matan on Feb 1st but with no luck, I already have the codes for sending the event to turn on the keyboard backlit (that's roughly implemented in the patch I dropped in this thread on Comment 6), what I'm missing now is the codes to catch the FN+F[x] key events (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n80) that seem different in my laptop as happens with the other codes (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n606). Anyway with a bit more time I think I can reverse engineer the Windows drive and get all the information I need (I even tried to contact LG but radio silence). But until then I'm thinking about sending the patch I already have to unlock the keyboard and have that upstream as soon as possible. I'm already in the linux-acpi mail list. Would that be the proper place to send it?
@Rubén Gómez: Yup, linux-acpi would be the right place to send the keyboard not working patch. Another question about your keyboard backlight problem. Are you not getting any output at all on this debug line: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n236? It _seems_ like as long as the GUIDs for your device match the LG Gram the `wmi_notify` function should be called and that log outputted. You wont get the right event being emitted due to a lack of entry here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/platform/x86/lg-laptop.c?h=v6.2.2#n79 but you should be able to get the eventcode from that output. Tamim
@Tamim Khan: Hi thanks for the confirmation about the mail list, I'll try to send it this weekend. About the WMI events no I don't get any input (no wmi_notify calls at all), I already tried using a log in the first line of the function, I think that's related with the scan codes issue (GUIDs match, but FN+Fx scan codes don't).
@Tamim Khan: Hi Tamim I should have accepted your help to send the basic keyboard patch back in January, weeks have passed and never found the time to do this... I'm looking into it now, would be enough to send it against the current mainline kernel? (6.3) is a small change, any idea I should take into account? Thank you!
@Rubén Gómez: I think the linux-acpi kernel mailing list generally wants patches that are against the linux-pm branch (https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/). That usually contains a pre-release RC kernel for the next kernel version (it looks to be 6.4-rc1 right now). As long as your patch can be applied to that and you follow the conventions for kernel commit messages (steps 2 onward on https://www.kernel.org/doc/html/v4.10/process/submitting-patches.html or using message format for the other keyboard patches), I think your patch should be good. Tamim
Keyboard patch found it's way to the kernel v 6.4-rc! :-) Still pending proper WMI support tho. At least we now have codes to force the keyboard backlit to turn on. (See above).