-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hid: topre: Add driver fixing report descriptor
[ Upstream commit a109d5c ] The Topre REALFORCE R2 firmware incorrectly reports that interface descriptor number 1, input report descriptor 2's events are array events rather than variable events. That particular report descriptor is used to report keypresses when there are more than 6 keys held at a time. This bug prevents events from this interface from being registered properly, so only 6 keypresses (from a different interface) can be registered at once, rather than full n-key rollover. This commit fixes the bug by setting the correct value in a report_fixup function. The original bug report can be found here: Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/804 Thanks to Benjamin Tissoires for diagnosing the issue with the report descriptor. Signed-off-by: Harry Stern <harry@harrystern.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20220911003614.297613-1-harry@harrystern.net Signed-off-by: Sasha Levin <sashal@kernel.org>
- Loading branch information
1 parent
1c59cee
commit 54fc410
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* HID driver for Topre REALFORCE Keyboards | ||
* | ||
* Copyright (c) 2022 Harry Stern <harry@harrystern.net> | ||
* | ||
* Based on the hid-macally driver | ||
*/ | ||
|
||
#include <linux/hid.h> | ||
#include <linux/module.h> | ||
|
||
#include "hid-ids.h" | ||
|
||
MODULE_AUTHOR("Harry Stern <harry@harrystern.net>"); | ||
MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver"); | ||
MODULE_LICENSE("GPL"); | ||
|
||
/* | ||
* Fix the REALFORCE R2's non-boot interface's report descriptor to match the | ||
* events it's actually sending. It claims to send array events but is instead | ||
* sending variable events. | ||
*/ | ||
static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
unsigned int *rsize) | ||
{ | ||
if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 && | ||
rdesc[71] == 0x81 && rdesc[72] == 0x00) { | ||
hid_info(hdev, | ||
"fixing up Topre REALFORCE keyboard report descriptor\n"); | ||
rdesc[72] = 0x02; | ||
} | ||
return rdesc; | ||
} | ||
|
||
static const struct hid_device_id topre_id_table[] = { | ||
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, | ||
USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(hid, topre_id_table); | ||
|
||
static struct hid_driver topre_driver = { | ||
.name = "topre", | ||
.id_table = topre_id_table, | ||
.report_fixup = topre_report_fixup, | ||
}; | ||
|
||
module_hid_driver(topre_driver); |