platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James John <me@donjajo.com>
To: "Hans de Goede" <hdegoede@redhat.com>,
	"Corentin Chary" <corentin.chary@gmail.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>
Cc: platform-driver-x86@vger.kernel.org,
	acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: asus_nb_wmi sends KEY_BRIGHTNESSDOWN on pressing CAPS Lock and PrntScrn on Zenbook S 13 UX5304VA
Date: Sun, 1 Oct 2023 14:16:03 +0000	[thread overview]
Message-ID: <90a7309e-4a76-4dff-8259-9975dd3ed8b1@donjajo.com> (raw)
In-Reply-To: <d70f7d35-6458-437d-f68f-47291ce74a1e@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 6186 bytes --]

Hello Han,

Thank you. I applied the patch and I have the inputs attached here.

After setting the hwdb filter, all the hot keys are still working except 
that the LED notification light on Mute Hotkey (F9) is no longer turning 
up on mute.

The Screen Capture, Disable Camera, and MyASUS buttons are not mapped 
yet. I believe the Screen Capture button should map to PrntScrn button, 
and MyASUS with Disable Camera unmapped, obviously. I also have the 
codes in the attached log.

Screen Capture button is KEY_UNKNOWN to evtest.

Don't hesitate to let me know if you need anything else.


Thank you!

James


On 01/10/2023 13:45, Hans de Goede wrote:
> Hi James,
>
> On 10/1/23 10:46, James John wrote:
>> Hello Han,
>>
>> Thank you very much for this detailed steps. I was able to reproduce this with "evtest" and everything went okay.
>>
>> After editing /lib/udev/hwdb.d/60-keyboarrd.hwdb as you specified, the problem has been fixed, which I believe should revert on reboot?
> No this will fix it until /lib/udev/hwdb.d/60-keyboarrd.hwdb gets overwritten by your
> package-manager the next time the systemd packages get updated.
>
>> This is the content of /sys/class/dmi/id/modalias
>>
>> dmi:bvnAmericanMegatrendsInternational,LLC.:bvrUX5304VA.304:bd05/16/2023:br5.27:svnASUSTeKCOMPUTERINC.:pnZenbookS13UX5304VA_UX5304VA:pvr1.0:rvnASUSTeKCOMPUTERINC.:rnUX5304VA:rvr1.0:cvnASUSTeKCOMPUTERINC.:ct10:cvr1.0:sku:
> Thanks.
>
> Looking at:
> https://bbs.archlinux.org/viewtopic.php?pid=2123716
>
> I see that at least one other model Asus laptop is affected too. So rather then
> adding a more specific hwdb rule for your model I would like to try and find
> the root cause of these 0x20 event code events when pressing capslock
> on your laptop.
>
>> Yes, I built my kernel. I wish I could parse this and write a proper quirk.
> Good, I've written a small kernel patch to get to the bottom of this (attached)
> can you please build a kernel with this. Then boot into this kernel and
> then run dmesg -w
>
> When you now press capslock you should see log lines show up which contain
> "raw event code 0x..."
>
> Please let me know what these lines show when pressing capslock.
>
> Please also let me know what these lines show when pressing other
> hotkeys which are handled by asus-nb-wmi (you can re-run "sudo evtest"
> to check which keys that are).
>
> I think the issue might be that the asus-wmi code is filtering out
> the higher bits of the value, which causes some new events to
> get mapped as just 0x20 instead of some-higher-bits + 0x20.
>
> Also I'm wondering if everything else works as it should,
> e.g. does changing the brightness with the brightness hotkeys
> still work after setting up the hwdb filtering ?
>
> And does the lid-switch (suspend the machine when the lid is closed)
> work ?
>
>
>> Also, I don't know if this is related; the hotkeys should be enabled by default. Fn key should be for Function keys. But in the current state, it is reversed.
> This is laptop models specific and not really controlled by Linux,
> sometimes you can change the default in the BIOS. Or sometimes you
> can change the default by pressing Fn + Esc.
>
> Regards,
>
> Hans
>
>
>
>
>> On 01/10/2023 09:28, Hans de Goede wrote:
>>> Hi James,
>>>
>>> On 10/1/23 10:11, James John wrote:
>>>> Hello,
>>>>
>>>> First of all, thank you very much for the work you do with maintaining these drivers and supporting systems. It is not an easy one.
>>>>
>>>> I have debugged this bug down to the asus_nb_wmi module. When I disable this module, the problem goes away, but then other hotkeys are not recognized. Attached is a debug event from libinput, where I pressed the capslock twice
>>>>
>>>> I have tried to dabble around with asus-nb-wmi.c codes to see if I could fix it by luck, by adding UX5304VA to `static const struct dmi_system_id asus_quirks[]` but to no avail. And I have a very little knowledge of what "quirks" are.
>>>>
>>>> I have attached some information regarding my hardware and kernel. I will be available to provide any more information that might be needed to resolve this.
>>>>
>>>> A related open thread: https://bbs.archlinux.org/viewtopic.php?pid=2123716
>>> First of all lets confirm that the KEY_BRIGHTNESSDOWN events are really coming from asus_nb_wmi.
>>>
>>> Please install evtest and then run "sudo evtest" and then select the "Asus WMI hotkeys" device
>>> by typing its number followed by enter.
>>>
>>> After this reproduce the bug and see if the log shows KEY_BRIGHTNESSDOWN.
>>>
>>> Since you said you tried playing around with the quirks, I assume you can build
>>> your own kernel, please let me know if that is wrong.
>>>
>>> If this confirms the KEY_BRIGHTNESSDOWN events are coming from the "Asus WMI hotkeys" device,
>>> then please edit /lib/udev/hwdb.d/60-keyboard.hwdb
>>>
>>> And search for "Asus WMI hotkeys", this should find this section:
>>>
>>> evdev:name:Asus WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>> evdev:name:Eee PC WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>> evdev:name:Asus Laptop extra buttons:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>>    KEYBOARD_KEY_6b=f21                                    # Touchpad Toggle
>>>    KEYBOARD_KEY_7c=f20                                    # Remap micmute to f20
>>>
>>> Change this to:
>>>
>>> evdev:name:Asus WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>> evdev:name:Eee PC WMI hotkeys:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>> evdev:name:Asus Laptop extra buttons:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
>>>    KEYBOARD_KEY_6b=f21                                    # Touchpad Toggle
>>>    KEYBOARD_KEY_7c=f20                                    # Remap micmute to f20
>>>    KEYBOARD_KEY_20=unknown
>>>
>>> And then run "sudo udevadm hwdb --update" followed by "sudo udevadm trigger",
>>> that should filter out the spurious keypresses.
>>>
>>> If that helps, please run:
>>>
>>> cat /sys/class/dmi/id/modalias
>>>
>>> So that a proper DMI based quirk to only to the filtering on your model
>>> can be written.
>>>
>>> Regards,
>>>
>>> Hans
>>>

[-- Attachment #2: inputs.log --]
[-- Type: text/x-log, Size: 1879 bytes --]

CAPSLOCK BUTTON
[17163.666633] asus_wmi: raw event code 0x2c
[17163.666686] asus_wmi: raw event code 0xffffffffffffffff
[17171.479573] asus_wmi: raw event code 0x2c
[17171.479612] asus_wmi: raw event code 0xffffffffffffffff

PRNTSCRN BUTTON
[17515.104897] asus_wmi: raw event code 0x2b
[17515.104949] asus_wmi: raw event code 0xffffffffffffffff
[17520.733299] asus_wmi: raw event code 0x2b
[17520.733331] asus_wmi: raw event code 0xffffffffffffffff

BACKLIGHT BUTTON
[17299.166313] asus_wmi: raw event code 0x2e
[17299.166370] asus_wmi: raw event code 0xffffffffffffffff
[17302.386607] asus_wmi: raw event code 0x2e
[17302.386663] asus_wmi: raw event code 0xffffffffffffffff

BACKLIGHT UP BUTTON
[17332.080632] asus_wmi: raw event code 0x2f
[17332.080727] asus_wmi: raw event code 0xffffffffffffffff
[17332.497118] asus_wmi: raw event code 0x2f
[17332.497192] asus_wmi: raw event code 0xffffffffffffffff

SCREEN CAPTURE BUTTON
^X@ss[20299.678524] asus_wmi: raw event code 0x2a
[20299.678547] asus_wmi: raw event code 0xffffffffffffffff
^X@ss[20304.275840] asus_wmi: raw event code 0x2a
[20304.275913] asus_wmi: raw event code 0xffffffffffffffff

MyASUS BUTTON
[20362.322778] asus_wmi: raw event code 0xffffffffffffffff
[20362.622624] asus_wmi: raw event code 0x86
[20362.622728] asus_wmi: raw event code 0xffffffffffffffff
[20363.249205] asus_wmi: raw event code 0x86
[20363.249283] asus_wmi: raw event code 0xffffffffffffffff

MUTE BUTTON
[20942.489134] asus_wmi: raw event code 0x7c
[20942.489239] asus_wmi: raw event code 0xffffffffffffffff
[20943.222495] asus_wmi: raw event code 0x7c
[20943.222592] asus_wmi: raw event code 0xffffffffffffffff

DISABLE CAMERA BUTTON
[21002.582379] asus_wmi: raw event code 0x85
[21002.582475] asus_wmi: raw event code 0xffffffffffffffff
[21003.045881] asus_wmi: raw event code 0x85
[21003.046008] asus_wmi: raw event code 0xffffffffffffffff

  reply	other threads:[~2023-10-01 15:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01  8:11 PROBLEM: asus_nb_wmi sends KEY_BRIGHTNESSDOWN on pressing CAPS Lock and PrntScrn on Zenbook S 13 UX5304VA James John
2023-10-01  9:28 ` Hans de Goede
2023-10-01  8:46   ` James John
2023-10-01 13:45     ` Hans de Goede
2023-10-01 14:16       ` James John [this message]
2023-10-01 14:18         ` James John
2023-10-01 15:09           ` James John
2023-10-11 10:44         ` Hans de Goede
2023-10-11 15:43           ` Hans de Goede
2023-11-24 15:54             ` Juri Vitali
2023-11-25 14:25               ` Hans de Goede
2023-12-03 15:44                 ` Hans de Goede
2023-12-04  0:32                 ` juri
2023-12-04  0:32                 ` juri
2023-12-04 13:06                   ` juri
2023-12-04 13:54                     ` Hans de Goede
2023-12-04 15:52                       ` juri
2023-10-17  8:50         ` Hans de Goede
2023-10-18  0:17           ` me
2023-10-18 19:35             ` Hans de Goede
2023-10-19 23:22               ` James John
2023-10-21  9:46                 ` Hans de Goede
2023-10-21  9:53                   ` James John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90a7309e-4a76-4dff-8259-9975dd3ed8b1@donjajo.com \
    --to=me@donjajo.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).