diff options
Diffstat (limited to 'SOURCES/v10-0002-HID-asus-make-asus_kbd_init-generic-remove-rog_n.patch')
-rw-r--r-- | SOURCES/v10-0002-HID-asus-make-asus_kbd_init-generic-remove-rog_n.patch | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/SOURCES/v10-0002-HID-asus-make-asus_kbd_init-generic-remove-rog_n.patch b/SOURCES/v10-0002-HID-asus-make-asus_kbd_init-generic-remove-rog_n.patch new file mode 100644 index 0000000..e4fb261 --- /dev/null +++ b/SOURCES/v10-0002-HID-asus-make-asus_kbd_init-generic-remove-rog_n.patch @@ -0,0 +1,130 @@ +From 119615a0034ee5f8d7a949c1c9d992b1be125fcb Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sat, 2 Dec 2023 17:47:59 +1300 +Subject: [PATCH v10 2/4] HID: asus: make asus_kbd_init() generic, remove + rog_nkey_led_init() + +Some of the n-key stuff is old and outdated, so +make asus_kbd_init() generic to use with other +report ID and remove rog_nkey_led_init(). + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + drivers/hid/hid-asus.c | 70 +++++++++++------------------------------- + 1 file changed, 18 insertions(+), 52 deletions(-) + +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index 855972a4470f..cdd998a761fe 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -1076,9 +1076,9 @@ + return ret; + } + +-static int asus_kbd_init(struct hid_device *hdev) ++static int asus_kbd_init(struct hid_device *hdev, u8 report_id) + { +- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, ++ const u8 buf[] = { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54, + 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; + int ret; + +@@ -1090,9 +1090,10 @@ + } + + static int asus_kbd_get_functions(struct hid_device *hdev, +- unsigned char *kbd_func) ++ unsigned char *kbd_func, ++ u8 report_id) + { +- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }; ++ u8 buf[] = { report_id, 0x05, 0x20, 0x31, 0x00, 0x08 }; + u8 *readbuf; + int ret; + +@@ -1121,51 +1122,6 @@ + return ret; + } + +-static int rog_nkey_led_init(struct hid_device *hdev) +-{ +- u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 }; +- u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20, +- 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 }; +- u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1, +- 0x05, 0x20, 0x31, 0x00, 0x08 }; +- int ret; +- +- hid_info(hdev, "Asus initialise N-KEY Device"); +- /* The first message is an init start */ +- ret = asus_kbd_set_report(hdev, buf_init_start, sizeof(buf_init_start)); +- if (ret < 0) { +- hid_warn(hdev, "Asus failed to send init start command: %d\n", ret); +- return ret; +- } +- /* Followed by a string */ +- ret = asus_kbd_set_report(hdev, buf_init2, sizeof(buf_init2)); +- if (ret < 0) { +- hid_warn(hdev, "Asus failed to send init command 1.0: %d\n", ret); +- return ret; +- } +- /* Followed by a string */ +- ret = asus_kbd_set_report(hdev, buf_init3, sizeof(buf_init3)); +- if (ret < 0) { +- hid_warn(hdev, "Asus failed to send init command 1.1: %d\n", ret); +- return ret; +- } +- +- /* begin second report ID with same data */ +- buf_init2[0] = FEATURE_KBD_LED_REPORT_ID2; +- buf_init3[0] = FEATURE_KBD_LED_REPORT_ID2; +- +- ret = asus_kbd_set_report(hdev, buf_init2, sizeof(buf_init2)); +- if (ret < 0) { +- hid_warn(hdev, "Asus failed to send init command 2.0: %d\n", ret); +- return ret; +- } +- ret = asus_kbd_set_report(hdev, buf_init3, sizeof(buf_init3)); +- if (ret < 0) +- hid_warn(hdev, "Asus failed to send init command 2.1: %d\n", ret); +- +- return ret; +-} +- + static void asus_schedule_work(struct asus_kbd_leds *led) + { + unsigned long flags; +@@ -1248,17 +1204,27 @@ + int ret; + + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { +- ret = rog_nkey_led_init(hdev); ++ /* Initialize keyboard */ ++ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); ++ if (ret < 0) ++ return ret; ++ ++ /* The LED endpoint is initialised in two HID */ ++ ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1); ++ if (ret < 0) ++ return ret; ++ ++ ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2); + if (ret < 0) + return ret; + } else { + /* Initialize keyboard */ +- ret = asus_kbd_init(hdev); ++ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); + if (ret < 0) + return ret; + + /* Get keyboard functions */ +- ret = asus_kbd_get_functions(hdev, &kbd_func); ++ ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); + if (ret < 0) + return ret; + +-- +2.41.0 + |