drivers/hid/hid-asus.c | 48 +++++++++++++++++++++- include/linux/platform_data/x86/asus-wmi.h | 2 + 2 files changed, 49 insertions(+), 1 deletion(-)
From: Ionut Nechita <ionut_n2001@yahoo.com>
On Asus ROG G14 and G15 laptops, several HID vendor usage codes are sent
during normal operation without a clear purpose, generating unwanted
"Unmapped Asus vendor usagepage code" warnings in dmesg.
Additionally, the Fn+F5 fan control key (code 0xae) needs to communicate
with the asus-wmi driver to toggle between fan modes, but this was not
previously handled.
Changes:
- Filter out spurious HID codes (0xea, 0xec, 0x02, 0x8a, 0x9e) for
QUIRK_ROG_NKEY_KEYBOARD devices to prevent kernel log spam
- Add asus_wmi_send_event() function to communicate with asus-wmi driver
- Implement Fn+F5 (0xae) fan control key handler that triggers WMI events
- Replace magic number 0xff310000 with HID_UP_ASUSVENDOR constant for
better code clarity
This eliminates unnecessary kernel warnings and enables proper fan control
functionality on affected Asus ROG laptops.
Tested on Asus ROG G14/G15 series laptops.
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
drivers/hid/hid-asus.c | 48 +++++++++++++++++++++-
include/linux/platform_data/x86/asus-wmi.h | 2 +
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 472bca54642b9..cd8d0e495a75a 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -26,6 +26,8 @@
#include <linux/dmi.h>
#include <linux/hid.h>
#include <linux/module.h>
+
+#include <linux/acpi.h>
#include <linux/platform_data/x86/asus-wmi.h>
#include <linux/platform_data/x86/asus-wmi-leds-ids.h>
#include <linux/input/mt.h>
@@ -314,10 +316,33 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
return 0;
}
+/*
+ * This enables triggering events in asus-wmi
+ */
+static int asus_wmi_send_event(struct asus_drvdata *drvdat, u8 code)
+{
+ int err;
+ u32 retval;
+
+ err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
+ ASUS_WMI_METHODID_NOTIF, code, &retval);
+ if (err) {
+ pr_warn("Failed to notify asus-wmi: %d\n", err);
+ return err;
+ }
+
+ if (retval != 0) {
+ pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
+ return -EIO;
+ }
+
+ return 0;
+}
+
static int asus_event(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
- if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 &&
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR &&
(usage->hid & HID_USAGE) != 0x00 &&
(usage->hid & HID_USAGE) != 0xff && !usage->type) {
hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
@@ -330,6 +355,7 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,
static int asus_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data, int size)
{
+ int ret;
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
if (drvdata->battery && data[0] == BATTERY_REPORT_ID)
@@ -348,6 +374,26 @@ static int asus_raw_event(struct hid_device *hdev,
if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
return -1;
if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ /* Additional report filtering */
+ if (report->id == FEATURE_KBD_REPORT_ID) {
+ /* Fn+F5 "fan" symbol, trigger WMI event to toggle next mode */
+ if (data[1] == 0xae) {
+ ret = asus_wmi_send_event(drvdata, 0xae);
+ if (ret < 0) {
+ hid_warn(hdev, "Asus failed to trigger fan control event");
+ }
+ return -1;
+ /*
+ * G14 and G15 send these codes on some keypresses with no
+ * discernable reason for doing so. We'll filter them out to avoid
+ * unmapped warning messages later
+ */
+ } else if (data[1] == 0xea || data[1] == 0xec || data[1] == 0x02 ||
+ data[1] == 0x8a || data[1] == 0x9e) {
+ return -1;
+ }
+ }
+
/*
* G713 and G733 send these codes on some keypresses, depending on
* the key pressed it can trigger a shutdown event if not caught.
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index 419491d4abca1..8ed6f603735d1 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -30,6 +30,8 @@
#define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
#define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
+#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method ?? */
+
#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
/* Wireless */
--
2.52.0
+ Denis Benato
On 1/6/2026 8:04 AM, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> On Asus ROG G14 and G15 laptops, several HID vendor usage codes are sent
> during normal operation without a clear purpose, generating unwanted
> "Unmapped Asus vendor usagepage code" warnings in dmesg.
>
> Additionally, the Fn+F5 fan control key (code 0xae) needs to communicate
> with the asus-wmi driver to toggle between fan modes, but this was not
> previously handled.
>
> Changes:
> - Filter out spurious HID codes (0xea, 0xec, 0x02, 0x8a, 0x9e) for
> QUIRK_ROG_NKEY_KEYBOARD devices to prevent kernel log spam
> - Add asus_wmi_send_event() function to communicate with asus-wmi driver
> - Implement Fn+F5 (0xae) fan control key handler that triggers WMI events
> - Replace magic number 0xff310000 with HID_UP_ASUSVENDOR constant for
> better code clarity
I feel these should be split into smaller logical patches.
>
> This eliminates unnecessary kernel warnings and enables proper fan control
> functionality on affected Asus ROG laptops.
>
> Tested on Asus ROG G14/G15 series laptops.
>
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
> ---
> drivers/hid/hid-asus.c | 48 +++++++++++++++++++++-
> include/linux/platform_data/x86/asus-wmi.h | 2 +
> 2 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 472bca54642b9..cd8d0e495a75a 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -26,6 +26,8 @@
> #include <linux/dmi.h>
> #include <linux/hid.h>
> #include <linux/module.h>
> +
> +#include <linux/acpi.h>
Shouldn't this be in alphabetical order before linux/dmi.h above?
> #include <linux/platform_data/x86/asus-wmi.h>
> #include <linux/platform_data/x86/asus-wmi-leds-ids.h>
> #include <linux/input/mt.h>
> @@ -314,10 +316,33 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
> return 0;
> }
>
> +/*
> + * This enables triggering events in asus-wmi
> + */
> +static int asus_wmi_send_event(struct asus_drvdata *drvdat, u8 code)
> +{
> + int err;
> + u32 retval;
> +
> + err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
> + ASUS_WMI_METHODID_NOTIF, code, &retval);
> + if (err) {
> + pr_warn("Failed to notify asus-wmi: %d\n", err);
> + return err;
> + }
> +
> + if (retval != 0) {
> + pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
> + return -EIO;
> + }
> +
> + return 0;
> +}
> +
> static int asus_event(struct hid_device *hdev, struct hid_field *field,
> struct hid_usage *usage, __s32 value)
> {
> - if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 &&
> + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR &&
> (usage->hid & HID_USAGE) != 0x00 &&
> (usage->hid & HID_USAGE) != 0xff && !usage->type) {
> hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
> @@ -330,6 +355,7 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,
> static int asus_raw_event(struct hid_device *hdev,
> struct hid_report *report, u8 *data, int size)
> {
> + int ret;
> struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
>
> if (drvdata->battery && data[0] == BATTERY_REPORT_ID)
> @@ -348,6 +374,26 @@ static int asus_raw_event(struct hid_device *hdev,
> if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
> return -1;
> if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
> + /* Additional report filtering */
> + if (report->id == FEATURE_KBD_REPORT_ID) {
> + /* Fn+F5 "fan" symbol, trigger WMI event to toggle next mode */
> + if (data[1] == 0xae) {
As this has a meaning you've identified shouldn't it have a #define as well?
> + ret = asus_wmi_send_event(drvdata, 0xae);
> + if (ret < 0) {
> + hid_warn(hdev, "Asus failed to trigger fan control event");
> + }
> + return -1;
> + /*
> + * G14 and G15 send these codes on some keypresses with no
> + * discernable reason for doing so. We'll filter them out to avoid
> + * unmapped warning messages later
> + */
> + } else if (data[1] == 0xea || data[1] == 0xec || data[1] == 0x02 ||
> + data[1] == 0x8a || data[1] == 0x9e) {
> + return -1;
> + }
> + }
> +
> /*
> * G713 and G733 send these codes on some keypresses, depending on
> * the key pressed it can trigger a shutdown event if not caught.
> diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
> index 419491d4abca1..8ed6f603735d1 100644
> --- a/include/linux/platform_data/x86/asus-wmi.h
> +++ b/include/linux/platform_data/x86/asus-wmi.h
> @@ -30,6 +30,8 @@
> #define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
> #define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
>
> +#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method ?? */
> +
> #define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
>
> /* Wireless */
From: Ionut Nechita <ionut_n2001@yahoo.com> Hi Mario and maintainers, Thank you for the review feedback on v1. I've addressed all the issues: Changes in v2: - Split the monolithic patch into 4 logical patches as requested - Fixed include order (linux/acpi.h now before linux/dmi.h) - Added #define ASUS_FAN_CTRL_KEY_CODE for 0xae instead of magic number - Added #defines for the filtered spurious codes as well for clarity The patch series now: 1. Replaces magic number with existing HID_UP_ASUSVENDOR constant 2. Filters spurious HID vendor codes (with proper #defines) 3. Adds WMI communication infrastructure 4. Implements Fn+F5 fan control key handler (using #define) This eliminates kernel log spam from unmapped HID codes and enables proper fan control functionality on Asus ROG G14/G15 laptops. Tested on Asus ROG G14/G15 series laptops. Ionut Nechita (4): HID: asus: Replace magic number with HID_UP_ASUSVENDOR constant HID: asus: Filter spurious HID vendor codes on ROG laptops HID: asus: Add WMI communication infrastructure HID: asus: Implement Fn+F5 fan control key handler drivers/hid/hid-asus.c | 60 +++++++++++++++++++++- include/linux/platform_data/x86/asus-wmi.h | 1 + 2 files changed, 60 insertions(+), 1 deletion(-) -- 2.52.0
On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote: > From: Ionut Nechita <ionut_n2001@yahoo.com> > > Hi Mario and maintainers, Hi! Maintainer of asus-wmi here, thanks a lot for your help! Thanks Mario for including me too to the party! A note for the future: from my email client it appears as if you sent v2 in reply to the previous patch, I have done that on the iio subsystem and I have been discouraged from doing so because the mail ends up far from the latest received ones and maintainers are more likely to miss it. > Thank you for the review feedback on v1. I've addressed all the issues: > > Changes in v2: > - Split the monolithic patch into 4 logical patches as requested > - Fixed include order (linux/acpi.h now before linux/dmi.h) > - Added #define ASUS_FAN_CTRL_KEY_CODE for 0xae instead of magic number > - Added #defines for the filtered spurious codes as well for clarity > > The patch series now: > 1. Replaces magic number with existing HID_UP_ASUSVENDOR constant > 2. Filters spurious HID vendor codes (with proper #defines) > 3. Adds WMI communication infrastructure > 4. Implements Fn+F5 fan control key handler (using #define) > > This eliminates kernel log spam from unmapped HID codes and enables > proper fan control functionality on Asus ROG G14/G15 laptops. From my notes those unmapped codepages is the embedded controller echoing out settings for the Windows application armoury-crate to check if it is still in sync. > Tested on Asus ROG G14/G15 series laptops. > > Ionut Nechita (4): > HID: asus: Replace magic number with HID_UP_ASUSVENDOR constant > HID: asus: Filter spurious HID vendor codes on ROG laptops > HID: asus: Add WMI communication infrastructure > HID: asus: Implement Fn+F5 fan control key handler > > drivers/hid/hid-asus.c | 60 +++++++++++++++++++++- > include/linux/platform_data/x86/asus-wmi.h | 1 + > 2 files changed, 60 insertions(+), 1 deletion(-) >
From: Ionut Nechita <ionut_n2001@yahoo.com>
Use the existing HID_UP_ASUSVENDOR constant instead of the magic number
0xff310000 for better code clarity and maintainability.
Change-Id: I65cf58cd0cd47acc39b755fa9a5fb7f2ad271046
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
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 472bca54642b9..eb14b9d13823b 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -317,7 +317,7 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, 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) == 0xff310000 &&
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR &&
(usage->hid & HID_USAGE) != 0x00 &&
(usage->hid & HID_USAGE) != 0xff && !usage->type) {
hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
--
2.52.0
On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> Use the existing HID_UP_ASUSVENDOR constant instead of the magic number
> 0xff310000 for better code clarity and maintainability.
>
> Change-Id: I65cf58cd0cd47acc39b755fa9a5fb7f2ad271046
Reviewed-by: Denis Benato <benato.denis96@gmail.com>
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
> ---
> 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 472bca54642b9..eb14b9d13823b 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -317,7 +317,7 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, 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) == 0xff310000 &&
> + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR &&
> (usage->hid & HID_USAGE) != 0x00 &&
> (usage->hid & HID_USAGE) != 0xff && !usage->type) {
> hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
On 1/7/26 7:00 AM, Denis Benato wrote:
>
> On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
>> From: Ionut Nechita <ionut_n2001@yahoo.com>
>>
>> Use the existing HID_UP_ASUSVENDOR constant instead of the magic number
>> 0xff310000 for better code clarity and maintainability.
>>
>> Change-Id: I65cf58cd0cd47acc39b755fa9a5fb7f2ad271046
Please strip change-id.
Otherwise LGTM and add to next version:
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> Reviewed-by: Denis Benato <benato.denis96@gmail.com>
>> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
>> ---
>> 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 472bca54642b9..eb14b9d13823b 100644
>> --- a/drivers/hid/hid-asus.c
>> +++ b/drivers/hid/hid-asus.c
>> @@ -317,7 +317,7 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, 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) == 0xff310000 &&
>> + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_ASUSVENDOR &&
>> (usage->hid & HID_USAGE) != 0x00 &&
>> (usage->hid & HID_USAGE) != 0xff && !usage->type) {
>> hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
From: Ionut Nechita <ionut_n2001@yahoo.com>
On Asus ROG G14 and G15 laptops, several HID vendor usage codes (0xea,
0xec, 0x02, 0x8a, 0x9e) are sent during normal operation without a clear
purpose, generating unwanted "Unmapped Asus vendor usagepage code"
warnings in dmesg.
Add definitions for these codes and filter them out in asus_raw_event()
to prevent kernel log spam.
Tested on Asus ROG G14/G15 series laptops.
Change-Id: I3f3b3a1e1698c8689e4c57582635435bfeda5990
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
drivers/hid/hid-asus.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index eb14b9d13823b..06cd3d3b74af7 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -57,6 +57,13 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
#define ROG_ALLY_X_MIN_MCU 313
#define ROG_ALLY_MIN_MCU 319
+/* Spurious HID codes sent by QUIRK_ROG_NKEY_KEYBOARD devices */
+#define ASUS_SPURIOUS_CODE_0XEA 0xea
+#define ASUS_SPURIOUS_CODE_0XEC 0xec
+#define ASUS_SPURIOUS_CODE_0X02 0x02
+#define ASUS_SPURIOUS_CODE_0X8A 0x8a
+#define ASUS_SPURIOUS_CODE_0X9E 0x9e
+
#define SUPPORT_KBD_BACKLIGHT BIT(0)
#define MAX_TOUCH_MAJOR 8
@@ -348,6 +355,21 @@ static int asus_raw_event(struct hid_device *hdev,
if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
return -1;
if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ /*
+ * G14 and G15 send these codes on some keypresses with no
+ * discernable reason for doing so. Filter them out to avoid
+ * unmapped warning messages.
+ */
+ if (report->id == FEATURE_KBD_REPORT_ID) {
+ if (data[1] == ASUS_SPURIOUS_CODE_0XEA ||
+ data[1] == ASUS_SPURIOUS_CODE_0XEC ||
+ data[1] == ASUS_SPURIOUS_CODE_0X02 ||
+ data[1] == ASUS_SPURIOUS_CODE_0X8A ||
+ data[1] == ASUS_SPURIOUS_CODE_0X9E) {
+ return -1;
+ }
+ }
+
/*
* G713 and G733 send these codes on some keypresses, depending on
* the key pressed it can trigger a shutdown event if not caught.
--
2.52.0
On 1/7/26 5:19 AM, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> On Asus ROG G14 and G15 laptops, several HID vendor usage codes (0xea,
> 0xec, 0x02, 0x8a, 0x9e) are sent during normal operation without a clear
> purpose, generating unwanted "Unmapped Asus vendor usagepage code"
> warnings in dmesg.
>
> Add definitions for these codes and filter them out in asus_raw_event()
> to prevent kernel log spam.
>
> Tested on Asus ROG G14/G15 series laptops.
>
> Change-Id: I3f3b3a1e1698c8689e4c57582635435bfeda5990
Please strip Change-Id when sending patches to LKML.
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
Otherwise LGTM, feel free to add to next version.
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> drivers/hid/hid-asus.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index eb14b9d13823b..06cd3d3b74af7 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -57,6 +57,13 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
> #define ROG_ALLY_X_MIN_MCU 313
> #define ROG_ALLY_MIN_MCU 319
>
> +/* Spurious HID codes sent by QUIRK_ROG_NKEY_KEYBOARD devices */
> +#define ASUS_SPURIOUS_CODE_0XEA 0xea
> +#define ASUS_SPURIOUS_CODE_0XEC 0xec
> +#define ASUS_SPURIOUS_CODE_0X02 0x02
> +#define ASUS_SPURIOUS_CODE_0X8A 0x8a
> +#define ASUS_SPURIOUS_CODE_0X9E 0x9e
> +
> #define SUPPORT_KBD_BACKLIGHT BIT(0)
>
> #define MAX_TOUCH_MAJOR 8
> @@ -348,6 +355,21 @@ static int asus_raw_event(struct hid_device *hdev,
> if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
> return -1;
> if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
> + /*
> + * G14 and G15 send these codes on some keypresses with no
> + * discernable reason for doing so. Filter them out to avoid
> + * unmapped warning messages.
> + */
> + if (report->id == FEATURE_KBD_REPORT_ID) {
> + if (data[1] == ASUS_SPURIOUS_CODE_0XEA ||
> + data[1] == ASUS_SPURIOUS_CODE_0XEC ||
> + data[1] == ASUS_SPURIOUS_CODE_0X02 ||
> + data[1] == ASUS_SPURIOUS_CODE_0X8A ||
> + data[1] == ASUS_SPURIOUS_CODE_0X9E) {
> + return -1;
> + }
> + }
> +
> /*
> * G713 and G733 send these codes on some keypresses, depending on
> * the key pressed it can trigger a shutdown event if not caught.
On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> On Asus ROG G14 and G15 laptops, several HID vendor usage codes (0xea,
> 0xec, 0x02, 0x8a, 0x9e) are sent during normal operation without a clear
> purpose, generating unwanted "Unmapped Asus vendor usagepage code"
> warnings in dmesg.
>
> Add definitions for these codes and filter them out in asus_raw_event()
> to prevent kernel log spam.
>
> Tested on Asus ROG G14/G15 series laptops.
>
> Change-Id: I3f3b3a1e1698c8689e4c57582635435bfeda5990
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
Reviewed-by: Denis Benato <benato.denis96@gmail.com>
> ---
> drivers/hid/hid-asus.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index eb14b9d13823b..06cd3d3b74af7 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -57,6 +57,13 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
> #define ROG_ALLY_X_MIN_MCU 313
> #define ROG_ALLY_MIN_MCU 319
>
> +/* Spurious HID codes sent by QUIRK_ROG_NKEY_KEYBOARD devices */
> +#define ASUS_SPURIOUS_CODE_0XEA 0xea
> +#define ASUS_SPURIOUS_CODE_0XEC 0xec
> +#define ASUS_SPURIOUS_CODE_0X02 0x02
> +#define ASUS_SPURIOUS_CODE_0X8A 0x8a
> +#define ASUS_SPURIOUS_CODE_0X9E 0x9e
> +
I don't know what's the preferred way to call these, I am happy
with any way.
> #define SUPPORT_KBD_BACKLIGHT BIT(0)
>
> #define MAX_TOUCH_MAJOR 8
> @@ -348,6 +355,21 @@ static int asus_raw_event(struct hid_device *hdev,
> if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
> return -1;
> if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
> + /*
> + * G14 and G15 send these codes on some keypresses with no
> + * discernable reason for doing so. Filter them out to avoid
> + * unmapped warning messages.
> + */
Pretty much all ASUS laptops do, not just G14 or G15, and it's not
only on keypresses.
> + if (report->id == FEATURE_KBD_REPORT_ID) {
> + if (data[1] == ASUS_SPURIOUS_CODE_0XEA ||
> + data[1] == ASUS_SPURIOUS_CODE_0XEC ||
> + data[1] == ASUS_SPURIOUS_CODE_0X02 ||
> + data[1] == ASUS_SPURIOUS_CODE_0X8A ||
> + data[1] == ASUS_SPURIOUS_CODE_0X9E) {
> + return -1;
> + }
> + }
> +
> /*
> * G713 and G733 send these codes on some keypresses, depending on
> * the key pressed it can trigger a shutdown event if not caught.
From: Ionut Nechita <ionut_n2001@yahoo.com>
Add the infrastructure needed for the HID driver to communicate with
the asus-wmi driver:
- Add linux/acpi.h include (in alphabetical order)
- Define ASUS_WMI_METHODID_NOTIF method ID in asus-wmi.h
- Implement asus_wmi_send_event() function to send events to asus-wmi
This infrastructure will be used to handle special keys that require
WMI communication.
Change-Id: Ic4d9b35f8b1f2b48c7c26e7259b4d05951021b58
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
drivers/hid/hid-asus.c | 24 ++++++++++++++++++++++
include/linux/platform_data/x86/asus-wmi.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 06cd3d3b74af7..05fa35489258d 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -23,6 +23,7 @@
/*
*/
+#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/hid.h>
#include <linux/module.h>
@@ -321,6 +322,29 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
return 0;
}
+/*
+ * Send events to asus-wmi driver for handling special keys
+ */
+static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
+{
+ int err;
+ u32 retval;
+
+ err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
+ ASUS_WMI_METHODID_NOTIF, code, &retval);
+ if (err) {
+ pr_warn("Failed to notify asus-wmi: %d\n", err);
+ return err;
+ }
+
+ if (retval != 0) {
+ pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
+ return -EIO;
+ }
+
+ return 0;
+}
+
static int asus_event(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index 419491d4abca1..516538b5a527e 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -29,6 +29,7 @@
#define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
#define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
#define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
+#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method */
#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
--
2.52.0
On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> Add the infrastructure needed for the HID driver to communicate with
> the asus-wmi driver:
>
> - Add linux/acpi.h include (in alphabetical order)
Mentioning the addition of acpi.h seems a bit too specific
for a commit message, but wait for hid maintainers to
tell.
> - Define ASUS_WMI_METHODID_NOTIF method ID in asus-wmi.h
> - Implement asus_wmi_send_event() function to send events to asus-wmi
>
> This infrastructure will be used to handle special keys that require
> WMI communication.
>
> Change-Id: Ic4d9b35f8b1f2b48c7c26e7259b4d05951021b58
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
> ---
> drivers/hid/hid-asus.c | 24 ++++++++++++++++++++++
> include/linux/platform_data/x86/asus-wmi.h | 1 +
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 06cd3d3b74af7..05fa35489258d 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -23,6 +23,7 @@
> /*
> */
>
> +#include <linux/acpi.h>
> #include <linux/dmi.h>
> #include <linux/hid.h>
> #include <linux/module.h>
> @@ -321,6 +322,29 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
> return 0;
> }
>
> +/*
> + * Send events to asus-wmi driver for handling special keys
> + */
> +static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
> +{
> + int err;
> + u32 retval;
> +
> + err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
> + ASUS_WMI_METHODID_NOTIF, code, &retval);
This code is based on the fact asus-wmi driver is available:
are you sure this doesn't make the kernel compilation fail
if such driver is not enabled?
> + if (err) {
> + pr_warn("Failed to notify asus-wmi: %d\n", err);
> + return err;
> + }
> +
> + if (retval != 0) {
> + pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
> + return -EIO;
> + }
> +
> + return 0;
> +}
> +
> static int asus_event(struct hid_device *hdev, struct hid_field *field,
> struct hid_usage *usage, __s32 value)
> {
> diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
> index 419491d4abca1..516538b5a527e 100644
> --- a/include/linux/platform_data/x86/asus-wmi.h
> +++ b/include/linux/platform_data/x86/asus-wmi.h
> @@ -29,6 +29,7 @@
> #define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
> #define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
> #define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
> +#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method */
>
> #define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
>
On 1/7/26 7:07 AM, Denis Benato wrote:
>
> On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
>> From: Ionut Nechita <ionut_n2001@yahoo.com>
>>
>> Add the infrastructure needed for the HID driver to communicate with
>> the asus-wmi driver:
>>
>> - Add linux/acpi.h include (in alphabetical order)
> Mentioning the addition of acpi.h seems a bit too specific
> for a commit message, but wait for hid maintainers to
> tell.
>> - Define ASUS_WMI_METHODID_NOTIF method ID in asus-wmi.h
>> - Implement asus_wmi_send_event() function to send events to asus-wmi
>>
>> This infrastructure will be used to handle special keys that require
>> WMI communication.
>>
>> Change-Id: Ic4d9b35f8b1f2b48c7c26e7259b4d05951021b58
>> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
>> ---
>> drivers/hid/hid-asus.c | 24 ++++++++++++++++++++++
>> include/linux/platform_data/x86/asus-wmi.h | 1 +
>> 2 files changed, 25 insertions(+)
>>
>> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
>> index 06cd3d3b74af7..05fa35489258d 100644
>> --- a/drivers/hid/hid-asus.c
>> +++ b/drivers/hid/hid-asus.c
>> @@ -23,6 +23,7 @@
>> /*
>> */
>>
>> +#include <linux/acpi.h>
>> #include <linux/dmi.h>
>> #include <linux/hid.h>
>> #include <linux/module.h>
>> @@ -321,6 +322,29 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
>> return 0;
>> }
>>
>> +/*
>> + * Send events to asus-wmi driver for handling special keys
>> + */
>> +static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
>> +{
>> + int err;
>> + u32 retval;
>> +
>> + err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
>> + ASUS_WMI_METHODID_NOTIF, code, &retval);
> This code is based on the fact asus-wmi driver is available:
> are you sure this doesn't make the kernel compilation fail
> if such driver is not enabled?
asus-wmi.h has conditional behavior already:
#if IS_REACHABLE(CONFIG_ASUS_WMI)
>> + if (err) {
>> + pr_warn("Failed to notify asus-wmi: %d\n", err);
>> + return err;
>> + }
>> +
>> + if (retval != 0) {
>> + pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
>> + return -EIO;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> static int asus_event(struct hid_device *hdev, struct hid_field *field,
>> struct hid_usage *usage, __s32 value)
>> {
>> diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
>> index 419491d4abca1..516538b5a527e 100644
>> --- a/include/linux/platform_data/x86/asus-wmi.h
>> +++ b/include/linux/platform_data/x86/asus-wmi.h
>> @@ -29,6 +29,7 @@
>> #define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
>> #define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
>> #define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
>> +#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method */
>>
>> #define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
>>
On 1/7/26 16:14, Mario Limonciello wrote:
> On 1/7/26 7:07 AM, Denis Benato wrote:
>>
>> On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
>>> From: Ionut Nechita <ionut_n2001@yahoo.com>
>>>
>>> Add the infrastructure needed for the HID driver to communicate with
>>> the asus-wmi driver:
>>>
>>> - Add linux/acpi.h include (in alphabetical order)
>> Mentioning the addition of acpi.h seems a bit too specific
>> for a commit message, but wait for hid maintainers to
>> tell.
>>> - Define ASUS_WMI_METHODID_NOTIF method ID in asus-wmi.h
>>> - Implement asus_wmi_send_event() function to send events to asus-wmi
>>>
>>> This infrastructure will be used to handle special keys that require
>>> WMI communication.
>>>
>>> Change-Id: Ic4d9b35f8b1f2b48c7c26e7259b4d05951021b58
>>> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
>>> ---
>>> drivers/hid/hid-asus.c | 24 ++++++++++++++++++++++
>>> include/linux/platform_data/x86/asus-wmi.h | 1 +
>>> 2 files changed, 25 insertions(+)
>>>
>>> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
>>> index 06cd3d3b74af7..05fa35489258d 100644
>>> --- a/drivers/hid/hid-asus.c
>>> +++ b/drivers/hid/hid-asus.c
>>> @@ -23,6 +23,7 @@
>>> /*
>>> */
>>> +#include <linux/acpi.h>
>>> #include <linux/dmi.h>
>>> #include <linux/hid.h>
>>> #include <linux/module.h>
>>> @@ -321,6 +322,29 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
>>> return 0;
>>> }
>>> +/*
>>> + * Send events to asus-wmi driver for handling special keys
>>> + */
>>> +static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
>>> +{
>>> + int err;
>>> + u32 retval;
>>> +
>>> + err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
>>> + ASUS_WMI_METHODID_NOTIF, code, &retval);
>> This code is based on the fact asus-wmi driver is available:
>> are you sure this doesn't make the kernel compilation fail
>> if such driver is not enabled?
>
> asus-wmi.h has conditional behavior already:
>
> #if IS_REACHABLE(CONFIG_ASUS_WMI)
>
Ah yes I missed that.
Reviewed-by: Denis Benato <benato.denis96@gmail.com>
>>> + if (err) {
>>> + pr_warn("Failed to notify asus-wmi: %d\n", err);
>>> + return err;
>>> + }
>>> +
>>> + if (retval != 0) {
>>> + pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
>>> + return -EIO;
>>> + }
>>> +
>>> + return 0;
>>> +}
>>> +
>>> static int asus_event(struct hid_device *hdev, struct hid_field *field,
>>> struct hid_usage *usage, __s32 value)
>>> {
>>> diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
>>> index 419491d4abca1..516538b5a527e 100644
>>> --- a/include/linux/platform_data/x86/asus-wmi.h
>>> +++ b/include/linux/platform_data/x86/asus-wmi.h
>>> @@ -29,6 +29,7 @@
>>> #define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
>>> #define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
>>> #define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
>>> +#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method */
>>> #define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
>>>
>
From: Ionut Nechita <ionut_n2001@yahoo.com>
On Asus ROG laptops, the Fn+F5 key (HID code 0xae) is used to cycle
through fan modes. This key press needs to be forwarded to the asus-wmi
driver to actually change the fan mode.
Add ASUS_FAN_CTRL_KEY_CODE define and implement the handler in
asus_raw_event() to send WMI events when this key is pressed.
Tested on Asus ROG G14/G15 series laptops.
Change-Id: Ic03df877b71e34c421e992a06e5e706d954e7dbf
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
---
drivers/hid/hid-asus.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 05fa35489258d..d93c8f030b239 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -65,6 +65,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
#define ASUS_SPURIOUS_CODE_0X8A 0x8a
#define ASUS_SPURIOUS_CODE_0X9E 0x9e
+/* Special key codes */
+#define ASUS_FAN_CTRL_KEY_CODE 0xae
+
#define SUPPORT_KBD_BACKLIGHT BIT(0)
#define MAX_TOUCH_MAJOR 8
@@ -379,12 +382,21 @@ static int asus_raw_event(struct hid_device *hdev,
if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
return -1;
if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
- /*
- * G14 and G15 send these codes on some keypresses with no
- * discernable reason for doing so. Filter them out to avoid
- * unmapped warning messages.
- */
if (report->id == FEATURE_KBD_REPORT_ID) {
+ /* Fn+F5 fan control key, send WMI event to toggle fan mode */
+ if (data[1] == ASUS_FAN_CTRL_KEY_CODE) {
+ int ret = asus_wmi_send_event(drvdata, ASUS_FAN_CTRL_KEY_CODE);
+
+ if (ret < 0)
+ hid_warn(hdev, "Failed to trigger fan control event\n");
+ return -1;
+ }
+
+ /*
+ * G14 and G15 send these codes on some keypresses with no
+ * discernable reason for doing so. Filter them out to avoid
+ * unmapped warning messages.
+ */
if (data[1] == ASUS_SPURIOUS_CODE_0XEA ||
data[1] == ASUS_SPURIOUS_CODE_0XEC ||
data[1] == ASUS_SPURIOUS_CODE_0X02 ||
--
2.52.0
On 1/7/26 12:19, Ionut Nechita (Sunlight Linux) wrote:
> From: Ionut Nechita <ionut_n2001@yahoo.com>
>
> On Asus ROG laptops, the Fn+F5 key (HID code 0xae) is used to cycle
> through fan modes. This key press needs to be forwarded to the asus-wmi
> driver to actually change the fan mode.
>
> Add ASUS_FAN_CTRL_KEY_CODE define and implement the handler in
> asus_raw_event() to send WMI events when this key is pressed.
>
> Tested on Asus ROG G14/G15 series laptops.
>
> Change-Id: Ic03df877b71e34c421e992a06e5e706d954e7dbf
> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
> ---
> drivers/hid/hid-asus.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 05fa35489258d..d93c8f030b239 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -65,6 +65,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
> #define ASUS_SPURIOUS_CODE_0X8A 0x8a
> #define ASUS_SPURIOUS_CODE_0X9E 0x9e
>
> +/* Special key codes */
> +#define ASUS_FAN_CTRL_KEY_CODE 0xae
> +
> #define SUPPORT_KBD_BACKLIGHT BIT(0)
>
> #define MAX_TOUCH_MAJOR 8
> @@ -379,12 +382,21 @@ static int asus_raw_event(struct hid_device *hdev,
> if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
> return -1;
> if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
> - /*
> - * G14 and G15 send these codes on some keypresses with no
> - * discernable reason for doing so. Filter them out to avoid
> - * unmapped warning messages.
> - */
> if (report->id == FEATURE_KBD_REPORT_ID) {
> + /* Fn+F5 fan control key, send WMI event to toggle fan mode */
> + if (data[1] == ASUS_FAN_CTRL_KEY_CODE) {
> + int ret = asus_wmi_send_event(drvdata, ASUS_FAN_CTRL_KEY_CODE);
> +
What if asus-wmi is not compiled with the kernel?
Would it make sense, in that situation (or in case of a failure)
to tell userspace (via evdev) about the button press?
> + if (ret < 0)
> + hid_warn(hdev, "Failed to trigger fan control event\n");
> + return -1;
> + }
> +
> + /*
> + * G14 and G15 send these codes on some keypresses with no
> + * discernable reason for doing so. Filter them out to avoid
> + * unmapped warning messages.
> + */
> if (data[1] == ASUS_SPURIOUS_CODE_0XEA ||
> data[1] == ASUS_SPURIOUS_CODE_0XEC ||
> data[1] == ASUS_SPURIOUS_CODE_0X02 ||
© 2016 - 2026 Red Hat, Inc.