1
2
3
4
5
6
7
8
9
10
11
12#include <linux/hid.h>
13#include <linux/module.h>
14#include <linux/usb.h>
15
16#include "hid-ids.h"
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
33 unsigned int *rsize)
34{
35 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
36
37 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
38
39
40 switch (hdev->product) {
41 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067:
42 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072:
43 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2:
44 if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f
45 && rdesc[120] == 0xff && rdesc[121] == 0x7f) {
46 hid_info(hdev, "Fixing up report descriptor\n");
47 rdesc[116] = rdesc[121] = 0x2f;
48 }
49 break;
50 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A:
51 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070:
52 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081:
53 if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f
54 && rdesc[111] == 0xff && rdesc[112] == 0x7f) {
55 hid_info(hdev, "Fixing up report descriptor\n");
56 rdesc[107] = rdesc[112] = 0x2f;
57 }
58 break;
59 }
60
61 }
62 return rdesc;
63}
64
65static const struct hid_device_id holtek_mouse_devices[] = {
66 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
67 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
68 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
69 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A070) },
70 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
71 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
72 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
73 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) },
74 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
75 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
76 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
77 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) },
78 { }
79};
80MODULE_DEVICE_TABLE(hid, holtek_mouse_devices);
81
82static struct hid_driver holtek_mouse_driver = {
83 .name = "holtek_mouse",
84 .id_table = holtek_mouse_devices,
85 .report_fixup = holtek_mouse_report_fixup,
86};
87
88module_hid_driver(holtek_mouse_driver);
89MODULE_LICENSE("GPL");
90