summaryrefslogtreecommitdiff
path: root/SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2024-02-11 20:00:26 +0100
committerJan200101 <sentrycraft123@gmail.com>2024-02-11 20:00:26 +0100
commitd163bd3d8fbc0666ca31afdcf152a2450f352753 (patch)
treea0c5e11a9a02ad1a2855ed0338d3187979ba9c77 /SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
parentb8d31e3c4edc6bb6fe7ce82505962e61882ad3d0 (diff)
downloadkernel-fsync-d163bd3d8fbc0666ca31afdcf152a2450f352753.tar.gz
kernel-fsync-d163bd3d8fbc0666ca31afdcf152a2450f352753.zip
kernel 6.7.4 rog ally patches update
Diffstat (limited to 'SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch')
-rw-r--r--SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch b/SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
new file mode 100644
index 0000000..3aa05b5
--- /dev/null
+++ b/SOURCES/v14.8-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
@@ -0,0 +1,89 @@
+From 5efbf21a6dc030b27e32cd632cfde1c3c7801075 Mon Sep 17 00:00:00 2001
+From: "Luke D. Jones" <luke@ljones.dev>
+Date: Sat, 2 Dec 2023 17:27:23 +1300
+Subject: [PATCH v14.7 1/4] HID: asus: fix more n-key report descriptors if
+ n-key quirked
+
+Adjusts the report descriptor for N-Key devices to
+make the output count 0x01 which completely avoids
+the need for a block of filtering.
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+---
+ drivers/hid/hid-asus.c | 49 ++++++++++++++++++++----------------------
+ 1 file changed, 23 insertions(+), 26 deletions(-)
+
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
+index 78cdfb8b9a7a..855972a4470f 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus.c
+@@ -335,36 +335,20 @@ static int asus_raw_event(struct hid_device *hdev,
+ if (drvdata->quirks & QUIRK_MEDION_E1239T)
+ return asus_e1239t_event(drvdata, data, size);
+
+- if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) {
++ /*
++ * Skip these report ID, the device emits a continuous stream associated
++ * with the AURA mode it is in which looks like an 'echo'.
++ */
++ if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
++ return -1;
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ /*
+- * Skip these report ID, the device emits a continuous stream associated
+- * with the AURA mode it is in which looks like an 'echo'.
++ * G713 and G733 send these codes on some keypresses, depending on
++ * the key pressed it can trigger a shutdown event if not caught.
+ */
+- if (report->id == FEATURE_KBD_LED_REPORT_ID1 ||
+- report->id == FEATURE_KBD_LED_REPORT_ID2) {
++ if(data[0] == 0x02 && data[1] == 0x30) {
+ return -1;
+- /* Additional report filtering */
+- } else if (report->id == FEATURE_KBD_REPORT_ID) {
+- /*
+- * 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.
+- */
+- if (data[1] == 0xea || data[1] == 0xec || data[1] == 0x02 ||
+- data[1] == 0x8a || data[1] == 0x9e) {
+- return -1;
+- }
+ }
+- if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+- /*
+- * G713 and G733 send these codes on some keypresses, depending on
+- * the key pressed it can trigger a shutdown event if not caught.
+- */
+- if(data[0] == 0x02 && data[1] == 0x30) {
+- return -1;
+- }
+- }
+-
+ }
+
+ if (drvdata->quirks & QUIRK_ROG_CLAYMORE_II_KEYBOARD) {
+@@ -1250,6 +1234,19 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ rdesc[205] = 0x01;
+ }
+
++ /* match many more n-key devices */
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
++ for (int i = 0; i < *rsize + 1; i++) {
++ /* offset to the count from 0x5a report part always 14 */
++ if (rdesc[i] == 0x85 && rdesc[i + 1] == 0x5a &&
++ rdesc[i + 14] == 0x95 && rdesc[i + 15] == 0x05) {
++ hid_info(hdev, "Fixing up Asus N-Key report descriptor\n");
++ rdesc[i + 15] = 0x01;
++ break;
++ }
++ }
++ }
++
+ return rdesc;
+ }
+
+--
+2.43.0
+