Skip to content

Commit b0400ff

Browse files
committed
Merge branch 'for-6.1/topre' into for-linus
- Fix Topre REALFORCE R2 keyboard so it can send more than 6 keys at the time (Harry Stern)
2 parents 2f5b005 + a109d5c commit b0400ff

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

drivers/hid/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,12 @@ config HID_TOPSEED
10771077
Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic
10781078
CLLRCMCE remote control.
10791079

1080+
config HID_TOPRE
1081+
tristate "Topre REALFORCE keyboards"
1082+
depends on HID
1083+
help
1084+
Say Y for N-key rollover support on Topre REALFORCE R2 108 key keyboards.
1085+
10801086
config HID_THINGM
10811087
tristate "ThingM blink(1) USB RGB LED"
10821088
depends on LEDS_CLASS

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
123123
obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o hid-thrustmaster.o
124124
obj-$(CONFIG_HID_TIVO) += hid-tivo.o
125125
obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
126+
obj-$(CONFIG_HID_TOPRE) += hid-topre.o
126127
obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o
127128
obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o
128129
hid-uclogic-objs := hid-uclogic-core.o \

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,9 @@
12311231
#define USB_DEVICE_ID_TIVO_SLIDE 0x1201
12321232
#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203
12331233

1234+
#define USB_VENDOR_ID_TOPRE 0x0853
1235+
#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148
1236+
12341237
#define USB_VENDOR_ID_TOPSEED 0x0766
12351238
#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
12361239

drivers/hid/hid-topre.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* HID driver for Topre REALFORCE Keyboards
4+
*
5+
* Copyright (c) 2022 Harry Stern <[email protected]>
6+
*
7+
* Based on the hid-macally driver
8+
*/
9+
10+
#include <linux/hid.h>
11+
#include <linux/module.h>
12+
13+
#include "hid-ids.h"
14+
15+
MODULE_AUTHOR("Harry Stern <[email protected]>");
16+
MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver");
17+
MODULE_LICENSE("GPL");
18+
19+
/*
20+
* Fix the REALFORCE R2's non-boot interface's report descriptor to match the
21+
* events it's actually sending. It claims to send array events but is instead
22+
* sending variable events.
23+
*/
24+
static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,
25+
unsigned int *rsize)
26+
{
27+
if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 &&
28+
rdesc[71] == 0x81 && rdesc[72] == 0x00) {
29+
hid_info(hdev,
30+
"fixing up Topre REALFORCE keyboard report descriptor\n");
31+
rdesc[72] = 0x02;
32+
}
33+
return rdesc;
34+
}
35+
36+
static const struct hid_device_id topre_id_table[] = {
37+
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
38+
USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) },
39+
{ }
40+
};
41+
MODULE_DEVICE_TABLE(hid, topre_id_table);
42+
43+
static struct hid_driver topre_driver = {
44+
.name = "topre",
45+
.id_table = topre_id_table,
46+
.report_fixup = topre_report_fixup,
47+
};
48+
49+
module_hid_driver(topre_driver);

0 commit comments

Comments
 (0)