]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: topre: Fix n-key rollover on Realforce R3S TKL boards
authorDaniel Brackenbury <daniel.brackenbury@gmail.com>
Wed, 29 Jan 2025 01:08:49 +0000 (20:08 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:16 +0000 (12:54 -0700)
[ Upstream commit 9271af9d846c7e49c8709b58d5853cb73c00b193 ]

Newer model R3* Topre Realforce keyboards share an issue with their older
R2 cousins where a report descriptor fixup is needed in order for n-key
rollover to work correctly, otherwise only 6-key rollover is available.
This patch adds some new hardware IDs for the R3S 87-key keyboard and
makes amendments to the existing hid-topre driver in order to change the
correct byte in the new model.

Signed-off-by: Daniel Brackenbury <daniel.brackenbury@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/Kconfig
drivers/hid/hid-ids.h
drivers/hid/hid-topre.c

index f8a56d6312425a2e4f2c466cfed43d2affdbea59..4500d7653b05eef89b2844ea4a8ef7c39e6b6ca0 100644 (file)
@@ -1154,7 +1154,8 @@ config HID_TOPRE
        tristate "Topre REALFORCE keyboards"
        depends on HID
        help
-         Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key keyboards.
+         Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key and
+          Topre REALFORCE R3S 87 key keyboards.
 
 config HID_THINGM
        tristate "ThingM blink(1) USB RGB LED"
index 6e8bcb1518bd7eff96b8d732e7fb71402890aa51..a957ebcbc667ae13dedf797564ac6d00b9ab0560 100644 (file)
 #define USB_VENDOR_ID_TOPRE                    0x0853
 #define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108                   0x0148
 #define USB_DEVICE_ID_TOPRE_REALFORCE_R2_87                    0x0146
+#define USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87                   0x0313
 
 #define USB_VENDOR_ID_TOPSEED          0x0766
 #define USB_DEVICE_ID_TOPSEED_CYBERLINK        0x0204
index 848361f6225df182fcb47c9ff83aa993f9b0fb0b..ccedf8721722ecf7914ada652fd2aeb11ec41e2d 100644 (file)
@@ -29,6 +29,11 @@ static const __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                hid_info(hdev,
                        "fixing up Topre REALFORCE keyboard report descriptor\n");
                rdesc[72] = 0x02;
+       } else if (*rsize >= 106 && rdesc[28] == 0x29 && rdesc[29] == 0xe7 &&
+                                   rdesc[30] == 0x81 && rdesc[31] == 0x00) {
+               hid_info(hdev,
+                       "fixing up Topre REALFORCE keyboard report descriptor\n");
+               rdesc[31] = 0x02;
        }
        return rdesc;
 }
@@ -38,6 +43,8 @@ static const struct hid_device_id topre_id_table[] = {
                         USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
                         USB_DEVICE_ID_TOPRE_REALFORCE_R2_87) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
+                        USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, topre_id_table);