Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp869367rdb; Sun, 1 Oct 2023 08:51:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPdQZ6pYSsSZulUwWM8BFZtpPWn7VM7epuwqB4+3oU33YhmPJdgjTMxuGEW7HwFUc6IlmO X-Received: by 2002:a17:903:1ca:b0:1c5:9d00:be84 with SMTP id e10-20020a17090301ca00b001c59d00be84mr16286390plh.33.1696175491483; Sun, 01 Oct 2023 08:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696175491; cv=none; d=google.com; s=arc-20160816; b=0YZKgQznPVrJV0w5SNzNKZMieZUa1g8X/RppysvhEr4eIIGMwUb6ipukPCh193Vf7d vKHn8edoDQqskZT1tfm8soO5BXItJGWNnYIX4mwc5y7zqJ0qmO0eZpT2SUeAKkADzqFn +8J40r+jkSjVdRwG5hNqW7jDNjEYpwxnySkI5TlYQ8Qda/sH47g8zTzl0UqYQFw+7cKo nvJ8HC6Obfl1N/G6TchGPNECSlAoYoqwmipwa3c+GPbTO+Fw8yJ98T4iHvjYIL/O93mS frcPxT2CFVJxL3ShNwGaIa72G5HdhJZhDh2KX2yolnpEhKbgM2DsvfOI9yQdzSOJO1Ay Hm9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=+Pe7//1mtQSa51WaPPJHVuxvv1rCN+4di+Pko3njm1A=; fh=/CshAcDKNRvSecKMxGmyrGkhYZNgwoMo1A6a7Rl0KlQ=; b=EvLRWtTytcdF1gDGFv607FHixsoXAhcf8VGxnq7XJyXTBS6+jC45k42+upzkludvdF JIriFPMo0TMlTDOzdd5BeekuLgblyAOhr2MpnPmrcfPOtysjMyRMCMA3uv2assA1tyjh dtmCt2+6ijuwMeNKY8lwV4Yyl5O4C2doHoDATRpeLfcGGI0xa3//Pk5aTIu5/QFjuuR0 ekzlbfuzmlxrmnTpfjBgNNr/dMwrVkGExARbcsv0sqRB0GS9gNeqFfaCN/HAcT43EJxV HxsE6iU/ZBB8Dyz66zcujPKo1IPH2IQlG1Tb2ZvDzV0ZIFIDhgMY1vyDm0DDULZ87CEW BRXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P24jJdPo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id p5-20020a170902e74500b001c74d83470bsi4953775plf.206.2023.10.01.08.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 08:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P24jJdPo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 294C18135D59; Sun, 1 Oct 2023 06:46:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235026AbjJANq3 (ORCPT + 99 others); Sun, 1 Oct 2023 09:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235005AbjJANq1 (ORCPT ); Sun, 1 Oct 2023 09:46:27 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267B91A7 for ; Sun, 1 Oct 2023 06:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696167931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+Pe7//1mtQSa51WaPPJHVuxvv1rCN+4di+Pko3njm1A=; b=P24jJdPoEyiNSL9bG1Gd2EmhPq9xx2+ndF+GPOKG+I5bDL0/E7f1nGDococaVosdULxRoi AjFs8JwOBbVxEEa+AmAH4i/5V5B4QJSUUTM0wXqAE+20yY8Gx/LHuOZIXGO0GprpkJMOse IvTnp33mwolxldgoPA39A9zvGBbZI8Q= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-o6_5nloJMCSOcP-_TGkAHw-1; Sun, 01 Oct 2023 09:45:28 -0400 X-MC-Unique: o6_5nloJMCSOcP-_TGkAHw-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9b2cf504e3aso207158866b.2 for ; Sun, 01 Oct 2023 06:45:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696167927; x=1696772727; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+Pe7//1mtQSa51WaPPJHVuxvv1rCN+4di+Pko3njm1A=; b=cVj0nKIRPZMTtpzxhiMqhBflhn41YY9elqQAncpbfUqrOVUByEySEJHXfE9gVpji8g pNK+G7r5TPeVSllakJGuvOlAOpXGvGReNePoWorKR7XKtM/Fveztna58ZMYxWBHCNeZY RSZwriysxekB6VwGgQrI4gX2zjMObaT8pmktxwhnABV0V6NFFUchySnUHOaYKS5qom2D gFmo0CyQShNamS51KHFkibheAneJ0e77H9jMN2eNYB85GQKDJkECB3q/cd4Z8fQ18/4w 6MniINQ1uQWukQRHnoQPr60oh+WyD/DBvS4eSxzWBs75+dfhqf8C7WQe0E4lt6Zdm+iu ePHA== X-Gm-Message-State: AOJu0YxwPb6C4veBj2hTlozVcXUvzeTthcvLsbBiQf7w3Q8nn2RZAaSl uWhBisGq3e5eV1jfuXVIEVenl/CFQSxOfzvTiR7JZAM6ibFyWop6VOBKOztN4dxHSWVqBk3z+62 T85Q9v3AdQ2DLL7m46bz1Ey1I X-Received: by 2002:aa7:c390:0:b0:532:e71b:5ead with SMTP id k16-20020aa7c390000000b00532e71b5eadmr6972079edq.32.1696167927431; Sun, 01 Oct 2023 06:45:27 -0700 (PDT) X-Received: by 2002:aa7:c390:0:b0:532:e71b:5ead with SMTP id k16-20020aa7c390000000b00532e71b5eadmr6972064edq.32.1696167927027; Sun, 01 Oct 2023 06:45:27 -0700 (PDT) Received: from [10.101.1.23] (ip-185-104-137-32.ptr.icomera.net. [185.104.137.32]) by smtp.gmail.com with ESMTPSA id a2-20020aa7cf02000000b005232ea6a330sm14099988edy.2.2023.10.01.06.45.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Oct 2023 06:45:25 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------v7f9xE00Aq1dAMrKf1zWgKbN" Message-ID: Date: Sun, 1 Oct 2023 15:45:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: PROBLEM: asus_nb_wmi sends KEY_BRIGHTNESSDOWN on pressing CAPS Lock and PrntScrn on Zenbook S 13 UX5304VA Content-Language: en-US To: James John , Corentin Chary , =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , Mark Gross Cc: platform-driver-x86@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <132feb67-c147-7ee6-b337-385e11786ec6@redhat.com> <146cb960-406b-4456-94ce-ad6ed3f330ad@donjajo.com> From: Hans de Goede In-Reply-To: <146cb960-406b-4456-94ce-ad6ed3f330ad@donjajo.com> X-Spam-Status: No, score=-3.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 01 Oct 2023 06:46:47 -0700 (PDT) This is a multi-part message in MIME format. --------------v7f9xE00Aq1dAMrKf1zWgKbN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 >> > --------------v7f9xE00Aq1dAMrKf1zWgKbN Content-Type: text/x-patch; charset=UTF-8; name="0001-platform-x86-asus-wmi-event-code-debug-patch.patch" Content-Disposition: attachment; filename="0001-platform-x86-asus-wmi-event-code-debug-patch.patch" Content-Transfer-Encoding: base64 RnJvbSBkMzkyMjA0YjlkOTA5ZTQ1ZmM3NGJlNDdjY2ZhZTcxMzJlYzI5OGYwIE1vbiBTZXAg MTcgMDA6MDA6MDAg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