aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-microsoft.c
diff options
context:
space:
mode:
authorAri Savolainen <ari.m.savolainen@gmail.com>2011-07-11 14:42:52 -0400
committerJiri Kosina <jkosina@suse.cz>2011-07-12 04:31:56 -0400
commit23c10becdbc712de3fb35d0c7ec105a81d21f4c7 (patch)
tree2ce8e66c6509fbf449940e23f86d6c14824ec33a /drivers/hid/hid-microsoft.c
parent6be914f11db8e88d11b08d6c496624dbbd642d80 (diff)
HID: fix horizontal wheel for ms comfort mouse 4500
Microsoft comfort mouse 4500 report descriptor contains duplicate usages for horizontal wheel. This patch fixes the wrong mapping caused by that. Signed-off-by: Ari Savolainen <ari.m.savolainen@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-microsoft.c')
-rw-r--r--drivers/hid/hid-microsoft.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index df91791f88d3..e5c699b6c6f3 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -23,11 +23,12 @@
23 23
24#include "hid-ids.h" 24#include "hid-ids.h"
25 25
26#define MS_HIDINPUT 0x01 26#define MS_HIDINPUT 0x01
27#define MS_ERGONOMY 0x02 27#define MS_ERGONOMY 0x02
28#define MS_PRESENTER 0x04 28#define MS_PRESENTER 0x04
29#define MS_RDESC 0x08 29#define MS_RDESC 0x08
30#define MS_NOGET 0x10 30#define MS_NOGET 0x10
31#define MS_DUPLICATE_USAGES 0x20
31 32
32/* 33/*
33 * Microsoft Wireless Desktop Receiver (Model 1028) has 34 * Microsoft Wireless Desktop Receiver (Model 1028) has
@@ -109,6 +110,18 @@ static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi,
109 return 0; 110 return 0;
110} 111}
111 112
113static int ms_input_mapped(struct hid_device *hdev, struct hid_input *hi,
114 struct hid_field *field, struct hid_usage *usage,
115 unsigned long **bit, int *max)
116{
117 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
118
119 if (quirks & MS_DUPLICATE_USAGES)
120 clear_bit(usage->code, *bit);
121
122 return 0;
123}
124
112static int ms_event(struct hid_device *hdev, struct hid_field *field, 125static int ms_event(struct hid_device *hdev, struct hid_field *field,
113 struct hid_usage *usage, __s32 value) 126 struct hid_usage *usage, __s32 value)
114{ 127{
@@ -183,6 +196,8 @@ static const struct hid_device_id ms_devices[] = {
183 .driver_data = MS_ERGONOMY }, 196 .driver_data = MS_ERGONOMY },
184 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), 197 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0),
185 .driver_data = MS_NOGET }, 198 .driver_data = MS_NOGET },
199 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
200 .driver_data = MS_DUPLICATE_USAGES },
186 201
187 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), 202 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
188 .driver_data = MS_PRESENTER }, 203 .driver_data = MS_PRESENTER },
@@ -195,6 +210,7 @@ static struct hid_driver ms_driver = {
195 .id_table = ms_devices, 210 .id_table = ms_devices,
196 .report_fixup = ms_report_fixup, 211 .report_fixup = ms_report_fixup,
197 .input_mapping = ms_input_mapping, 212 .input_mapping = ms_input_mapping,
213 .input_mapped = ms_input_mapped,
198 .event = ms_event, 214 .event = ms_event,
199 .probe = ms_probe, 215 .probe = ms_probe,
200}; 216};