aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Makefile2
-rw-r--r--drivers/hid/hid-input-quirks.c326
-rw-r--r--drivers/hid/hid-input.c163
3 files changed, 336 insertions, 155 deletions
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 1ac5103f7c93..275dc522c738 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the HID driver 2# Makefile for the HID driver
3# 3#
4hid-objs := hid-core.o hid-input.o 4hid-objs := hid-core.o hid-input.o hid-input-quirks.o
5 5
6obj-$(CONFIG_HID) += hid.o 6obj-$(CONFIG_HID) += hid.o
7 7
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
new file mode 100644
index 000000000000..e05e9ad5522e
--- /dev/null
+++ b/drivers/hid/hid-input-quirks.c
@@ -0,0 +1,326 @@
1/*
2 * HID-input usage mapping quirks
3 *
4 * This is used to handle HID-input mappings for devices violating
5 * HUT 1.12 specification.
6 *
7 * Copyright (c) 2007 Jiri Kosina
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License
14 */
15
16#include <linux/input.h>
17#include <linux/hid.h>
18
19#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; *max = ABS_MAX; } while (0)
20#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; *max = REL_MAX; } while (0)
21#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; *max = KEY_MAX; } while (0)
22#define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; *max = LED_MAX; } while (0)
23
24#define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0)
25#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)
26
27static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input,
28 unsigned long *bit, int *max)
29{
30 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
31 return 0;
32
33 switch (usage->hid & HID_USAGE) {
34 case 0x03a: map_key_clear(KEY_SOUND); break;
35 case 0x03b: map_key_clear(KEY_CAMERA); break;
36 case 0x03c: map_key_clear(KEY_DOCUMENTS); break;
37 default:
38 return 0;
39 }
40 return 1;
41}
42
43static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *input,
44 unsigned long *bit, int *max)
45{
46 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
47 return 0;
48
49 switch (usage->hid & HID_USAGE) {
50 case 0x301: map_key_clear(KEY_PROG1); break;
51 case 0x302: map_key_clear(KEY_PROG2); break;
52 case 0x303: map_key_clear(KEY_PROG3); break;
53 default:
54 return 0;
55 }
56 return 1;
57}
58
59static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_dev *input,
60 unsigned long *bit, int *max)
61{
62 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
63 return 0;
64
65 set_bit(EV_REP, input->evbit);
66 switch(usage->hid & HID_USAGE) {
67 /* Reported on Logitech Ultra X Media Remote */
68 case 0x004: map_key_clear(KEY_AGAIN); break;
69 case 0x00d: map_key_clear(KEY_HOME); break;
70 case 0x024: map_key_clear(KEY_SHUFFLE); break;
71 case 0x025: map_key_clear(KEY_TV); break;
72 case 0x026: map_key_clear(KEY_MENU); break;
73 case 0x031: map_key_clear(KEY_AUDIO); break;
74 case 0x032: map_key_clear(KEY_TEXT); break;
75 case 0x033: map_key_clear(KEY_LAST); break;
76 case 0x047: map_key_clear(KEY_MP3); break;
77 case 0x048: map_key_clear(KEY_DVD); break;
78 case 0x049: map_key_clear(KEY_MEDIA); break;
79 case 0x04a: map_key_clear(KEY_VIDEO); break;
80 case 0x04b: map_key_clear(KEY_ANGLE); break;
81 case 0x04c: map_key_clear(KEY_LANGUAGE); break;
82 case 0x04d: map_key_clear(KEY_SUBTITLE); break;
83 case 0x051: map_key_clear(KEY_RED); break;
84 case 0x052: map_key_clear(KEY_CLOSE); break;
85
86 default:
87 return 0;
88 }
89 return 1;
90}
91
92static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev *input,
93 unsigned long *bit, int *max)
94{
95 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
96 return 0;
97
98 set_bit(EV_REP, input->evbit);
99 switch (usage->hid & HID_USAGE) {
100 case 0xff01: map_key_clear(BTN_1); break;
101 case 0xff02: map_key_clear(BTN_2); break;
102 case 0xff03: map_key_clear(BTN_3); break;
103 case 0xff04: map_key_clear(BTN_4); break;
104 case 0xff05: map_key_clear(BTN_5); break;
105 case 0xff06: map_key_clear(BTN_6); break;
106 case 0xff07: map_key_clear(BTN_7); break;
107 case 0xff08: map_key_clear(BTN_8); break;
108 case 0xff09: map_key_clear(BTN_9); break;
109 case 0xff0a: map_key_clear(BTN_A); break;
110 case 0xff0b: map_key_clear(BTN_B); break;
111 default:
112 return 0;
113 }
114 return 1;
115}
116
117static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev *input,
118 unsigned long *bit, int *max)
119{
120 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
121 return 0;
122
123 switch(usage->hid & HID_USAGE) {
124 case 0xfd06: map_key_clear(KEY_CHAT); break;
125 case 0xfd07: map_key_clear(KEY_PHONE); break;
126 case 0xff05:
127 set_bit(EV_REP, input->evbit);
128 map_key_clear(KEY_F13);
129 set_bit(KEY_F14, input->keybit);
130 set_bit(KEY_F15, input->keybit);
131 set_bit(KEY_F16, input->keybit);
132 set_bit(KEY_F17, input->keybit);
133 set_bit(KEY_F18, input->keybit);
134 default:
135 return 0;
136 }
137 return 1;
138}
139
140static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_dev *input,
141 unsigned long *bit, int *max)
142{
143 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
144 return 0;
145
146 set_bit(EV_REP, input->evbit);
147 switch(usage->hid & HID_USAGE) {
148 case 0xfd08: map_key_clear(KEY_RIGHT); break;
149 case 0xfd09: map_key_clear(KEY_LEFT); break;
150 case 0xfd0b: map_key_clear(KEY_PAUSE); break;
151 case 0xfd0f: map_key_clear(KEY_F5); break;
152 default:
153 return 0;
154 }
155 return 1;
156}
157
158static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *input,
159 unsigned long *bit, int *max)
160{
161 if (((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) &&
162 ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER))
163 return 0;
164
165 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR)
166 switch(usage->hid & HID_USAGE) {
167 case 0x05a: map_key_clear(KEY_TEXT); break;
168 case 0x05b: map_key_clear(KEY_RED); break;
169 case 0x05c: map_key_clear(KEY_GREEN); break;
170 case 0x05d: map_key_clear(KEY_YELLOW); break;
171 case 0x05e: map_key_clear(KEY_BLUE); break;
172 default:
173 return 0;
174 }
175
176 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
177 switch(usage->hid & HID_USAGE) {
178 case 0x0f6: map_key_clear(KEY_NEXT); break;
179 case 0x0fa: map_key_clear(KEY_BACK); break;
180 default:
181 return 0;
182 }
183 return 1;
184}
185
186static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *input,
187 unsigned long *bit, int *max)
188{
189 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
190 return 0;
191
192 switch (usage->hid & HID_USAGE) {
193 case 0x1001: map_key_clear(KEY_MESSENGER); break;
194 case 0x1003: map_key_clear(KEY_SOUND); break;
195 case 0x1004: map_key_clear(KEY_VIDEO); break;
196 case 0x1005: map_key_clear(KEY_AUDIO); break;
197 case 0x100a: map_key_clear(KEY_DOCUMENTS); break;
198 case 0x1011: map_key_clear(KEY_PREVIOUSSONG); break;
199 case 0x1012: map_key_clear(KEY_NEXTSONG); break;
200 case 0x1013: map_key_clear(KEY_CAMERA); break;
201 case 0x1014: map_key_clear(KEY_MESSENGER); break;
202 case 0x1015: map_key_clear(KEY_RECORD); break;
203 case 0x1016: map_key_clear(KEY_PLAYER); break;
204 case 0x1017: map_key_clear(KEY_EJECTCD); break;
205 case 0x1018: map_key_clear(KEY_MEDIA); break;
206 case 0x1019: map_key_clear(KEY_PROG1); break;
207 case 0x101a: map_key_clear(KEY_PROG2); break;
208 case 0x101b: map_key_clear(KEY_PROG3); break;
209 case 0x101f: map_key_clear(KEY_ZOOMIN); break;
210 case 0x1020: map_key_clear(KEY_ZOOMOUT); break;
211 case 0x1021: map_key_clear(KEY_ZOOMRESET); break;
212 case 0x1023: map_key_clear(KEY_CLOSE); break;
213 case 0x1027: map_key_clear(KEY_MENU); break;
214 /* this one is marked as 'Rotate' */
215 case 0x1028: map_key_clear(KEY_ANGLE); break;
216 case 0x1029: map_key_clear(KEY_SHUFFLE); break;
217 case 0x102a: map_key_clear(KEY_BACK); break;
218 case 0x102b: map_key_clear(KEY_CYCLEWINDOWS); break;
219 case 0x1041: map_key_clear(KEY_BATTERY); break;
220 case 0x1042: map_key_clear(KEY_WORDPROCESSOR); break;
221 case 0x1043: map_key_clear(KEY_SPREADSHEET); break;
222 case 0x1044: map_key_clear(KEY_PRESENTATION); break;
223 case 0x1045: map_key_clear(KEY_UNDO); break;
224 case 0x1046: map_key_clear(KEY_REDO); break;
225 case 0x1047: map_key_clear(KEY_PRINT); break;
226 case 0x1048: map_key_clear(KEY_SAVE); break;
227 case 0x1049: map_key_clear(KEY_PROG1); break;
228 case 0x104a: map_key_clear(KEY_PROG2); break;
229 case 0x104b: map_key_clear(KEY_PROG3); break;
230 case 0x104c: map_key_clear(KEY_PROG4); break;
231
232 default:
233 return 0;
234 }
235 return 1;
236}
237
238static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *input,
239 unsigned long *bit, int *max)
240{
241 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
242 return 0;
243
244 switch (usage->hid & HID_USAGE) {
245 case 0x156: map_key_clear(KEY_WORDPROCESSOR); break;
246 case 0x157: map_key_clear(KEY_SPREADSHEET); break;
247 case 0x158: map_key_clear(KEY_PRESENTATION); break;
248 case 0x15c: map_key_clear(KEY_STOP); break;
249
250 default:
251 return 0;
252 }
253 return 1;
254}
255
256
257#define VENDOR_ID_BELKIN 0x1020
258#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
259
260#define VENDOR_ID_CHERRY 0x046a
261#define DEVICE_ID_CHERRY_CYMOTION 0x0023
262
263#define VENDOR_ID_CHICONY 0x04f2
264#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
265
266#define VENDOR_ID_LOGITECH 0x046d
267#define DEVICE_ID_LOGITECH_RECEIVER 0xc101
268#define DEVICE_ID_S510_RECEIVER 0xc50c
269#define DEVICE_ID_S510_RECEIVER_2 0xc517
270#define DEVICE_ID_MX3000_RECEIVER 0xc513
271
272#define VENDOR_ID_MICROSOFT 0x045e
273#define DEVICE_ID_MS4K 0x00db
274#define DEVICE_ID_MS6K 0x00f9
275#define DEVICE_ID_MS_PRESENTER_8K 0x0713
276
277#define VENDOR_ID_MONTEREY 0x0566
278#define DEVICE_ID_GENIUS_KB29E 0x3004
279
280#define VENDOR_ID_PETALYNX 0x18b1
281#define DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
282
283static const struct hid_input_blacklist {
284 __u16 idVendor;
285 __u16 idProduct;
286 int (*quirk)(struct hid_usage *, struct input_dev *, unsigned long *, int *);
287} hid_input_blacklist[] = {
288 { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd },
289
290 { VENDOR_ID_CHERRY, DEVICE_ID_CHERRY_CYMOTION, quirk_cherry_cymotion },
291
292 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad },
293
294 { VENDOR_ID_LOGITECH, DEVICE_ID_LOGITECH_RECEIVER, quirk_logitech_ultrax_remote },
295 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER, quirk_logitech_wireless },
296 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER_2, quirk_logitech_wireless },
297 { VENDOR_ID_LOGITECH, DEVICE_ID_MX3000_RECEIVER, quirk_logitech_wireless },
298
299 { VENDOR_ID_MICROSOFT, DEVICE_ID_MS4K, quirk_microsoft_ergonomy_kb },
300 { VENDOR_ID_MICROSOFT, DEVICE_ID_MS6K, quirk_microsoft_ergonomy_kb },
301 { VENDOR_ID_MICROSOFT, DEVICE_ID_MS_PRESENTER_8K, quirk_microsoft_presenter_8k },
302
303 { VENDOR_ID_MONTEREY, DEVICE_ID_GENIUS_KB29E, quirk_cherry_genius_29e },
304
305 { VENDOR_ID_PETALYNX, DEVICE_ID_PETALYNX_MAXTER_REMOTE, quirk_petalynx_remote },
306
307 { 0, 0, 0 }
308};
309
310int hidinput_mapping_quirks(struct hid_usage *usage,
311 struct input_dev *input,
312 unsigned long *bit, int *max)
313{
314 struct hid_device *device = input_get_drvdata(input);
315 int i = 0;
316
317 while (hid_input_blacklist[i].quirk) {
318 if (hid_input_blacklist[i].idVendor == device->vendor &&
319 hid_input_blacklist[i].idProduct == device->product)
320 return hid_input_blacklist[i].quirk(usage, input, bit, max);
321 i++;
322 }
323 return 0;
324}
325EXPORT_SYMBOL_GPL(hidinput_mapping_quirks);
326
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 0da29cf43713..3d448037c82f 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -367,7 +367,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
367{ 367{
368 struct input_dev *input = hidinput->input; 368 struct input_dev *input = hidinput->input;
369 struct hid_device *device = input_get_drvdata(input); 369 struct hid_device *device = input_get_drvdata(input);
370 int max = 0, code; 370 int max = 0, code, ret;
371 unsigned long *bit = NULL; 371 unsigned long *bit = NULL;
372 372
373 field->hidinput = hidinput; 373 field->hidinput = hidinput;
@@ -386,6 +386,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
386 goto ignore; 386 goto ignore;
387 } 387 }
388 388
389 ret = hidinput_mapping_quirks(usage, input, bit, &max);
390 if (ret)
391 goto mapped;
392
389 switch (usage->hid & HID_USAGE_PAGE) { 393 switch (usage->hid & HID_USAGE_PAGE) {
390 394
391 case HID_UP_UNDEFINED: 395 case HID_UP_UNDEFINED:
@@ -573,14 +577,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
573 case 0x000: goto ignore; 577 case 0x000: goto ignore;
574 case 0x034: map_key_clear(KEY_SLEEP); break; 578 case 0x034: map_key_clear(KEY_SLEEP); break;
575 case 0x036: map_key_clear(BTN_MISC); break; 579 case 0x036: map_key_clear(BTN_MISC); break;
576 /*
577 * The next three are reported by Belkin wireless
578 * keyboard (1020:0006). These values are "reserved"
579 * in HUT 1.12.
580 */
581 case 0x03a: map_key_clear(KEY_SOUND); break;
582 case 0x03b: map_key_clear(KEY_CAMERA); break;
583 case 0x03c: map_key_clear(KEY_DOCUMENTS); break;
584 580
585 case 0x040: map_key_clear(KEY_MENU); break; 581 case 0x040: map_key_clear(KEY_MENU); break;
586 case 0x045: map_key_clear(KEY_RADIO); break; 582 case 0x045: map_key_clear(KEY_RADIO); break;
@@ -626,16 +622,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
626 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break; 622 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
627 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break; 623 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
628 624
629 /* reserved in HUT 1.12. Reported on Petalynx remote */
630 case 0x0f6: map_key_clear(KEY_NEXT); break;
631 case 0x0fa: map_key_clear(KEY_BACK); break;
632
633 /* reserved in HUT 1.12. Reported on Genius KB29E */
634 case 0x156: map_key_clear(KEY_WORDPROCESSOR); break;
635 case 0x157: map_key_clear(KEY_SPREADSHEET); break;
636 case 0x158: map_key_clear(KEY_PRESENTATION); break;
637 case 0x15c: map_key_clear(KEY_STOP); break;
638
639 case 0x182: map_key_clear(KEY_BOOKMARKS); break; 625 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
640 case 0x183: map_key_clear(KEY_CONFIG); break; 626 case 0x183: map_key_clear(KEY_CONFIG); break;
641 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break; 627 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
@@ -695,51 +681,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
695 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; 681 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
696 case 0x28c: map_key_clear(KEY_SEND); break; 682 case 0x28c: map_key_clear(KEY_SEND); break;
697 683
698 /* Reported on a Cherry Cymotion keyboard */
699 case 0x301: map_key_clear(KEY_PROG1); break;
700 case 0x302: map_key_clear(KEY_PROG2); break;
701 case 0x303: map_key_clear(KEY_PROG3); break;
702
703 /* Reported on certain Logitech wireless keyboards */
704 case 0x1001: map_key_clear(KEY_MESSENGER); break;
705 case 0x1003: map_key_clear(KEY_SOUND); break;
706 case 0x1004: map_key_clear(KEY_VIDEO); break;
707 case 0x1005: map_key_clear(KEY_AUDIO); break;
708 case 0x100a: map_key_clear(KEY_DOCUMENTS); break;
709 case 0x1011: map_key_clear(KEY_PREVIOUSSONG); break;
710 case 0x1012: map_key_clear(KEY_NEXTSONG); break;
711 case 0x1013: map_key_clear(KEY_CAMERA); break;
712 case 0x1014: map_key_clear(KEY_MESSENGER); break;
713 case 0x1015: map_key_clear(KEY_RECORD); break;
714 case 0x1016: map_key_clear(KEY_PLAYER); break;
715 case 0x1017: map_key_clear(KEY_EJECTCD); break;
716 case 0x1018: map_key_clear(KEY_MEDIA); break;
717 case 0x1019: map_key_clear(KEY_PROG1); break;
718 case 0x101a: map_key_clear(KEY_PROG2); break;
719 case 0x101b: map_key_clear(KEY_PROG3); break;
720 case 0x101f: map_key_clear(KEY_ZOOMIN); break;
721 case 0x1020: map_key_clear(KEY_ZOOMOUT); break;
722 case 0x1021: map_key_clear(KEY_ZOOMRESET); break;
723 case 0x1023: map_key_clear(KEY_CLOSE); break;
724 case 0x1027: map_key_clear(KEY_MENU); break;
725 /* this one is marked as 'Rotate' */
726 case 0x1028: map_key_clear(KEY_ANGLE); break;
727 case 0x1029: map_key_clear(KEY_SHUFFLE); break;
728 case 0x102a: map_key_clear(KEY_BACK); break;
729 case 0x102b: map_key_clear(KEY_CYCLEWINDOWS); break;
730 case 0x1041: map_key_clear(KEY_BATTERY); break;
731 case 0x1042: map_key_clear(KEY_WORDPROCESSOR); break;
732 case 0x1043: map_key_clear(KEY_SPREADSHEET); break;
733 case 0x1044: map_key_clear(KEY_PRESENTATION); break;
734 case 0x1045: map_key_clear(KEY_UNDO); break;
735 case 0x1046: map_key_clear(KEY_REDO); break;
736 case 0x1047: map_key_clear(KEY_PRINT); break;
737 case 0x1048: map_key_clear(KEY_SAVE); break;
738 case 0x1049: map_key_clear(KEY_PROG1); break;
739 case 0x104a: map_key_clear(KEY_PROG2); break;
740 case 0x104b: map_key_clear(KEY_PROG3); break;
741 case 0x104c: map_key_clear(KEY_PROG4); break;
742
743 default: goto ignore; 684 default: goto ignore;
744 } 685 }
745 break; 686 break;
@@ -766,65 +707,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
766 707
767 case HID_UP_MSVENDOR: 708 case HID_UP_MSVENDOR:
768 709
769 /* Unfortunately, there are multiple devices which 710 goto ignore;
770 * emit usages from MSVENDOR page that require different
771 * handling. If this list grows too much in the future,
772 * more general handling will have to be introduced here
773 * (i.e. another blacklist).
774 */
775
776 /* Chicony Chicony KU-0418 tactical pad */
777 if (IS_CHICONY_TACTICAL_PAD(device)) {
778 set_bit(EV_REP, input->evbit);
779 switch(usage->hid & HID_USAGE) {
780 case 0xff01: map_key_clear(BTN_1); break;
781 case 0xff02: map_key_clear(BTN_2); break;
782 case 0xff03: map_key_clear(BTN_3); break;
783 case 0xff04: map_key_clear(BTN_4); break;
784 case 0xff05: map_key_clear(BTN_5); break;
785 case 0xff06: map_key_clear(BTN_6); break;
786 case 0xff07: map_key_clear(BTN_7); break;
787 case 0xff08: map_key_clear(BTN_8); break;
788 case 0xff09: map_key_clear(BTN_9); break;
789 case 0xff0a: map_key_clear(BTN_A); break;
790 case 0xff0b: map_key_clear(BTN_B); break;
791 default: goto ignore;
792 }
793
794 /* Microsoft Natural Ergonomic Keyboard 4000 */
795 } else if (IS_MS_KB(device)) {
796 switch(usage->hid & HID_USAGE) {
797 case 0xfd06:
798 map_key_clear(KEY_CHAT);
799 break;
800 case 0xfd07:
801 map_key_clear(KEY_PHONE);
802 break;
803 case 0xff05:
804 set_bit(EV_REP, input->evbit);
805 map_key_clear(KEY_F13);
806 set_bit(KEY_F14, input->keybit);
807 set_bit(KEY_F15, input->keybit);
808 set_bit(KEY_F16, input->keybit);
809 set_bit(KEY_F17, input->keybit);
810 set_bit(KEY_F18, input->keybit);
811 default: goto ignore;
812 }
813
814 /* Microsoft Wireless Notebook Presenter Mouse 8000 */
815 } else if (IS_MS_PRESENTER_8000(device)) {
816 set_bit(EV_REP, input->evbit);
817 switch(usage->hid & HID_USAGE) {
818 /* Useful mappings of bottom-side keys for presentations */
819 case 0xfd08: map_key_clear(KEY_RIGHT); break;
820 case 0xfd09: map_key_clear(KEY_LEFT); break;
821 case 0xfd0b: map_key_clear(KEY_PAUSE); break;
822 case 0xfd0f: map_key_clear(KEY_F5); break;
823 default: goto ignore;
824 }
825 } else
826 goto ignore;
827 break;
828 711
829 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ 712 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */
830 713
@@ -841,38 +724,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
841 break; 724 break;
842 725
843 case HID_UP_LOGIVENDOR: 726 case HID_UP_LOGIVENDOR:
844 set_bit(EV_REP, input->evbit);
845 switch(usage->hid & HID_USAGE) {
846 /* Reported on Logitech Ultra X Media Remote */
847 case 0x004: map_key_clear(KEY_AGAIN); break;
848 case 0x00d: map_key_clear(KEY_HOME); break;
849 case 0x024: map_key_clear(KEY_SHUFFLE); break;
850 case 0x025: map_key_clear(KEY_TV); break;
851 case 0x026: map_key_clear(KEY_MENU); break;
852 case 0x031: map_key_clear(KEY_AUDIO); break;
853 case 0x032: map_key_clear(KEY_TEXT); break;
854 case 0x033: map_key_clear(KEY_LAST); break;
855 case 0x047: map_key_clear(KEY_MP3); break;
856 case 0x048: map_key_clear(KEY_DVD); break;
857 case 0x049: map_key_clear(KEY_MEDIA); break;
858 case 0x04a: map_key_clear(KEY_VIDEO); break;
859 case 0x04b: map_key_clear(KEY_ANGLE); break;
860 case 0x04c: map_key_clear(KEY_LANGUAGE); break;
861 case 0x04d: map_key_clear(KEY_SUBTITLE); break;
862 case 0x051: map_key_clear(KEY_RED); break;
863 case 0x052: map_key_clear(KEY_CLOSE); break;
864
865 /* Reported on Petalynx Maxter remote */
866 case 0x05a: map_key_clear(KEY_TEXT); break;
867 case 0x05b: map_key_clear(KEY_RED); break;
868 case 0x05c: map_key_clear(KEY_GREEN); break;
869 case 0x05d: map_key_clear(KEY_YELLOW); break;
870 case 0x05e: map_key_clear(KEY_BLUE); break;
871
872 default: goto ignore;
873 }
874 break;
875 727
728 goto ignore;
729
876 case HID_UP_PID: 730 case HID_UP_PID:
877 731
878 switch(usage->hid & HID_USAGE) { 732 switch(usage->hid & HID_USAGE) {
@@ -899,6 +753,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
899 break; 753 break;
900 } 754 }
901 755
756mapped:
902 if (device->quirks & HID_QUIRK_MIGHTYMOUSE) { 757 if (device->quirks & HID_QUIRK_MIGHTYMOUSE) {
903 if (usage->hid == HID_GD_Z) 758 if (usage->hid == HID_GD_Z)
904 map_rel(REL_HWHEEL); 759 map_rel(REL_HWHEEL);