1 // SPDX-License-Identifier: GPL-2.0+
3 * HID driver for Topre REALFORCE Keyboards
5 * Copyright (c) 2022 Harry Stern <harry@harrystern.net>
7 * Based on the hid-macally driver
10 #include <linux/hid.h>
11 #include <linux/module.h>
15 MODULE_AUTHOR("Harry Stern <harry@harrystern.net>");
16 MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver");
17 MODULE_LICENSE("GPL");
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.
24 static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27 if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 &&
28 rdesc[71] == 0x81 && rdesc[72] == 0x00) {
30 "fixing up Topre REALFORCE keyboard report descriptor\n");
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) },
41 MODULE_DEVICE_TABLE(hid, topre_id_table);
43 static struct hid_driver topre_driver = {
45 .id_table = topre_id_table,
46 .report_fixup = topre_report_fixup,
49 module_hid_driver(topre_driver);