Skip to content

Commit baa1204

Browse files
Terry JungeJiri Kosina
authored andcommitted
HID: evision: Fix Report Descriptor for Evision Wireless Receiver 320f:226f
The mouse portion of the device's Report Descriptor declares 5 buttons but only declares 3 usages (Button 1 through Button 3). As a result events for the 2 side buttons are not generated. Detect and repair the Report Descriptor if necessary by changing the Usage Maximum value from Button 3 to Button 5. [jkosina@suse.com: standardize changelog a little bit] Reported-by: Artem <temabiill@gmail.com> Closes: https://lore.kernel.org/all/CADYkRmrfhRf6VmQjc+su+mepyv=TsHc+aMcL6ryRZ5HTZ8pyFg@mail.gmail.com/ Signed-off-by: Terry Junge <linuxhid@cosmicgizmosystems.com> Tested-by: Artem <temabiill@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 36dcfa4 commit baa1204

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/hid/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ config HID_EVISION
383383
help
384384
Support for some EVision keyboards. Note that this is needed only when
385385
applying customization using userspace programs.
386+
Support for some EVision devices requiring report descriptor fixups.
386387

387388
config HID_EZKEY
388389
tristate "Ezkey BTC 8193 keyboard"

drivers/hid/hid-evision.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ static int evision_input_mapping(struct hid_device *hdev, struct hid_input *hi,
1818
struct hid_field *field, struct hid_usage *usage,
1919
unsigned long **bit, int *max)
2020
{
21+
/* mapping only applies to USB_DEVICE_ID_EVISION_ICL01 */
22+
if (hdev->product != USB_DEVICE_ID_EVISION_ICL01)
23+
return 0;
24+
2125
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
2226
return 0;
2327

@@ -37,8 +41,24 @@ static int evision_input_mapping(struct hid_device *hdev, struct hid_input *hi,
3741
return 0;
3842
}
3943

44+
#define REP_DSC_SIZE 236
45+
#define USAGE_MAX_INDEX 59
46+
47+
static const __u8 *evision_report_fixup(struct hid_device *hdev, __u8 *rdesc,
48+
unsigned int *rsize)
49+
{
50+
if (hdev->product == USB_DEVICE_ID_EV_TELINK_RECEIVER &&
51+
*rsize == REP_DSC_SIZE && rdesc[USAGE_MAX_INDEX] == 0x29 &&
52+
rdesc[USAGE_MAX_INDEX + 1] == 3) {
53+
hid_info(hdev, "fixing EVision:TeLink Receiver report descriptor\n");
54+
rdesc[USAGE_MAX_INDEX + 1] = 5; // change usage max from 3 to 5
55+
}
56+
return rdesc;
57+
}
58+
4059
static const struct hid_device_id evision_devices[] = {
4160
{ HID_USB_DEVICE(USB_VENDOR_ID_EVISION, USB_DEVICE_ID_EVISION_ICL01) },
61+
{ HID_USB_DEVICE(USB_VENDOR_ID_EVISION, USB_DEVICE_ID_EV_TELINK_RECEIVER) },
4262
{ }
4363
};
4464
MODULE_DEVICE_TABLE(hid, evision_devices);
@@ -47,6 +67,7 @@ static struct hid_driver evision_driver = {
4767
.name = "evision",
4868
.id_table = evision_devices,
4969
.input_mapping = evision_input_mapping,
70+
.report_fixup = evision_report_fixup,
5071
};
5172
module_hid_driver(evision_driver);
5273

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@
477477
#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
478478

479479
#define USB_VENDOR_ID_EVISION 0x320f
480+
#define USB_DEVICE_ID_EV_TELINK_RECEIVER 0x226f
480481
#define USB_DEVICE_ID_EVISION_ICL01 0x5041
481482

482483
#define USB_VENDOR_ID_FFBEAST 0x045b

0 commit comments

Comments
 (0)