From nobody Sat Feb 7 15:35:06 2026 Received: from relay10.grserver.gr (relay10.grserver.gr [37.27.248.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97ED526E6E1; Sat, 18 Oct 2025 10:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.27.248.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782816; cv=none; b=FROd+ykXdI1UHz8UmoxIKvDFGW+qxKAxYy2T6CsD4eVuvCvkKx0KhfVFmeyxXlT8s1sgS3udWxT4ntHY5MxLVvrw3tFCD9vaLjDsPZphUPY2mdazQTRUkdEGVoCT36fjG6TAS6YENowycwDnijmpCQDz1o25x5AUSD6s+JVsp08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782816; c=relaxed/simple; bh=bAVsTtVVadOWp97QgVy+yErNXpIetJbrzqa/Gn3C1Ss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=irO9SRJ857MD9m/W/CfDlAW4q3iJUV5dhCWi8VwO0/2G7knubmrdl91r5ZmywTKBIB7yCmHRWa1C3EKVa8AxVO3eSzxVta8pcEF8hJHYOUmse6i8Fy8NSGCWEY/arqSteqdGBGZBy2Rqr2MvdRh5FwJmNBMpCyvpdlHGA70hois= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=E2jxEqsy; arc=none smtp.client-ip=37.27.248.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="E2jxEqsy" Received: from relay10 (localhost.localdomain [127.0.0.1]) by relay10.grserver.gr (Proxmox) with ESMTP id BF3183FD44; Sat, 18 Oct 2025 13:20:06 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay10.grserver.gr (Proxmox) with ESMTPS id 487853FD2C; Sat, 18 Oct 2025 13:20:06 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 007B91FC4B1; Sat, 18 Oct 2025 13:20:03 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782805; bh=127svcBDXgweZY4aI/q7KZPt4QURB379Gsk87bd/Plc=; h=From:To:Subject; b=E2jxEqsyM8e3NpEC1QzQrmXphj0Pmw1AQm/1BW/nbvm5+IxFCnx8Gn7a7krMD5/rm W1q7KGHnLMpqq6JaDJkI4PpwRdbn/knPtf6sIgQFydPxsBxLlnv4NLDqOV+fR5yEkS DDAFG1cOb6HECB1GgI/Fltdf8JtZ83EEwIHWjhIrA8R6jR49ye0WV6IHDWEp2BE+tj MEPe4htN0AWhxlniFQ6Dmf3EMthuyoc482IVRvJULqAOTGeJllrSh9jHNHiFxZghb5 DKkBIH2QJRH2EPWBjUUiwYHb1gBcuy/EPiIcO84dVXnuU1DiE/UfN27e0FT9RbS3JY gFnO3xkXUPAwg== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 1/9] HID: asus: simplify RGB init sequence Date: Sat, 18 Oct 2025 12:17:51 +0200 Message-ID: <20251018101759.4089-2-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078280579.1198150.338744444978924506@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Currently, RGB initialization forks depending on whether a device is NKEY. Then, NKEY devices are initialized using 0x5a, 0x5d, 0x5e endpoints, and non-NKEY devices with 0x5a and then a backlight check, which is omitted for NKEY devices. Remove the fork, using a common initialization sequence for both, where they are both only initialized with 0x5a, then checked for backlight support. This patch should not affect existing functionality. 0x5d and 0x5e endpoint initializations are performed by Windows userspace programs associated with different usages that reside under the vendor HID. Specifically, 0x5d is used by Armoury Crate, which controls RGB and 0x5e by an animation program for certain Asus laptops. Neither is used currently in the driver. Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 56 ++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index a444d41e53b6..7ea1037c3979 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -638,50 +638,32 @@ static int asus_kbd_register_leds(struct hid_device *= hdev) unsigned char kbd_func; int ret; =20 - if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { - /* Initialize keyboard */ - ret =3D asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); - if (ret < 0) - return ret; - - /* The LED endpoint is initialised in two HID */ - ret =3D asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1); - if (ret < 0) - return ret; - - ret =3D asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2); - if (ret < 0) - return ret; - - if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) { - ret =3D asus_kbd_disable_oobe(hdev); - if (ret < 0) - return ret; - } - - if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) { - intf =3D to_usb_interface(hdev->dev.parent); - udev =3D interface_to_usbdev(intf); - validate_mcu_fw_version(hdev, - le16_to_cpu(udev->descriptor.idProduct)); - } + ret =3D asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); + if (ret < 0) + return ret; =20 - } else { - /* Initialize keyboard */ - ret =3D asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); - if (ret < 0) - return ret; + /* Get keyboard functions */ + ret =3D asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); + if (ret < 0) + return ret; =20 - /* Get keyboard functions */ - ret =3D asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); + if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) { + ret =3D asus_kbd_disable_oobe(hdev); if (ret < 0) return ret; + } =20 - /* Check for backlight support */ - if (!(kbd_func & SUPPORT_KBD_BACKLIGHT)) - return -ENODEV; + if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) { + intf =3D to_usb_interface(hdev->dev.parent); + udev =3D interface_to_usbdev(intf); + validate_mcu_fw_version( + hdev, le16_to_cpu(udev->descriptor.idProduct)); } =20 + /* Check for backlight support */ + if (!(kbd_func & SUPPORT_KBD_BACKLIGHT)) + return -ENODEV; + drvdata->kbd_backlight =3D devm_kzalloc(&hdev->dev, sizeof(struct asus_kbd_leds), GFP_KERNEL); --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay13.grserver.gr (relay13.grserver.gr [178.156.171.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C51F32874E3; Sat, 18 Oct 2025 10:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.156.171.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782818; cv=none; b=iS1jyS057dfCrjKMehMUxJLAbIK5/r8Vjnu5Pe4phHp82otcfgM8Z8+XwtefXlab6jwR9OYhhYR4Ykf/TOULOe+A1i9mLdacloBXGDX+lZKHa+4PdPmaEYAa2lNxNxE4y/qpnvBMl60KwAoouBzy+sSauqKXnrgzK4aTaqXvqsw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782818; c=relaxed/simple; bh=QUOjiyrN5Jz4OHsKui+Yh/o1imWgGlSsxl79kT35OXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NfIX6WSGABgVvqR3P9tx3NowMV7hb/SvXlcOQwhHsaqoiml+TmhzcPfsFEieWbiC/3juDusEV+JgMT+Z1ejxkZKmQ343QY57WJR1QThSjtvMII5BWNNwv8o+mvNw+Tnxz7EaMbw+36xuF5g9PSWTEjREiqeNxX7o4X+BUKi7I9Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=HLHvW1M2; arc=none smtp.client-ip=178.156.171.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="HLHvW1M2" Received: from relay13 (localhost [127.0.0.1]) by relay13.grserver.gr (Proxmox) with ESMTP id 4C6775E49E; Sat, 18 Oct 2025 13:20:10 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay13.grserver.gr (Proxmox) with ESMTPS id 10EE15E4C9; Sat, 18 Oct 2025 13:20:09 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 571291FEC82; Sat, 18 Oct 2025 13:20:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782808; bh=I6P2Hzo8eJMR1NdjMvS2Ra8dEujH0rd/PamslOwA858=; h=From:To:Subject; b=HLHvW1M2U0hlDjDvenu8SaH+tU51pYHgNJdmMQ5mslAfpmoMbhzZefcsIwknuzX4B X0j8zhnM8nXHbr7LcVB+zyw1Ghcgte20E82+1+8NbnJ5yWfzrC5YpI5V/bGiS5AQ8k 5VLKhwOe4x9n6q89oPJs/wvOY4DcKr6SG6mltXYgwq7OcXaNBIB3hd9ZQJ49B+k99j 79Dof/as3R5GLRb3OrioA3rGaGe0rfIbpy0ytc3eN0toHLz2noFk8lFczDoDbrinX0 GjwiX/kHKSmMDPn4dzTxoUeAnB7ADZzcvz3DPfU+tkq1v+BSuv42Dc5ZgsNQO0s5DY /ZILBWNMqc+Qw== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 2/9] HID: asus: use same report_id in response Date: Sat, 18 Oct 2025 12:17:52 +0200 Message-ID: <20251018101759.4089-3-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078280817.1198223.8882297339370901917@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Currently, asus_kbd_get_functions prods the device using feature report report_id, but then is hardcoded to check the response through FEATURE_KBD_REPORT_ID. This only works if report_id is that value (currently true). So, use report_id in the response as well to maintain functionality if that value changes in the future. Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 7ea1037c3979..4676b7f20caf 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -422,7 +422,7 @@ static int asus_kbd_get_functions(struct hid_device *hd= ev, if (!readbuf) return -ENOMEM; =20 - ret =3D hid_hw_raw_request(hdev, FEATURE_KBD_REPORT_ID, readbuf, + ret =3D hid_hw_raw_request(hdev, report_id, readbuf, FEATURE_KBD_REPORT_SIZE, HID_FEATURE_REPORT, HID_REQ_GET_REPORT); if (ret < 0) { --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay10.grserver.gr (relay10.grserver.gr [37.27.248.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91D662EB87A; Sat, 18 Oct 2025 10:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.27.248.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782820; cv=none; b=LRFVt8onP8vrDON7RsnJyGAwez5b2LRkavxL4+yCpCvRcFDhuA1sX6yswqyQypDg+WVlEJ+VpSy//m6MsobnwDQulgc4agZUkQCj2h57CDIrZdt6A1+P6Il82wYy4UgGpTzltYanky/oCQRGaA6r2+3ndVm+RrourvHEfET5lEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782820; c=relaxed/simple; bh=xZuykDIIZVYAmZBy+EzMb5seZX+kKMYBe84ylHXRrGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hd3GQW89VA7NzcMLUUZTaHek/uGHCkgi01A+jQtYM6/lsHUceBQpL3cxH4Rki+VOS7ztS4VtNIyx2Pswj4leA3bRlkIa0zM45A9Np+YBZzPd0/eLbUWkYUappURFWAn4haRaq1ZC4i4LAxF7O+QBwIysnIS+RGqutGvRstpzYuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=ejEBdMyr; arc=none smtp.client-ip=37.27.248.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="ejEBdMyr" Received: from relay10 (localhost.localdomain [127.0.0.1]) by relay10.grserver.gr (Proxmox) with ESMTP id A0A123FCC2; Sat, 18 Oct 2025 13:20:11 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay10.grserver.gr (Proxmox) with ESMTPS id 17D943FD2C; Sat, 18 Oct 2025 13:20:11 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 9EF561FDB77; Sat, 18 Oct 2025 13:20:08 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782810; bh=Wz3GlE4QVqquzjEegGtzrVdHLIOLOYcwtZrBsurn9Po=; h=From:To:Subject; b=ejEBdMyrwWLyeB0gytbiKvDIkJgAs83fQfOdV7+xCI6e/UzURQWptPA+QFuKQZ6DV E7vgMFgFiXMAljiJQUbZdUpKHahTCpnvqmM8OTZm/jxakGGk3Q0Tz7YGq8nxtizJXd 5T29kg65o1LtObOB/5OemruN+ZWDYx229I8anIieptyAo0vGacoprZ7qko+aRRpPDg TNo2S2zXANK2FgkbCxZ6Fo+YOnNqnourQxuOu1/KgHEXHL0or5IRki3vP4Qz1po4Ws 69t+FYB+r9XWQruk8X2sYtIJtxaAPf6x4YnVPfZv8dhO4sCs5ypiz2IE3dN0D9yA3L OwfZbFzZ8hXmw== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 3/9] HID: asus: fortify keyboard handshake Date: Sat, 18 Oct 2025 12:17:53 +0200 Message-ID: <20251018101759.4089-4-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078281057.1198292.13430095886647870005@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Handshaking with an Asus device involves sending it a feature report with the string "ASUS Tech.Inc." and then reading it back to verify the handshake was successful, under the feature ID the interaction will take place. Currently, the driver only does the first part. Add the readback to verify the handshake was successful. As this could cause breakages, allow the verification to fail with a dmesg error until we verify all devices work with it (they seem to). Since the response is more than 16 bytes, increase the buffer size to 64 as well to avoid overflow errors. Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 4676b7f20caf..03f0d86936fc 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -48,7 +48,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define FEATURE_REPORT_ID 0x0d #define INPUT_REPORT_ID 0x5d #define FEATURE_KBD_REPORT_ID 0x5a -#define FEATURE_KBD_REPORT_SIZE 16 +#define FEATURE_KBD_REPORT_SIZE 64 #define FEATURE_KBD_LED_REPORT_ID1 0x5d #define FEATURE_KBD_LED_REPORT_ID2 0x5e =20 @@ -393,14 +393,40 @@ static int asus_kbd_set_report(struct hid_device *hde= v, const u8 *buf, size_t bu =20 static int asus_kbd_init(struct hid_device *hdev, u8 report_id) { + /* + * The handshake is first sent as a set_report, then retrieved + * from a get_report. They should be equal. + */ const u8 buf[] =3D { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; + u8 *readbuf; int ret; =20 ret =3D asus_kbd_set_report(hdev, buf, sizeof(buf)); - if (ret < 0) - hid_err(hdev, "Asus failed to send init command: %d\n", ret); + if (ret < 0) { + hid_err(hdev, "Asus failed to send handshake: %d\n", ret); + return ret; + } + + readbuf =3D kzalloc(FEATURE_KBD_REPORT_SIZE, GFP_KERNEL); + if (!readbuf) + return -ENOMEM; + + ret =3D hid_hw_raw_request(hdev, report_id, readbuf, + FEATURE_KBD_REPORT_SIZE, HID_FEATURE_REPORT, + HID_REQ_GET_REPORT); + if (ret < 0) { + hid_err(hdev, "Asus failed to receive handshake ack: %d\n", ret); + } else if (memcmp(readbuf, buf, sizeof(buf)) !=3D 0) { + hid_warn(hdev, "Asus handshake returned invalid response: %*ph\n", + FEATURE_KBD_REPORT_SIZE, readbuf); + /* + * Do not return error if handshake is wrong until this is + * verified to work for all devices. + */ + } =20 + kfree(readbuf); return ret; } =20 --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay10.grserver.gr (relay10.grserver.gr [37.27.248.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89792287253; Sat, 18 Oct 2025 10:20:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.27.248.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782817; cv=none; b=fMUnSVn4scmvm90J4YFgk0vZwJqfhZhyvXn6pAPTif5JT5kNP4cbz9rpfNaMOnoMcZjzgr7UxdHOrx3b6m5uNeGLrtZdSwaZfUaF9UZ63xF1C2ESo+39v1QKzryP211aZHS/W+AYt1AXcHpBOO9cWD8L3RADlJBmXYtlIqA/pHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782817; c=relaxed/simple; bh=L7vk09fhWiLpWTrTBRQ4K+ZwowsnQ2zc4/XKx3IA07Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EJNNasSryEWL57VqILfRWn+fz+TmJF5Qf4oLmg+AH+dZi94CnM9hfUvJHHPBXmMaoiOm69kpKRtbFtZ1BUN2yRyH7bOU8aJ/amDFovPeMoe3Jgeo+V47zmXRC6xBzzfM7DqqEs3dwXZsknRdYkxDR/a3Yx9iRgxvh9zxdzh/8kc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=Ea2ZxxGL; arc=none smtp.client-ip=37.27.248.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="Ea2ZxxGL" Received: from relay10 (localhost.localdomain [127.0.0.1]) by relay10.grserver.gr (Proxmox) with ESMTP id D566E3FD34; Sat, 18 Oct 2025 13:20:13 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay10.grserver.gr (Proxmox) with ESMTPS id 5172E3FD40; Sat, 18 Oct 2025 13:20:13 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 10DAE1FEC82; Sat, 18 Oct 2025 13:20:10 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782812; bh=mcNkPO+nK1oBiA0PbJhJMPswNMMFQF0xSQ4CTb/6hfI=; h=From:To:Subject; b=Ea2ZxxGLCBw/utsrIeG00YV0tgQNgZRqfImHSMcyR5gyqrygzX16d4qL2p5Un+WVg 4Bd63Laf8R9ueBjibZlm/BV8dffxGN/hSoCN5uTxND/aCkTe47kT7TcTjMSma5WMCS n/kKbR0Sdayavyfkk5vNaTiiZW4ERCINxPCWfDWT/JL84Nxeivyn0EV0/FP/0P+lzw ACiByu+vJQHAhu4sfqEp9ShGbZX+p2kX2O0S4u2dyQPw9jcRdaBryRKU1ivzDhfc00 p66gh4O3nUjJa01Xfh6FRDZuvxB68enzQdKK+enWeGIZ1KONuivLikcbhRPHYl1ELr QOjoIrP+HT6VA== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 4/9] HID: asus: prevent binding to all HID devices on ROG Date: Sat, 18 Oct 2025 12:17:54 +0200 Message-ID: <20251018101759.4089-5-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078281281.1198354.18356415500918654819@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Currently, when hid-asus is not loaded, NKEY keyboards load as ~6 event devices with a pretty ASUSTEK name. When it loads, it concatenates all applications per HID endpoint, renames them, and prints errors when some of them do not have an input device. Therefore, change probe so that this is no longer the case. Stop renaming the devices, omit the check for .input which causes errors on e.g., the Z13 for some hiddev only devices, and add HID_QUIRK_INPUT_PER_APP so that each application gets its own event. When this is done, the probes are called multiple times. Due to this, the rgb check needs to be moved into probe, and the report fixup should be skipped for non-vendor endpoints (prevents multiple prints). Reviewed-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 59 +++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 03f0d86936fc..bbbac98f76c6 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -47,6 +47,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define T100CHI_MOUSE_REPORT_ID 0x06 #define FEATURE_REPORT_ID 0x0d #define INPUT_REPORT_ID 0x5d +#define HID_USAGE_PAGE_VENDOR 0xff310000 #define FEATURE_KBD_REPORT_ID 0x5a #define FEATURE_KBD_REPORT_SIZE 64 #define FEATURE_KBD_LED_REPORT_ID1 0x5d @@ -89,6 +90,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define QUIRK_ROG_NKEY_KEYBOARD BIT(11) #define QUIRK_ROG_CLAYMORE_II_KEYBOARD BIT(12) #define QUIRK_ROG_ALLY_XPAD BIT(13) +#define QUIRK_SKIP_REPORT_FIXUP BIT(14) =20 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ QUIRK_NO_INIT_REPORTS | \ @@ -125,7 +127,6 @@ struct asus_drvdata { struct input_dev *tp_kbd_input; struct asus_kbd_leds *kbd_backlight; const struct asus_touchpad_info *tp; - bool enable_backlight; struct power_supply *battery; struct power_supply_desc battery_desc; int battery_capacity; @@ -316,7 +317,7 @@ static int asus_e1239t_event(struct asus_drvdata *drvda= t, u8 *data, int size) static int asus_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { - if ((usage->hid & HID_USAGE_PAGE) =3D=3D 0xff310000 && + if ((usage->hid & HID_USAGE_PAGE) =3D=3D HID_USAGE_PAGE_VENDOR && (usage->hid & HID_USAGE) !=3D 0x00 && (usage->hid & HID_USAGE) !=3D 0xff && !usage->type) { hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n", @@ -931,11 +932,6 @@ static int asus_input_configured(struct hid_device *hd= ev, struct hid_input *hi) =20 drvdata->input =3D input; =20 - if (drvdata->enable_backlight && - !asus_kbd_wmi_led_control_present(hdev) && - asus_kbd_register_leds(hdev)) - hid_warn(hdev, "Failed to initialize backlight.\n"); - return 0; } =20 @@ -1008,15 +1004,6 @@ static int asus_input_mapping(struct hid_device *hde= v, return -1; } =20 - /* - * Check and enable backlight only on devices with UsagePage =3D=3D - * 0xff31 to avoid initializing the keyboard firmware multiple - * times on devices with multiple HID descriptors but same - * PID/VID. - */ - if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) - drvdata->enable_backlight =3D true; - set_bit(EV_REP, hi->input->evbit); return 1; } @@ -1133,8 +1120,10 @@ static int __maybe_unused asus_reset_resume(struct h= id_device *hdev) =20 static int asus_probe(struct hid_device *hdev, const struct hid_device_id = *id) { - int ret; + struct hid_report_enum *rep_enum; struct asus_drvdata *drvdata; + struct hid_report *rep; + int ret, is_vendor =3D 0; =20 drvdata =3D devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL); if (drvdata =3D=3D NULL) { @@ -1218,18 +1207,42 @@ static int asus_probe(struct hid_device *hdev, cons= t struct hid_device_id *id) return ret; } =20 + /* Check for vendor for RGB init and handle generic devices properly. */ + rep_enum =3D &hdev->report_enum[HID_INPUT_REPORT]; + list_for_each_entry(rep, &rep_enum->report_list, list) { + if ((rep->application & HID_USAGE_PAGE) =3D=3D HID_USAGE_PAGE_VENDOR) + is_vendor =3D true; + } + + /* + * For ROG keyboards, make them HID/hiddev compliant by creating one + * input per application. For interfaces other than the vendor one, + * disable report fixups. + */ + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { + if (!is_vendor) + drvdata->quirks |=3D QUIRK_SKIP_REPORT_FIXUP; + hdev->quirks |=3D HID_QUIRK_INPUT_PER_APP; + } + ret =3D hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) { hid_err(hdev, "Asus hw start failed: %d\n", ret); return ret; } =20 + if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) && + !asus_kbd_wmi_led_control_present(hdev) && + asus_kbd_register_leds(hdev)) + hid_warn(hdev, "Failed to initialize backlight.\n"); + /* - * Check that input registration succeeded. Checking that - * HID_CLAIMED_INPUT is set prevents a UAF when all input devices - * were freed during registration due to no usages being mapped, - * leaving drvdata->input pointing to freed memory. + * For ROG keyboards, skip rename for consistency and ->input check as + * some devices do not have inputs. */ + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) + return 0; + if (!drvdata->input || !(hdev->claimed & HID_CLAIMED_INPUT)) { hid_err(hdev, "Asus input not registered\n"); ret =3D -ENOMEM; @@ -1352,6 +1365,10 @@ static const __u8 *asus_report_fixup(struct hid_devi= ce *hdev, __u8 *rdesc, rdesc =3D new_rdesc; } =20 + /* Vendor fixups should only apply to NKEY vendor devices. */ + if (drvdata->quirks & QUIRK_SKIP_REPORT_FIXUP) + return rdesc; + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && *rsize =3D=3D 331 && rdesc[190] =3D=3D 0x85 && rdesc[191] =3D=3D 0x5a && rdesc[204] =3D=3D 0x95 && rdesc[205] =3D=3D 0x05) { --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay13.grserver.gr (relay13.grserver.gr [178.156.171.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 414C72EB86E; Sat, 18 Oct 2025 10:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.156.171.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782820; cv=none; b=e9C0l3xAQl+0YjiFg2mVM78Qbac2KaDO+Rs4jtr6atwZo8cPhKXe+NUgkahjKS3hBI+rnmnOAJ+VPtNp8NMNpY3h/ftdGTcImAZZqUgWo3BXxmSRmj/4VUppgrDsETx6NJ2Hw6fpuYyx+aaAl+ysQF82JGQFVi6QLHUlukAd5RE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782820; c=relaxed/simple; bh=dMuJ3XXbb66B6zfVzs6h63EJQ3NxJnJgU3b4iPHW3DU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OZpNBCHsG6jC11L1WvD3sBehJNEVw4EyjEP/dGd2ftqQkEKvEuLw/TtnujnpPNwBVo2sA3LQYEJXa9gBHJBZZZAgRgxM/uSuddgQOxG1LxyaTOMs1D6LN3uLWzUOe6/khpRbDEWeVKg00liOr5JE2ADE+WS/3Y9m5033EWnIero= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=YygKYYnz; arc=none smtp.client-ip=178.156.171.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="YygKYYnz" Received: from relay13 (localhost [127.0.0.1]) by relay13.grserver.gr (Proxmox) with ESMTP id 2C60A5E21B; Sat, 18 Oct 2025 13:20:17 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay13.grserver.gr (Proxmox) with ESMTPS id 0E0475E4C9; Sat, 18 Oct 2025 13:20:16 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 49AAF1FE7ED; Sat, 18 Oct 2025 13:20:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782815; bh=fOurZuA/XxQXqbjwU2sZbh5G3qD6J2QQADdpEOrt32Q=; h=From:To:Subject; b=YygKYYnz4sw9Dj88lxKVWybXQeKiGPZzXe8O4ka7SWFCHmOs2nBCxhuql/fAlWK2p d3bJ5wNGqJJEsRaJpdq6sdhE0kadFGux8XQ4j83RpoJ5WT1cBhppjNl7QlPGAYDh9M ZZhkzUL8d/kXH30ogty7FlfGmfRUBZrd5RIHf6sxtEHTmUGrMyrdIiqx0EKYMU7vaW ySPH/H3sjgy60om72DTtT5Jm6bWRrK1VSnOYSC5IHluPopuI+vWtr+o0MERwLfhpfF Ge+AQtyCHG7MefUNbvowZDlo/jZ6RBLt7nfrp1C4GTBvHyU2OsdRSeBo+gFULLf8f0 g+i1mykd85jeA== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 5/9] platform/x86: asus-wmi: Add support for multiple kbd led handlers Date: Sat, 18 Oct 2025 12:17:55 +0200 Message-ID: <20251018101759.4089-6-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078281513.1198823.10393441334901805564@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Some devices, such as the Z13 have multiple Aura devices connected to them by USB. In addition, they might have a WMI interface for RGB. In Windows, Armoury Crate exposes a unified brightness slider for all of them, with 3 brightness levels. Therefore, to be synergistic in Linux, and support existing tooling such as UPower, allow adding listeners to the RGB device of the WMI interface. If WMI does not exist, lazy initialize the interface. Since both hid-asus and asus-wmi can both interact with the led objects including from an atomic context, protect the brightness access with a spinlock and update the values from a workqueue. Use this workqueue to process WMI keyboard events as well, so they are processed asynchronously. Reviewed-by: Luke D. Jones Tested-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- drivers/platform/x86/asus-wmi.c | 175 ++++++++++++++++++--- include/linux/platform_data/x86/asus-wmi.h | 17 ++ 2 files changed, 168 insertions(+), 24 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index e72a2b5d158e..aab779142323 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include =20 @@ -258,6 +259,9 @@ struct asus_wmi { int tpd_led_wk; struct led_classdev kbd_led; int kbd_led_wk; + bool kbd_led_notify; + bool kbd_led_avail; + bool kbd_led_registered; struct led_classdev lightbar_led; int lightbar_led_wk; struct led_classdev micmute_led; @@ -266,6 +270,7 @@ struct asus_wmi { struct work_struct tpd_led_work; struct work_struct wlan_led_work; struct work_struct lightbar_led_work; + struct work_struct kbd_led_work; =20 struct asus_rfkill wlan; struct asus_rfkill bluetooth; @@ -1530,6 +1535,100 @@ static void asus_wmi_battery_exit(struct asus_wmi *= asus) =20 /* LEDs ******************************************************************= *****/ =20 +struct asus_hid_ref { + struct list_head listeners; + struct asus_wmi *asus; + /* Protects concurrent access from hid-asus and asus-wmi to leds */ + spinlock_t lock; +}; + +static struct asus_hid_ref asus_ref =3D { + .listeners =3D LIST_HEAD_INIT(asus_ref.listeners), + .asus =3D NULL, + /* + * Protects .asus, .asus.kbd_led_{wk,notify}, and .listener refs. Other + * asus variables are read-only after .asus is set. Except the led cdev + * device if not kbd_led_avail. That becomes read-only after the + * first hid-asus listener registers and triggers the work queue. It is + * then not referenced again until unregistering, which happens after + * .asus ref is dropped. Since .asus needs to be accessed by hid-asus + * IRQs to check if forwarding events is possible, a spinlock is used. + */ + .lock =3D __SPIN_LOCK_UNLOCKED(asus_ref.lock), +}; + +/* + * Allows registering hid-asus listeners that want to be notified of + * keyboard backlight changes. + */ +int asus_hid_register_listener(struct asus_hid_listener *bdev) +{ + struct asus_wmi *asus; + + guard(spinlock_irqsave)(&asus_ref.lock); + list_add_tail(&bdev->list, &asus_ref.listeners); + asus =3D asus_ref.asus; + if (asus) + queue_work(asus->led_workqueue, &asus->kbd_led_work); + return 0; +} +EXPORT_SYMBOL_GPL(asus_hid_register_listener); + +/* + * Allows unregistering hid-asus listeners that were added with + * asus_hid_register_listener(). + */ +void asus_hid_unregister_listener(struct asus_hid_listener *bdev) +{ + guard(spinlock_irqsave)(&asus_ref.lock); + list_del(&bdev->list); +} +EXPORT_SYMBOL_GPL(asus_hid_unregister_listener); + +static void do_kbd_led_set(struct led_classdev *led_cdev, int value); + +static void kbd_led_update_all(struct work_struct *work) +{ + enum led_brightness value; + struct asus_wmi *asus; + bool registered, notify; + int ret; + + asus =3D container_of(work, struct asus_wmi, kbd_led_work); + + scoped_guard(spinlock_irqsave, &asus_ref.lock) { + registered =3D asus->kbd_led_registered; + value =3D asus->kbd_led_wk; + notify =3D asus->kbd_led_notify; + } + + if (!registered) { + /* + * This workqueue runs under asus-wmi, which means probe has + * completed and asus-wmi will keep running until it finishes. + * Therefore, we can safely register the LED without holding + * a spinlock. + */ + ret =3D devm_led_classdev_register(&asus->platform_device->dev, + &asus->kbd_led); + if (!ret) { + scoped_guard(spinlock_irqsave, &asus_ref.lock) + asus->kbd_led_registered =3D true; + } else { + pr_warn("Failed to register keyboard backlight LED: %d\n", ret); + return; + } + } + + if (value >=3D 0) + do_kbd_led_set(&asus->kbd_led, value); + if (notify) { + scoped_guard(spinlock_irqsave, &asus_ref.lock) + asus->kbd_led_notify =3D false; + led_classdev_notify_brightness_hw_changed(&asus->kbd_led, value); + } +} + /* * These functions actually update the LED's, and are called from a * workqueue. By doing this as separate work rather than when the LED @@ -1576,7 +1675,8 @@ static void kbd_led_update(struct asus_wmi *asus) { int ctrl_param =3D 0; =20 - ctrl_param =3D 0x80 | (asus->kbd_led_wk & 0x7F); + scoped_guard(spinlock_irqsave, &asus_ref.lock) + ctrl_param =3D 0x80 | (asus->kbd_led_wk & 0x7F); asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); } =20 @@ -1609,14 +1709,23 @@ static int kbd_led_read(struct asus_wmi *asus, int = *level, int *env) =20 static void do_kbd_led_set(struct led_classdev *led_cdev, int value) { + struct asus_hid_listener *listener; struct asus_wmi *asus; int max_level; =20 asus =3D container_of(led_cdev, struct asus_wmi, kbd_led); max_level =3D asus->kbd_led.max_brightness; =20 - asus->kbd_led_wk =3D clamp_val(value, 0, max_level); - kbd_led_update(asus); + scoped_guard(spinlock_irqsave, &asus_ref.lock) + asus->kbd_led_wk =3D clamp_val(value, 0, max_level); + + if (asus->kbd_led_avail) + kbd_led_update(asus); + + scoped_guard(spinlock_irqsave, &asus_ref.lock) { + list_for_each_entry(listener, &asus_ref.listeners, list) + listener->brightness_set(listener, asus->kbd_led_wk); + } } =20 static void kbd_led_set(struct led_classdev *led_cdev, @@ -1631,10 +1740,11 @@ static void kbd_led_set(struct led_classdev *led_cd= ev, =20 static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness = value) { - struct led_classdev *led_cdev =3D &asus->kbd_led; - - do_kbd_led_set(led_cdev, value); - led_classdev_notify_brightness_hw_changed(led_cdev, asus->kbd_led_wk); + scoped_guard(spinlock_irqsave, &asus_ref.lock) { + asus->kbd_led_wk =3D value; + asus->kbd_led_notify =3D true; + } + queue_work(asus->led_workqueue, &asus->kbd_led_work); } =20 static enum led_brightness kbd_led_get(struct led_classdev *led_cdev) @@ -1644,10 +1754,18 @@ static enum led_brightness kbd_led_get(struct led_c= lassdev *led_cdev) =20 asus =3D container_of(led_cdev, struct asus_wmi, kbd_led); =20 + scoped_guard(spinlock_irqsave, &asus_ref.lock) { + if (!asus->kbd_led_avail) + return asus->kbd_led_wk; + } + retval =3D kbd_led_read(asus, &value, NULL); if (retval < 0) return retval; =20 + scoped_guard(spinlock_irqsave, &asus_ref.lock) + asus->kbd_led_wk =3D value; + return value; } =20 @@ -1759,7 +1877,9 @@ static int camera_led_set(struct led_classdev *led_cd= ev, =20 static void asus_wmi_led_exit(struct asus_wmi *asus) { - led_classdev_unregister(&asus->kbd_led); + scoped_guard(spinlock_irqsave, &asus_ref.lock) + asus_ref.asus =3D NULL; + led_classdev_unregister(&asus->tpd_led); led_classdev_unregister(&asus->wlan_led); led_classdev_unregister(&asus->lightbar_led); @@ -1797,22 +1917,25 @@ static int asus_wmi_led_init(struct asus_wmi *asus) goto error; } =20 - if (!kbd_led_read(asus, &led_val, NULL) && !dmi_check_system(asus_use_hid= _led_dmi_ids)) { - pr_info("using asus-wmi for asus::kbd_backlight\n"); - asus->kbd_led_wk =3D led_val; - asus->kbd_led.name =3D "asus::kbd_backlight"; - asus->kbd_led.flags =3D LED_BRIGHT_HW_CHANGED; - asus->kbd_led.brightness_set =3D kbd_led_set; - asus->kbd_led.brightness_get =3D kbd_led_get; - asus->kbd_led.max_brightness =3D 3; + asus->kbd_led.name =3D "asus::kbd_backlight"; + asus->kbd_led.flags =3D LED_BRIGHT_HW_CHANGED; + asus->kbd_led.brightness_set =3D kbd_led_set; + asus->kbd_led.brightness_get =3D kbd_led_get; + asus->kbd_led.max_brightness =3D 3; + asus->kbd_led_avail =3D !kbd_led_read(asus, &led_val, NULL); + INIT_WORK(&asus->kbd_led_work, kbd_led_update_all); =20 + if (asus->kbd_led_avail) { + asus->kbd_led_wk =3D led_val; if (num_rgb_groups !=3D 0) asus->kbd_led.groups =3D kbd_rgb_mode_groups; + } else + asus->kbd_led_wk =3D -1; =20 - rv =3D led_classdev_register(&asus->platform_device->dev, - &asus->kbd_led); - if (rv) - goto error; + scoped_guard(spinlock_irqsave, &asus_ref.lock) { + asus_ref.asus =3D asus; + if (asus->kbd_led_avail || !list_empty(&asus_ref.listeners)) + queue_work(asus->led_workqueue, &asus->kbd_led_work); } =20 if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_WIRELESS_LED) @@ -4272,6 +4395,7 @@ static int asus_wmi_get_event_code(union acpi_object = *obj) =20 static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus) { + enum led_brightness led_value; unsigned int key_value =3D 1; bool autorelease =3D 1; =20 @@ -4288,19 +4412,22 @@ static void asus_wmi_handle_event_code(int code, st= ruct asus_wmi *asus) return; } =20 + scoped_guard(spinlock_irqsave, &asus_ref.lock) + led_value =3D asus->kbd_led_wk; + if (code =3D=3D NOTIFY_KBD_BRTUP) { - kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); + kbd_led_set_by_kbd(asus, led_value + 1); return; } if (code =3D=3D NOTIFY_KBD_BRTDWN) { - kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1); + kbd_led_set_by_kbd(asus, led_value - 1); return; } if (code =3D=3D NOTIFY_KBD_BRTTOGGLE) { - if (asus->kbd_led_wk =3D=3D asus->kbd_led.max_brightness) + if (led_value =3D=3D asus->kbd_led.max_brightness) kbd_led_set_by_kbd(asus, 0); else - kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); + kbd_led_set_by_kbd(asus, led_value + 1); return; } =20 diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/pla= tform_data/x86/asus-wmi.h index 8a515179113d..1165039013b1 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -163,11 +163,20 @@ enum asus_ally_mcu_hack { ASUS_WMI_ALLY_MCU_HACK_DISABLED, }; =20 +/* Used to notify hid-asus when asus-wmi changes keyboard backlight */ +struct asus_hid_listener { + struct list_head list; + void (*brightness_set)(struct asus_hid_listener *listener, int brightness= ); +}; + #if IS_REACHABLE(CONFIG_ASUS_WMI) void set_ally_mcu_hack(enum asus_ally_mcu_hack status); void set_ally_mcu_powersave(bool enabled); int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval); int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retva= l); + +int asus_hid_register_listener(struct asus_hid_listener *cdev); +void asus_hid_unregister_listener(struct asus_hid_listener *cdev); #else static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status) { @@ -184,6 +193,14 @@ static inline int asus_wmi_evaluate_method(u32 method_= id, u32 arg0, u32 arg1, { return -ENODEV; } + +static inline int asus_hid_register_listener(struct asus_hid_listener *bde= v) +{ + return -ENODEV; +} +static inline void asus_hid_unregister_listener(struct asus_hid_listener *= bdev) +{ +} #endif =20 /* To be used by both hid-asus and asus-wmi to determine which controls kb= d_brightness */ --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay10.grserver.gr (relay10.grserver.gr [37.27.248.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 148B52EBDF4; Sat, 18 Oct 2025 10:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.27.248.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782822; cv=none; b=Zj7kWhftOGOehWtMPsGnpsgwaGka86jBczwHdbB7zCcPveVjWp9mTlrRVxCfEU9eCIXTTqOtFyVFCos0RUZGPxJP53JUoKh5ESGrWDCSE51LAIwUMDgg26F+hdvCN2dzRd/aYqz3gJDIoElVwwbtW/Co3gAMDiUQRLlSpcY0Qfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782822; c=relaxed/simple; bh=jdz62jI0+jN9f+YghXjTUQCH/vjyMICPC9V5ysitgas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G9vqiMc/kPJsidPi8HOLL3w8jwjhGk42mOPhfIJGR6oUmQzVAAInrSLlP3JKf2pBnBFJNyBg7clvh+skCWTplq5SH/XdtjnGVuhb7+de0nSYvQ4ssvH8hVOV3g1NscHG8DTpfXNK/ejM2k7iJS2QFgB+SMat9sAcHeBmr8MOO+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=Tup6wd76; arc=none smtp.client-ip=37.27.248.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="Tup6wd76" Received: from relay10 (localhost.localdomain [127.0.0.1]) by relay10.grserver.gr (Proxmox) with ESMTP id 87D263FD3C; Sat, 18 Oct 2025 13:20:18 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay10.grserver.gr (Proxmox) with ESMTPS id 005D33FD44; Sat, 18 Oct 2025 13:20:18 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id A30841FEC82; Sat, 18 Oct 2025 13:20:15 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782817; bh=53CwfvzU2+dORQ94QCoiQjW07gZQjED3xLCyh7WV4uQ=; h=From:To:Subject; b=Tup6wd76wgw6Sy/2PlIlfbBkQ/rMd+ga3asIIda5QM7iHFJ+d/ydydRojv/8MoRKt L+WIHbZHfP+RVHEsOf6MZ1YZT8o01YjHJs3esNnUjrVrkk+TMVVwTyKAhCGTITxlX3 W1MYyLbTlYZWUKz6W5dxpQ4F0cfRcyfl9oLQyCyiD8Q2iWRdfXbyp/YkWTarTTkrfo ydungIt4lguc0quYCiDpDjL7Ur4oRHGfO3Mh3ialf/HzjWecJUIFthsfwkP6Q5swo7 Yyt/Z9XNtomcKQ3VnHXWEs/XWeatEue72Q2GPkCyC6ho9EvxKYbpieVCemCtPSwMcK 48QsOL7ZjgbNg== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 6/9] HID: asus: listen to the asus-wmi brightness device instead of creating one Date: Sat, 18 Oct 2025 12:17:56 +0200 Message-ID: <20251018101759.4089-7-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078281749.1198909.10110633654924954066@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" Some ROG laptops expose multiple interfaces for controlling the keyboard/RGB brightness. This creates a name conflict under asus::kbd_brightness, where the second device ends up being named asus::kbd_brightness_1 and they are both broken. Therefore, register a listener to the asus-wmi brightness device instead of creating a new one. Reviewed-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 64 +++++++----------------------------------- 1 file changed, 10 insertions(+), 54 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index bbbac98f76c6..96cff7690987 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -102,7 +102,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define TRKID_SGN ((TRKID_MAX + 1) >> 1) =20 struct asus_kbd_leds { - struct led_classdev cdev; + struct asus_hid_listener listener; struct hid_device *hdev; struct work_struct work; unsigned int brightness; @@ -494,11 +494,11 @@ static void asus_schedule_work(struct asus_kbd_leds *= led) spin_unlock_irqrestore(&led->lock, flags); } =20 -static void asus_kbd_backlight_set(struct led_classdev *led_cdev, - enum led_brightness brightness) +static void asus_kbd_backlight_set(struct asus_hid_listener *listener, + int brightness) { - struct asus_kbd_leds *led =3D container_of(led_cdev, struct asus_kbd_leds, - cdev); + struct asus_kbd_leds *led =3D container_of(listener, struct asus_kbd_leds, + listener); unsigned long flags; =20 spin_lock_irqsave(&led->lock, flags); @@ -508,20 +508,6 @@ static void asus_kbd_backlight_set(struct led_classdev= *led_cdev, asus_schedule_work(led); } =20 -static enum led_brightness asus_kbd_backlight_get(struct led_classdev *led= _cdev) -{ - struct asus_kbd_leds *led =3D container_of(led_cdev, struct asus_kbd_leds, - cdev); - enum led_brightness brightness; - unsigned long flags; - - spin_lock_irqsave(&led->lock, flags); - brightness =3D led->brightness; - spin_unlock_irqrestore(&led->lock, flags); - - return brightness; -} - static void asus_kbd_backlight_work(struct work_struct *work) { struct asus_kbd_leds *led =3D container_of(work, struct asus_kbd_leds, wo= rk); @@ -538,34 +524,6 @@ static void asus_kbd_backlight_work(struct work_struct= *work) hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret); } =20 -/* WMI-based keyboard backlight LED control (via asus-wmi driver) takes - * precedence. We only activate HID-based backlight control when the - * WMI control is not available. - */ -static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) -{ - struct asus_drvdata *drvdata =3D hid_get_drvdata(hdev); - u32 value; - int ret; - - if (!IS_ENABLED(CONFIG_ASUS_WMI)) - return false; - - if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && - dmi_check_system(asus_use_hid_led_dmi_ids)) { - hid_info(hdev, "using HID for asus::kbd_backlight\n"); - return false; - } - - ret =3D asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, - ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value); - hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value); - if (ret) - return false; - - return !!(value & ASUS_WMI_DSTS_PRESENCE_BIT); -} - /* * We don't care about any other part of the string except the version sec= tion. * Example strings: FGA80100.RC72LA.312_T01, FGA80100.RC71LS.318_T01 @@ -700,14 +658,11 @@ static int asus_kbd_register_leds(struct hid_device *= hdev) drvdata->kbd_backlight->removed =3D false; drvdata->kbd_backlight->brightness =3D 0; drvdata->kbd_backlight->hdev =3D hdev; - drvdata->kbd_backlight->cdev.name =3D "asus::kbd_backlight"; - drvdata->kbd_backlight->cdev.max_brightness =3D 3; - drvdata->kbd_backlight->cdev.brightness_set =3D asus_kbd_backlight_set; - drvdata->kbd_backlight->cdev.brightness_get =3D asus_kbd_backlight_get; + drvdata->kbd_backlight->listener.brightness_set =3D asus_kbd_backlight_se= t; INIT_WORK(&drvdata->kbd_backlight->work, asus_kbd_backlight_work); spin_lock_init(&drvdata->kbd_backlight->lock); =20 - ret =3D devm_led_classdev_register(&hdev->dev, &drvdata->kbd_backlight->c= dev); + ret =3D asus_hid_register_listener(&drvdata->kbd_backlight->listener); if (ret < 0) { /* No need to have this still around */ devm_kfree(&hdev->dev, drvdata->kbd_backlight); @@ -1096,7 +1051,7 @@ static int __maybe_unused asus_resume(struct hid_devi= ce *hdev) { =20 if (drvdata->kbd_backlight) { const u8 buf[] =3D { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, - drvdata->kbd_backlight->cdev.brightness }; + drvdata->kbd_backlight->brightness }; ret =3D asus_kbd_set_report(hdev, buf, sizeof(buf)); if (ret < 0) { hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret); @@ -1232,7 +1187,6 @@ static int asus_probe(struct hid_device *hdev, const = struct hid_device_id *id) } =20 if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) && - !asus_kbd_wmi_led_control_present(hdev) && asus_kbd_register_leds(hdev)) hid_warn(hdev, "Failed to initialize backlight.\n"); =20 @@ -1273,6 +1227,8 @@ static void asus_remove(struct hid_device *hdev) unsigned long flags; =20 if (drvdata->kbd_backlight) { + asus_hid_unregister_listener(&drvdata->kbd_backlight->listener); + spin_lock_irqsave(&drvdata->kbd_backlight->lock, flags); drvdata->kbd_backlight->removed =3D true; spin_unlock_irqrestore(&drvdata->kbd_backlight->lock, flags); --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay12.grserver.gr (relay12.grserver.gr [88.99.38.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 504262EE5FD; Sat, 18 Oct 2025 10:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=88.99.38.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782830; cv=none; b=rJwTo4E9BYX+FLNiabJdIlZvIjJxG56lp/PF1mCxeqL9DDJDnmeGNivalFoOEeR/+g2RMYzuPpFrjHpjlWZG3kRErxBJ+X65xOZ2dV7WX6Pr11WFwUZ3mMr7n9xd3FAze4qttNNmVd/qXqjMDakhdLPVLDGsw0yF1qXbSbdKk6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782830; c=relaxed/simple; bh=nLFPxh/z1HnRiXmMqcj8iqOYBGbl8hZW/8g7ga2zGb4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XpHJ6qtuGfEk552evcY+Rxc7MQYJ8uZU5za9PJgtiZFk2hbeomFXuDujhB77U13oZVBbyOuj58Byb2+jsh3c1DxWaWHtIAH+XhEUx8ncvYQ9VDV9QEEYwb4fd8MW+xMq2oPReDefN4pMKeLQRbt7ClwgYqtJpqhyuSP5to3vY2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=A/QZH8KD; arc=none smtp.client-ip=88.99.38.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="A/QZH8KD" Received: from relay12 (localhost [127.0.0.1]) by relay12.grserver.gr (Proxmox) with ESMTP id A24AEBDD81; Sat, 18 Oct 2025 13:20:20 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay12.grserver.gr (Proxmox) with ESMTPS id 2E579BDD6F; Sat, 18 Oct 2025 13:20:20 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 00E462008AA; Sat, 18 Oct 2025 13:20:17 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782819; bh=bI7xv5nilq6rrn2Ebu8+slF5nCGwp5Y2sXrQrdg6uNw=; h=From:To:Subject; b=A/QZH8KD2T5gcWxvJw0R1cCiQbqfPUUSyDMgEg+93sMSjjYPAEgLYBUk0FDE0Mxeu sOgV/o2G/OcScpMjLHRtuFaG6bVnA2PjoAxHQZHzTnN2pEYsEIEW3L/Rz0LlX+3E9u ARb7yj5br6Oev0eqBmf/FwLgfI+zUCXedRhw+pWTjQn0CgTKubmPUIFOrNtDHKDnta aQuT4q42gRscqGwI7C70s2plcUm+0vHPYfzNXATULRoDyh76tnHksOggMIzneWtp6v al/CsqLNjY2ED/XWbw3dwlXfvpTtTwolddgzQMCykgar4MaW5eZCndxvEJZgbe5lE2 OeGXhzXgTd65w== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 7/9] platform/x86: asus-wmi: remove unused keyboard backlight quirk Date: Sat, 18 Oct 2025 12:17:57 +0200 Message-ID: <20251018101759.4089-8-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078281982.1198997.8977759081663902369@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" The quirk for selecting whether keyboard backlight should be controlled by HID or WMI is not needed anymore, so remove it. Reviewed-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- include/linux/platform_data/x86/asus-wmi.h | 40 ---------------------- 1 file changed, 40 deletions(-) diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/pla= tform_data/x86/asus-wmi.h index 1165039013b1..d8c5269854b0 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -203,44 +203,4 @@ static inline void asus_hid_unregister_listener(struct= asus_hid_listener *bdev) } #endif =20 -/* To be used by both hid-asus and asus-wmi to determine which controls kb= d_brightness */ -static const struct dmi_system_id asus_use_hid_led_dmi_ids[] =3D { - { - .matches =3D { - DMI_MATCH(DMI_PRODUCT_FAMILY, "ROG Zephyrus"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_PRODUCT_FAMILY, "ROG Strix"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_PRODUCT_FAMILY, "ROG Flow"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_PRODUCT_FAMILY, "ProArt P16"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_BOARD_NAME, "GA403U"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_BOARD_NAME, "GU605M"), - }, - }, - { - .matches =3D { - DMI_MATCH(DMI_BOARD_NAME, "RC71L"), - }, - }, - { }, -}; - #endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */ --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay11.grserver.gr (relay11.grserver.gr [78.46.171.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2131D2D8DCA; Sat, 18 Oct 2025 10:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.46.171.57 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782827; cv=none; b=Y9MRM8HfhEno05M7WLl6YiJH9Qxtj3k+P4Ol3zZF9j+imMBqRMrv4/+0RhBFZo6LdSFYrpohpymvA6VkFnyUgRvglF3ZCXlotEq5D5BJV5XYr97iQtBswYPDvjbAtE8qxH6WgB1x8or9tPYz3rqy3NfHRsJFfzsYgmZgE3Gtl4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782827; c=relaxed/simple; bh=f2+q3dcvpb4NQymgaAMRI70jNRqBsDygfUDbzh6DJeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M73kc7ygKRmE6oIKlMazr/q+8qQ5+icO7+Jt9MGqOYxBfe9+kNdKSdc3U48GGsehVbZKrDq3Hb/iJgs4xYnRDu2kFsJRQmgyp8hBT1IBBb8JCAS0JLMBh9b+ga5ZbJUGCYOy3OsvO4AEls4pwvB1BK2IEZkOP4yWDmpjqj/Mr9A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=ZcrPIe1d; arc=none smtp.client-ip=78.46.171.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="ZcrPIe1d" Received: from relay11 (localhost.localdomain [127.0.0.1]) by relay11.grserver.gr (Proxmox) with ESMTP id 203D0C1C01; Sat, 18 Oct 2025 13:20:23 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay11.grserver.gr (Proxmox) with ESMTPS id 8ACA3C1D83; Sat, 18 Oct 2025 13:20:22 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id 5EE9E1FDB77; Sat, 18 Oct 2025 13:20:20 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782822; bh=77Rn2DsvkHgGcPqCmiQ5cdPRD6WDYkocYrk0Y9T2fOM=; h=From:To:Subject; b=ZcrPIe1dSN583IWBGTGd5M4N+hX7uQw9ThPhV6EOKRng9bZRHSwy97e7t+F5UAQaU SogwdNJgjR5M12W4k/YJL7n27EVpkg1FxczPJSLyyv56gCe+q87qE6ZdiCH0Rk8Gvg jSlyLf+Wzt2WBN+BGnYHe6WrpotqrLIx78F9oJeq/3jUDc+deJ7P0yfwZDW/yf4UlP JUSwLoSXAbemMoJpusZ8kZol/wg27TJKBqJedJ2AREoWSAAxZHqp7JhRyPVUl5YRII yqP/3PAh1czkD1ZCAkTa+zaiD4ynJxTYj2hoRxwsMcAFSx5fIvcM19lPZ30C4P8UcB VNmrfS4Wq5cRA== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 8/9] platform/x86: asus-wmi: add keyboard brightness event handler Date: Sat, 18 Oct 2025 12:17:58 +0200 Message-ID: <20251018101759.4089-9-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078282220.1199100.11378412111335082729@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" The keyboard brightness control of Asus WMI keyboards is handled in kernel, which leads to the shortcut going from brightness 0, to 1, to 2, and 3. However, for HID keyboards it is exposed as a key and handled by the user's desktop environment. For the toggle button, this means that brightness control becomes on/off. In addition, in the absence of a DE, the keyboard brightness does not work. Therefore, expose an event handler for the keyboard brightness control which can then be used by hid-asus. Since this handler is called from an interrupt context, defer the actual work to a workqueue. In the process, introduce ASUS_EV_MAX_BRIGHTNESS to hold the constant for maximum brightness since it is shared between hid-asus/asus-wmi. Reviewed-by: Luke D. Jones Tested-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- drivers/platform/x86/asus-wmi.c | 46 +++++++++++++++++++--- include/linux/platform_data/x86/asus-wmi.h | 13 ++++++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index aab779142323..f229a50bd69e 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -1629,6 +1629,44 @@ static void kbd_led_update_all(struct work_struct *w= ork) } } =20 +/* + * This function is called from hid-asus to inform asus-wmi of brightness + * changes initiated by the keyboard backlight keys. + */ +int asus_hid_event(enum asus_hid_event event) +{ + struct asus_wmi *asus; + int brightness; + + guard(spinlock_irqsave)(&asus_ref.lock); + asus =3D asus_ref.asus; + if (!asus || !asus->kbd_led_registered) + return -EBUSY; + + brightness =3D asus->kbd_led_wk; + + switch (event) { + case ASUS_EV_BRTUP: + brightness +=3D 1; + break; + case ASUS_EV_BRTDOWN: + brightness -=3D 1; + break; + case ASUS_EV_BRTTOGGLE: + if (brightness >=3D ASUS_EV_MAX_BRIGHTNESS) + brightness =3D 0; + else + brightness +=3D 1; + break; + } + + asus->kbd_led_wk =3D clamp_val(brightness, 0, ASUS_EV_MAX_BRIGHTNESS); + asus->kbd_led_notify =3D true; + queue_work(asus->led_workqueue, &asus->kbd_led_work); + return 0; +} +EXPORT_SYMBOL_GPL(asus_hid_event); + /* * These functions actually update the LED's, and are called from a * workqueue. By doing this as separate work rather than when the LED @@ -1711,13 +1749,11 @@ static void do_kbd_led_set(struct led_classdev *led= _cdev, int value) { struct asus_hid_listener *listener; struct asus_wmi *asus; - int max_level; =20 asus =3D container_of(led_cdev, struct asus_wmi, kbd_led); - max_level =3D asus->kbd_led.max_brightness; =20 scoped_guard(spinlock_irqsave, &asus_ref.lock) - asus->kbd_led_wk =3D clamp_val(value, 0, max_level); + asus->kbd_led_wk =3D clamp_val(value, 0, ASUS_EV_MAX_BRIGHTNESS); =20 if (asus->kbd_led_avail) kbd_led_update(asus); @@ -1921,7 +1957,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus) asus->kbd_led.flags =3D LED_BRIGHT_HW_CHANGED; asus->kbd_led.brightness_set =3D kbd_led_set; asus->kbd_led.brightness_get =3D kbd_led_get; - asus->kbd_led.max_brightness =3D 3; + asus->kbd_led.max_brightness =3D ASUS_EV_MAX_BRIGHTNESS; asus->kbd_led_avail =3D !kbd_led_read(asus, &led_val, NULL); INIT_WORK(&asus->kbd_led_work, kbd_led_update_all); =20 @@ -4424,7 +4460,7 @@ static void asus_wmi_handle_event_code(int code, stru= ct asus_wmi *asus) return; } if (code =3D=3D NOTIFY_KBD_BRTTOGGLE) { - if (led_value =3D=3D asus->kbd_led.max_brightness) + if (led_value =3D=3D ASUS_EV_MAX_BRIGHTNESS) kbd_led_set_by_kbd(asus, 0); else kbd_led_set_by_kbd(asus, led_value + 1); diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/pla= tform_data/x86/asus-wmi.h index d8c5269854b0..3f679598b629 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -169,6 +169,14 @@ struct asus_hid_listener { void (*brightness_set)(struct asus_hid_listener *listener, int brightness= ); }; =20 +enum asus_hid_event { + ASUS_EV_BRTUP, + ASUS_EV_BRTDOWN, + ASUS_EV_BRTTOGGLE, +}; + +#define ASUS_EV_MAX_BRIGHTNESS 3 + #if IS_REACHABLE(CONFIG_ASUS_WMI) void set_ally_mcu_hack(enum asus_ally_mcu_hack status); void set_ally_mcu_powersave(bool enabled); @@ -177,6 +185,7 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u= 32 arg1, u32 *retval); =20 int asus_hid_register_listener(struct asus_hid_listener *cdev); void asus_hid_unregister_listener(struct asus_hid_listener *cdev); +int asus_hid_event(enum asus_hid_event event); #else static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status) { @@ -201,6 +210,10 @@ static inline int asus_hid_register_listener(struct as= us_hid_listener *bdev) static inline void asus_hid_unregister_listener(struct asus_hid_listener *= bdev) { } +static inline int asus_hid_event(enum asus_hid_event event) +{ + return -ENODEV; +} #endif =20 #endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */ --=20 2.51.0 From nobody Sat Feb 7 15:35:06 2026 Received: from relay12.grserver.gr (relay12.grserver.gr [88.99.38.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 755112F12B5; Sat, 18 Oct 2025 10:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=88.99.38.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782834; cv=none; b=MJpoC8m5QPGhilpbfy4YUAldMH1zAlYupBtNUoXySGMGTaEIoKqlG8Z0yQRydKxV+tUj6IWgHgBcJw5bmt7dKIrQVKqn7eMpk1QGtHgWWHtiOEirl0ueVNQWJSeJaT8qBi0hn8q/Z7pUZqf/YReD/jf/Iw42S0fhfyO75YnGaxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760782834; c=relaxed/simple; bh=vfkNCxmZ3FfbFVLnGdM0fIjyjQ/J2HoPeEIo/zeXWkg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O9Y8PY00xaGFVoJFiIAe3AC5HItkWJnawCyXBEAMdlVOAvbL/tm2d/VJHHR22scz69Lo+LavVSHIRxvLp8N7FmJVc4Tm3LX95pVkqVmnzpzJbdoGOMQRIsFqgA+kPci5NsLsjfD+BVvOVGBA6LVphGHqIcWarytEqAvweSnX+Ws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev; spf=pass smtp.mailfrom=antheas.dev; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b=NnkaYQSV; arc=none smtp.client-ip=88.99.38.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=antheas.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antheas.dev Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=antheas.dev header.i=@antheas.dev header.b="NnkaYQSV" Received: from relay12 (localhost [127.0.0.1]) by relay12.grserver.gr (Proxmox) with ESMTP id 51488BDFB8; Sat, 18 Oct 2025 13:20:25 +0300 (EEST) Received: from linux3247.grserver.gr (linux3247.grserver.gr [213.158.90.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by relay12.grserver.gr (Proxmox) with ESMTPS id DB904BDDC7; Sat, 18 Oct 2025 13:20:24 +0300 (EEST) Received: from antheas-z13 (x5996a8de.customers.hiper-net.dk [89.150.168.222]) by linux3247.grserver.gr (Postfix) with ESMTPSA id B59D91FC4B1; Sat, 18 Oct 2025 13:20:22 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antheas.dev; s=default; t=1760782824; bh=QiRO9WlHDWgo9VPXQOmXp8+aYWrSrjdksndf9lPZtzA=; h=From:To:Subject; b=NnkaYQSVPdE3vLg2B01zDdZky8SModwLJZyIgEw7sr30B8v7sgxlihFS3CnMnvf9Z uvaSoxOVGrC4HXZnsdnbCqg2sVte5ANjm+vWZPmNEw+/dy2RaXGwLyhmfZ+Va9tBGu Lv5vVv/mAJeE5CiiCJz25/Z1FE0l4YsVgct/xXc924SuDU/e2nLK5TNKdmsMRsNpAR gS2/IxJsLmJxcLDN+LYLkOISXS4O6weWGdcY+euU7ebV7kbezfbg9BUB1/gtXDg57L BCZ9NzU8IYgWl4W3rCe54hpF7OJohiwhLWPFTSHPdomEwlw31AetVVEoFOeDWyXASZ OhyCaTvKeGtlQ== Authentication-Results: linux3247.grserver.gr; spf=pass (sender IP is 89.150.168.222) smtp.mailfrom=lkml@antheas.dev smtp.helo=antheas-z13 Received-SPF: pass (linux3247.grserver.gr: connection is authenticated) From: Antheas Kapenekakis To: platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Corentin Chary , "Luke D . Jones" , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Denis Benato , Antheas Kapenekakis Subject: [PATCH v7 9/9] HID: asus: add support for the asus-wmi brightness handler Date: Sat, 18 Oct 2025 12:17:59 +0200 Message-ID: <20251018101759.4089-10-lkml@antheas.dev> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018101759.4089-1-lkml@antheas.dev> References: <20251018101759.4089-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PPP-Message-ID: <176078282453.1199146.7999947917705390951@linux3247.grserver.gr> X-PPP-Vhost: antheas.dev X-Virus-Scanned: clamav-milter 1.4.3 at linux3247.grserver.gr X-Virus-Status: Clean Content-Type: text/plain; charset="utf-8" If the asus-wmi brightness handler is available, send the keyboard brightness events to it instead of passing them to userspace. If it is not, fall back to sending them to it. Reviewed-by: Luke D. Jones Tested-by: Luke D. Jones Signed-off-by: Antheas Kapenekakis --- drivers/hid/hid-asus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 96cff7690987..c2c25825cb42 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -324,6 +324,17 @@ static int asus_event(struct hid_device *hdev, struct = hid_field *field, usage->hid & HID_USAGE); } =20 + if (usage->type =3D=3D EV_KEY && value) { + switch (usage->code) { + case KEY_KBDILLUMUP: + return !asus_hid_event(ASUS_EV_BRTUP); + case KEY_KBDILLUMDOWN: + return !asus_hid_event(ASUS_EV_BRTDOWN); + case KEY_KBDILLUMTOGGLE: + return !asus_hid_event(ASUS_EV_BRTTOGGLE); + } + } + return 0; } =20 --=20 2.51.0