-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix-ms-mouse-scroll-3.3.0.patch
112 lines (107 loc) · 4.42 KB
/
fix-ms-mouse-scroll-3.3.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
diff -pru a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
--- a/drivers/hid/hid-core.c 2012-03-19 03:15:34.000000000 +0400
+++ b/drivers/hid/hid-core.c 2015-09-21 23:06:22.095629502 +0300
@@ -1473,6 +1473,8 @@ static const struct hid_device_id hid_ha
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_WIRELESS_MOUSE_KSERIES) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SCULPT_ERGONOMIC_MOUSE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
Only in b/drivers/hid: hid-core.c.orig
diff -pru a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
--- a/drivers/hid/hid-ids.h 2012-03-19 03:15:34.000000000 +0400
+++ b/drivers/hid/hid-ids.h 2015-09-21 23:01:19.288486255 +0300
@@ -514,6 +514,8 @@
#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730
#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c
+#define USB_DEVICE_ID_MS_WIRELESS_MOUSE_KSERIES 0x0745
+#define USB_DEVICE_ID_MS_SCULPT_ERGONOMIC_MOUSE 0x07a5
#define USB_VENDOR_ID_MOJO 0x8282
#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
Only in b/drivers/hid: hid-ids.h.orig
diff -pru a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
--- a/drivers/hid/hid-microsoft.c 2012-03-19 03:15:34.000000000 +0400
+++ b/drivers/hid/hid-microsoft.c 2015-09-21 23:07:11.816142941 +0300
@@ -29,6 +29,7 @@
#define MS_RDESC 0x08
#define MS_NOGET 0x10
#define MS_DUPLICATE_USAGES 0x20
+#define MS_VSCROLL 0x40
/*
* Microsoft Wireless Desktop Receiver (Model 1028) has
@@ -155,6 +156,51 @@ static int ms_event(struct hid_device *h
return 0;
}
+static bool check_vscroll_settings(struct hid_device *hdev)
+{
+ struct hid_report *report;
+ int ret;
+ __u8 feature_in[] = { 0x17, 0x00 };
+
+ report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x17];
+ if (!report)
+ return false;
+
+ ret = hdev->hid_get_raw_report(hdev, 0x17, feature_in,
+ sizeof(feature_in), HID_FEATURE_REPORT);
+ if (ret <= 0) {
+ hid_dbg(hdev, "Mouse unknown vertical scroll wheel mode, return value: %i\n", ret);
+ } else if (ret == 2 && feature_in[0] == 0x17 && feature_in[1] == 0x00) {
+ hid_info(hdev, "Mouse vertical scroll wheel setting is compatible with linux applications.\n");
+ } else if (ret == 2 && feature_in[0] == 0x17) {
+ hid_info(hdev, "Mouse vertical scroll wheel mode needs to be reset to work normally with linux applications.\n");
+ return true;
+ } else {
+ hid_dbg(hdev, "Mouse unknown vertical scroll wheel mode, return values: %i %X %X\n", ret, (int) feature_in[0], (int) feature_in[1]);
+ }
+ return false;
+}
+
+static bool reset_vscroll_settings(struct hid_device *hdev)
+{
+ struct hid_report *report;
+ int ret;
+ __u8 feature_out[] = { 0x17, 0x00 };
+
+ report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x17];
+ if (!report)
+ return false;
+
+ ret = hdev->hid_output_raw_report(hdev, feature_out, sizeof(feature_out), HID_FEATURE_REPORT);
+ if (ret == 2) {
+ hid_info(hdev, "Seem to have successfully reset mouse vertical scroll wheel settings.\n");
+ return true;
+ } else {
+ hid_dbg(hdev, "Unknown response from reseting vertical scroll wheel settings with mouse, value returned: %i\n", ret);
+ }
+ return false;
+}
+
static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
unsigned long quirks = id->driver_data;
@@ -178,6 +224,11 @@ static int ms_probe(struct hid_device *h
goto err_free;
}
+ if (quirks & MS_VSCROLL) {
+ if (check_vscroll_settings(hdev))
+ reset_vscroll_settings(hdev);
+ }
+
return 0;
err_free:
return ret;
@@ -198,6 +249,10 @@ static const struct hid_device_id ms_dev
.driver_data = MS_NOGET },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
.driver_data = MS_DUPLICATE_USAGES },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_WIRELESS_MOUSE_KSERIES),
+ .driver_data = MS_VSCROLL },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SCULPT_ERGONOMIC_MOUSE),
+ .driver_data = MS_VSCROLL },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
.driver_data = MS_PRESENTER },