public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support
@ 2026-02-16 17:55 Denis Benato
  2026-02-16 17:55 ` [PATCH 2/2] hid: asus: always fully initialize devices Denis Benato
  2026-02-27 13:11 ` [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Denis Benato @ 2026-02-16 17:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Benjamin Tissoires, Jiri Kosina, Luke D . Jones,
	Mateusz Schyboll, Denis Benato, Ilpo Järvinen, Denis Benato

XG mobile stations have the 0x5a endpoint and has to be initialized:
add them to hid-asus.

Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
 drivers/hid/hid-asus.c | 3 +++
 drivers/hid/hid-ids.h  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 1b9793f7c07e..52efbf75a994 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -1483,6 +1483,9 @@ static const struct hid_device_id asus_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X),
 	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_ROG_ALLY_XPAD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+	    USB_DEVICE_ID_ASUSTEK_XGM_2023),
+	},
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD),
 	  QUIRK_ROG_CLAYMORE_II_KEYBOARD },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3e299a30dcde..4ab7640b119a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -229,6 +229,7 @@
 #define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X		0x1b4c
 #define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD	0x196b
 #define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD	0x1869
+#define USB_DEVICE_ID_ASUSTEK_XGM_2023	0x1a9a
 
 #define USB_VENDOR_ID_ATEN		0x0557
 #define USB_DEVICE_ID_ATEN_UC100KM	0x2004
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] hid: asus: always fully initialize devices
  2026-02-16 17:55 [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Denis Benato
@ 2026-02-16 17:55 ` Denis Benato
  2026-02-27 13:11   ` Jiri Kosina
  2026-02-27 13:11 ` [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Jiri Kosina
  1 sibling, 1 reply; 4+ messages in thread
From: Denis Benato @ 2026-02-16 17:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-input, Benjamin Tissoires, Jiri Kosina, Luke D . Jones,
	Mateusz Schyboll, Denis Benato, Ilpo Järvinen, Denis Benato

ASUS has more devices other than laptop keyboards which needs
to be initializated: the init sequence is the same as keyboards.

ID1 and ID2 are USB report IDs that are correctly enumerated:
send init commands to all devices that supports those reports IDs.

Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
 drivers/hid/hid-asus.c | 46 ++++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 52efbf75a994..0a85b1ecdda6 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -102,7 +102,6 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define QUIRK_ROG_CLAYMORE_II_KEYBOARD BIT(12)
 #define QUIRK_ROG_ALLY_XPAD		BIT(13)
 #define QUIRK_HID_FN_LOCK		BIT(14)
-#define QUIRK_ROG_NKEY_ID1ID2_INIT		BIT(15)
 
 #define I2C_KEYBOARD_QUIRKS			(QUIRK_FIX_NOTEBOOK_REPORT | \
 						 QUIRK_NO_INIT_REPORTS | \
@@ -209,6 +208,12 @@ static const struct asus_touchpad_info medion_e1239t_tp = {
 	.report_size = 32 /* 2 byte header + 5 * 5 + 5 byte footer */,
 };
 
+static const u8 asus_report_id_init[] = {
+	FEATURE_KBD_REPORT_ID,
+	FEATURE_KBD_LED_REPORT_ID1,
+	FEATURE_KBD_LED_REPORT_ID2
+};
+
 static void asus_report_contact_down(struct asus_drvdata *drvdat,
 		int toolType, u8 *data)
 {
@@ -715,6 +720,21 @@ static void validate_mcu_fw_version(struct hid_device *hdev, int idProduct)
 	}
 }
 
+static bool asus_has_report_id(struct hid_device *hdev, u16 report_id)
+{
+	int t, f, u, err = 0;
+	struct hid_report *report;
+
+	for (t = HID_INPUT_REPORT; t <= HID_FEATURE_REPORT; t++) {
+		list_for_each_entry(report, &hdev->report_enum[t].report_list, list) {
+			if (report->id == report_id)
+				return true;
+		}
+	}
+
+	return false;
+}
+
 static int asus_kbd_register_leds(struct hid_device *hdev)
 {
 	struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
@@ -723,9 +743,9 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
 	unsigned char kbd_func;
 	int ret;
 
-	ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
-	if (ret < 0)
-		return ret;
+	/* Laptops keyboard backlight is always at 0x5a */
+	if (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID))
+		return -ENODEV;
 
 	/* Get keyboard functions */
 	ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
@@ -736,11 +756,6 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
 	if (!(kbd_func & SUPPORT_KBD_BACKLIGHT))
 		return -ENODEV;
 
-	if (drvdata->quirks & QUIRK_ROG_NKEY_ID1ID2_INIT) {
-		asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1);
-		asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2);
-	}
-
 	if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) {
 		ret = asus_kbd_disable_oobe(hdev);
 		if (ret < 0)
@@ -1287,6 +1302,15 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 	}
 
+	for (int r = 0; r < ARRAY_SIZE(asus_report_id_init); r++) {
+		if (asus_has_report_id(hdev, asus_report_id_init[r])) {
+			ret = asus_kbd_init(hdev, asus_report_id_init[r]);
+			if (ret < 0)
+				hid_warn(hdev, "Failed to initialize 0x%x: %d.\n",
+					 asus_report_id_init[r], ret);
+		}
+	}
+
 	if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) &&
 	    asus_kbd_register_leds(hdev))
 		hid_warn(hdev, "Failed to initialize backlight.\n");
@@ -1470,10 +1494,10 @@ static const struct hid_device_id asus_devices[] = {
 	  QUIRK_USE_KBD_BACKLIGHT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD),
-	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_ROG_NKEY_ID1ID2_INIT },
+	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
-	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_HID_FN_LOCK | QUIRK_ROG_NKEY_ID1ID2_INIT },
+	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_HID_FN_LOCK },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR),
 	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support
  2026-02-16 17:55 [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Denis Benato
  2026-02-16 17:55 ` [PATCH 2/2] hid: asus: always fully initialize devices Denis Benato
@ 2026-02-27 13:11 ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2026-02-27 13:11 UTC (permalink / raw)
  To: Denis Benato
  Cc: linux-kernel, linux-input, Benjamin Tissoires, Luke D . Jones,
	Mateusz Schyboll, Denis Benato, Ilpo Järvinen

On Mon, 16 Feb 2026, Denis Benato wrote:

> XG mobile stations have the 0x5a endpoint and has to be initialized:
> add them to hid-asus.

Applied to hid.git#for-7.0/upstream-fixes.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] hid: asus: always fully initialize devices
  2026-02-16 17:55 ` [PATCH 2/2] hid: asus: always fully initialize devices Denis Benato
@ 2026-02-27 13:11   ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2026-02-27 13:11 UTC (permalink / raw)
  To: Denis Benato
  Cc: linux-kernel, linux-input, Benjamin Tissoires, Luke D . Jones,
	Mateusz Schyboll, Denis Benato, Ilpo Järvinen

On Mon, 16 Feb 2026, Denis Benato wrote:

> ASUS has more devices other than laptop keyboards which needs
> to be initializated: the init sequence is the same as keyboards.
> 
> ID1 and ID2 are USB report IDs that are correctly enumerated:
> send init commands to all devices that supports those reports IDs.
> 
> Signed-off-by: Denis Benato <denis.benato@linux.dev>

Applied to hid.git#for-7.1/asus.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-27 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 17:55 [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Denis Benato
2026-02-16 17:55 ` [PATCH 2/2] hid: asus: always fully initialize devices Denis Benato
2026-02-27 13:11   ` Jiri Kosina
2026-02-27 13:11 ` [PATCH 1/2] hid: asus: add xg mobile 2023 external hardware support Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox