aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-18 17:55:41 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:50 -0400
commit880d29f109428be1d027adf919a7457d8fe41fd3 (patch)
tree4f413f49e8338193ba68683d03bbea603f7380ee /drivers/hid/hid-input.c
parent02ae9a1a8bc1d08a8fd5f6a0b8bde400b0f891b9 (diff)
HID: indent switches/cases
Bring switch and cases into coding style and save thus some indentation to make the code tighter. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c585
1 files changed, 284 insertions, 301 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 76ddf23f1965..a6223bc5c734 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -188,343 +188,326 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
188 } 188 }
189 189
190 switch (usage->hid & HID_USAGE_PAGE) { 190 switch (usage->hid & HID_USAGE_PAGE) {
191 case HID_UP_UNDEFINED:
192 goto ignore;
191 193
192 case HID_UP_UNDEFINED: 194 case HID_UP_KEYBOARD:
193 goto ignore; 195 set_bit(EV_REP, input->evbit);
194
195 case HID_UP_KEYBOARD:
196 196
197 set_bit(EV_REP, input->evbit); 197 if ((usage->hid & HID_USAGE) < 256) {
198 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore;
199 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]);
200 } else
201 map_key(KEY_UNKNOWN);
198 202
199 if ((usage->hid & HID_USAGE) < 256) { 203 break;
200 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore;
201 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]);
202 } else
203 map_key(KEY_UNKNOWN);
204 204
205 break; 205 case HID_UP_BUTTON:
206 code = ((usage->hid - 1) & 0xf);
206 207
207 case HID_UP_BUTTON: 208 switch (field->application) {
208 209 case HID_GD_MOUSE:
209 code = ((usage->hid - 1) & 0xf); 210 case HID_GD_POINTER: code += 0x110; break;
210 211 case HID_GD_JOYSTICK: code += 0x120; break;
211 switch (field->application) { 212 case HID_GD_GAMEPAD: code += 0x130; break;
212 case HID_GD_MOUSE: 213 default:
213 case HID_GD_POINTER: code += 0x110; break; 214 switch (field->physical) {
214 case HID_GD_JOYSTICK: code += 0x120; break; 215 case HID_GD_MOUSE:
215 case HID_GD_GAMEPAD: code += 0x130; break; 216 case HID_GD_POINTER: code += 0x110; break;
216 default: 217 case HID_GD_JOYSTICK: code += 0x120; break;
217 switch (field->physical) { 218 case HID_GD_GAMEPAD: code += 0x130; break;
218 case HID_GD_MOUSE: 219 default: code += 0x100;
219 case HID_GD_POINTER: code += 0x110; break;
220 case HID_GD_JOYSTICK: code += 0x120; break;
221 case HID_GD_GAMEPAD: code += 0x130; break;
222 default: code += 0x100;
223 }
224 } 220 }
221 }
225 222
226 map_key(code); 223 map_key(code);
227 break; 224 break;
228 225
229 226 case HID_UP_SIMULATION:
230 case HID_UP_SIMULATION: 227 switch (usage->hid & 0xffff) {
231 228 case 0xba: map_abs(ABS_RUDDER); break;
232 switch (usage->hid & 0xffff) { 229 case 0xbb: map_abs(ABS_THROTTLE); break;
233 case 0xba: map_abs(ABS_RUDDER); break; 230 case 0xc4: map_abs(ABS_GAS); break;
234 case 0xbb: map_abs(ABS_THROTTLE); break; 231 case 0xc5: map_abs(ABS_BRAKE); break;
235 case 0xc4: map_abs(ABS_GAS); break; 232 case 0xc8: map_abs(ABS_WHEEL); break;
236 case 0xc5: map_abs(ABS_BRAKE); break; 233 default: goto ignore;
237 case 0xc8: map_abs(ABS_WHEEL); break; 234 }
238 default: goto ignore; 235 break;
236
237 case HID_UP_GENDESK:
238 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
239 switch (usage->hid & 0xf) {
240 case 0x1: map_key_clear(KEY_POWER); break;
241 case 0x2: map_key_clear(KEY_SLEEP); break;
242 case 0x3: map_key_clear(KEY_WAKEUP); break;
243 default: goto unknown;
239 } 244 }
240 break; 245 break;
246 }
241 247
242 case HID_UP_GENDESK: 248 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
243
244 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
245 switch (usage->hid & 0xf) {
246 case 0x1: map_key_clear(KEY_POWER); break;
247 case 0x2: map_key_clear(KEY_SLEEP); break;
248 case 0x3: map_key_clear(KEY_WAKEUP); break;
249 default: goto unknown;
250 }
251 break;
252 }
253
254 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
255 switch (usage->hid) {
256 case HID_GD_UP: usage->hat_dir = 1; break;
257 case HID_GD_DOWN: usage->hat_dir = 5; break;
258 case HID_GD_RIGHT: usage->hat_dir = 3; break;
259 case HID_GD_LEFT: usage->hat_dir = 7; break;
260 default: goto unknown;
261 }
262 if (field->dpad) {
263 map_abs(field->dpad);
264 goto ignore;
265 }
266 map_abs(ABS_HAT0X);
267 break;
268 }
269
270 switch (usage->hid) { 249 switch (usage->hid) {
271 250 case HID_GD_UP: usage->hat_dir = 1; break;
272 /* These usage IDs map directly to the usage codes. */ 251 case HID_GD_DOWN: usage->hat_dir = 5; break;
273 case HID_GD_X: case HID_GD_Y: case HID_GD_Z: 252 case HID_GD_RIGHT: usage->hat_dir = 3; break;
274 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 253 case HID_GD_LEFT: usage->hat_dir = 7; break;
275 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: 254 default: goto unknown;
276 if (field->flags & HID_MAIN_ITEM_RELATIVE)
277 map_rel(usage->hid & 0xf);
278 else
279 map_abs(usage->hid & 0xf);
280 break;
281
282 case HID_GD_HATSWITCH:
283 usage->hat_min = field->logical_minimum;
284 usage->hat_max = field->logical_maximum;
285 map_abs(ABS_HAT0X);
286 break;
287
288 case HID_GD_START: map_key_clear(BTN_START); break;
289 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break;
290
291 default: goto unknown;
292 } 255 }
293 256 if (field->dpad) {
294 break; 257 map_abs(field->dpad);
295 258 goto ignore;
296 case HID_UP_LED:
297
298 switch (usage->hid & 0xffff) { /* HID-Value: */
299 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
300 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
301 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
302 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
303 case 0x05: map_led (LED_KANA); break; /* "Kana" */
304 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
305 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
306 case 0x09: map_led (LED_MUTE); break; /* "Mute" */
307 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
308 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
309 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
310
311 default: goto ignore;
312 } 259 }
260 map_abs(ABS_HAT0X);
313 break; 261 break;
262 }
314 263
315 case HID_UP_DIGITIZER: 264 switch (usage->hid) {
316 265 /* These usage IDs map directly to the usage codes. */
317 switch (usage->hid & 0xff) { 266 case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
318 267 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
319 case 0x30: /* TipPressure */ 268 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:
320 if (!test_bit(BTN_TOUCH, input->keybit)) { 269 if (field->flags & HID_MAIN_ITEM_RELATIVE)
321 device->quirks |= HID_QUIRK_NOTOUCH; 270 map_rel(usage->hid & 0xf);
322 set_bit(EV_KEY, input->evbit); 271 else
323 set_bit(BTN_TOUCH, input->keybit); 272 map_abs(usage->hid & 0xf);
324 } 273 break;
325
326 map_abs_clear(ABS_PRESSURE);
327 break;
328
329 case 0x32: /* InRange */
330 switch (field->physical & 0xff) {
331 case 0x21: map_key(BTN_TOOL_MOUSE); break;
332 case 0x22: map_key(BTN_TOOL_FINGER); break;
333 default: map_key(BTN_TOOL_PEN); break;
334 }
335 break;
336 274
337 case 0x3c: /* Invert */ 275 case HID_GD_HATSWITCH:
338 map_key_clear(BTN_TOOL_RUBBER); 276 usage->hat_min = field->logical_minimum;
339 break; 277 usage->hat_max = field->logical_maximum;
278 map_abs(ABS_HAT0X);
279 break;
340 280
341 case 0x33: /* Touch */ 281 case HID_GD_START: map_key_clear(BTN_START); break;
342 case 0x42: /* TipSwitch */ 282 case HID_GD_SELECT: map_key_clear(BTN_SELECT); break;
343 case 0x43: /* TipSwitch2 */
344 device->quirks &= ~HID_QUIRK_NOTOUCH;
345 map_key_clear(BTN_TOUCH);
346 break;
347 283
348 case 0x44: /* BarrelSwitch */ 284 default: goto unknown;
349 map_key_clear(BTN_STYLUS); 285 }
350 break;
351 286
352 default: goto unknown; 287 break;
288
289 case HID_UP_LED:
290 switch (usage->hid & 0xffff) { /* HID-Value: */
291 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
292 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
293 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
294 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
295 case 0x05: map_led (LED_KANA); break; /* "Kana" */
296 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
297 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
298 case 0x09: map_led (LED_MUTE); break; /* "Mute" */
299 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
300 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
301 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
302
303 default: goto ignore;
304 }
305 break;
306
307 case HID_UP_DIGITIZER:
308 switch (usage->hid & 0xff) {
309 case 0x30: /* TipPressure */
310 if (!test_bit(BTN_TOUCH, input->keybit)) {
311 device->quirks |= HID_QUIRK_NOTOUCH;
312 set_bit(EV_KEY, input->evbit);
313 set_bit(BTN_TOUCH, input->keybit);
353 } 314 }
315 map_abs_clear(ABS_PRESSURE);
354 break; 316 break;
355 317
356 case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */ 318 case 0x32: /* InRange */
357 319 switch (field->physical & 0xff) {
358 switch (usage->hid & HID_USAGE) { 320 case 0x21: map_key(BTN_TOOL_MOUSE); break;
359 case 0x000: goto ignore; 321 case 0x22: map_key(BTN_TOOL_FINGER); break;
360 case 0x034: map_key_clear(KEY_SLEEP); break; 322 default: map_key(BTN_TOOL_PEN); break;
361 case 0x036: map_key_clear(BTN_MISC); break;
362
363 case 0x040: map_key_clear(KEY_MENU); break;
364 case 0x045: map_key_clear(KEY_RADIO); break;
365
366 case 0x083: map_key_clear(KEY_LAST); break;
367 case 0x088: map_key_clear(KEY_PC); break;
368 case 0x089: map_key_clear(KEY_TV); break;
369 case 0x08a: map_key_clear(KEY_WWW); break;
370 case 0x08b: map_key_clear(KEY_DVD); break;
371 case 0x08c: map_key_clear(KEY_PHONE); break;
372 case 0x08d: map_key_clear(KEY_PROGRAM); break;
373 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break;
374 case 0x08f: map_key_clear(KEY_GAMES); break;
375 case 0x090: map_key_clear(KEY_MEMO); break;
376 case 0x091: map_key_clear(KEY_CD); break;
377 case 0x092: map_key_clear(KEY_VCR); break;
378 case 0x093: map_key_clear(KEY_TUNER); break;
379 case 0x094: map_key_clear(KEY_EXIT); break;
380 case 0x095: map_key_clear(KEY_HELP); break;
381 case 0x096: map_key_clear(KEY_TAPE); break;
382 case 0x097: map_key_clear(KEY_TV2); break;
383 case 0x098: map_key_clear(KEY_SAT); break;
384 case 0x09a: map_key_clear(KEY_PVR); break;
385
386 case 0x09c: map_key_clear(KEY_CHANNELUP); break;
387 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break;
388 case 0x0a0: map_key_clear(KEY_VCR2); break;
389
390 case 0x0b0: map_key_clear(KEY_PLAY); break;
391 case 0x0b1: map_key_clear(KEY_PAUSE); break;
392 case 0x0b2: map_key_clear(KEY_RECORD); break;
393 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break;
394 case 0x0b4: map_key_clear(KEY_REWIND); break;
395 case 0x0b5: map_key_clear(KEY_NEXTSONG); break;
396 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break;
397 case 0x0b7: map_key_clear(KEY_STOPCD); break;
398 case 0x0b8: map_key_clear(KEY_EJECTCD); break;
399 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break;
400
401 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
402 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
403 case 0x0e2: map_key_clear(KEY_MUTE); break;
404 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
405 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
406 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
407
408 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
409 case 0x183: map_key_clear(KEY_CONFIG); break;
410 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
411 case 0x185: map_key_clear(KEY_EDITOR); break;
412 case 0x186: map_key_clear(KEY_SPREADSHEET); break;
413 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break;
414 case 0x188: map_key_clear(KEY_PRESENTATION); break;
415 case 0x189: map_key_clear(KEY_DATABASE); break;
416 case 0x18a: map_key_clear(KEY_MAIL); break;
417 case 0x18b: map_key_clear(KEY_NEWS); break;
418 case 0x18c: map_key_clear(KEY_VOICEMAIL); break;
419 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break;
420 case 0x18e: map_key_clear(KEY_CALENDAR); break;
421 case 0x191: map_key_clear(KEY_FINANCE); break;
422 case 0x192: map_key_clear(KEY_CALC); break;
423 case 0x194: map_key_clear(KEY_FILE); break;
424 case 0x196: map_key_clear(KEY_WWW); break;
425 case 0x19c: map_key_clear(KEY_LOGOFF); break;
426 case 0x19e: map_key_clear(KEY_COFFEE); break;
427 case 0x1a6: map_key_clear(KEY_HELP); break;
428 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
429 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
430 case 0x1b6: map_key_clear(KEY_MEDIA); break;
431 case 0x1b7: map_key_clear(KEY_SOUND); break;
432 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
433 case 0x1bd: map_key_clear(KEY_INFO); break;
434 case 0x201: map_key_clear(KEY_NEW); break;
435 case 0x202: map_key_clear(KEY_OPEN); break;
436 case 0x203: map_key_clear(KEY_CLOSE); break;
437 case 0x204: map_key_clear(KEY_EXIT); break;
438 case 0x207: map_key_clear(KEY_SAVE); break;
439 case 0x208: map_key_clear(KEY_PRINT); break;
440 case 0x209: map_key_clear(KEY_PROPS); break;
441 case 0x21a: map_key_clear(KEY_UNDO); break;
442 case 0x21b: map_key_clear(KEY_COPY); break;
443 case 0x21c: map_key_clear(KEY_CUT); break;
444 case 0x21d: map_key_clear(KEY_PASTE); break;
445 case 0x21f: map_key_clear(KEY_FIND); break;
446 case 0x221: map_key_clear(KEY_SEARCH); break;
447 case 0x222: map_key_clear(KEY_GOTO); break;
448 case 0x223: map_key_clear(KEY_HOMEPAGE); break;
449 case 0x224: map_key_clear(KEY_BACK); break;
450 case 0x225: map_key_clear(KEY_FORWARD); break;
451 case 0x226: map_key_clear(KEY_STOP); break;
452 case 0x227: map_key_clear(KEY_REFRESH); break;
453 case 0x22a: map_key_clear(KEY_BOOKMARKS); break;
454 case 0x22d: map_key_clear(KEY_ZOOMIN); break;
455 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;
456 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;
457 case 0x233: map_key_clear(KEY_SCROLLUP); break;
458 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
459 case 0x238: map_rel(REL_HWHEEL); break;
460 case 0x25f: map_key_clear(KEY_CANCEL); break;
461 case 0x279: map_key_clear(KEY_REDO); break;
462
463 case 0x289: map_key_clear(KEY_REPLY); break;
464 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
465 case 0x28c: map_key_clear(KEY_SEND); break;
466
467 default: goto ignore;
468 } 323 }
469 break; 324 break;
470 325
471 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */ 326 case 0x3c: /* Invert */
472 327 map_key_clear(BTN_TOOL_RUBBER);
473 set_bit(EV_REP, input->evbit);
474 switch (usage->hid & HID_USAGE) {
475 case 0x021: map_key_clear(KEY_PRINT); break;
476 case 0x070: map_key_clear(KEY_HP); break;
477 case 0x071: map_key_clear(KEY_CAMERA); break;
478 case 0x072: map_key_clear(KEY_SOUND); break;
479 case 0x073: map_key_clear(KEY_QUESTION); break;
480 case 0x080: map_key_clear(KEY_EMAIL); break;
481 case 0x081: map_key_clear(KEY_CHAT); break;
482 case 0x082: map_key_clear(KEY_SEARCH); break;
483 case 0x083: map_key_clear(KEY_CONNECT); break;
484 case 0x084: map_key_clear(KEY_FINANCE); break;
485 case 0x085: map_key_clear(KEY_SPORT); break;
486 case 0x086: map_key_clear(KEY_SHOP); break;
487 default: goto ignore;
488 }
489 break; 328 break;
490 329
491 case HID_UP_MSVENDOR: 330 case 0x33: /* Touch */
492 331 case 0x42: /* TipSwitch */
493 goto ignore; 332 case 0x43: /* TipSwitch2 */
333 device->quirks &= ~HID_QUIRK_NOTOUCH;
334 map_key_clear(BTN_TOUCH);
335 break;
494 336
495 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */ 337 case 0x44: /* BarrelSwitch */
338 map_key_clear(BTN_STYLUS);
339 break;
496 340
497 set_bit(EV_REP, input->evbit); 341 default: goto unknown;
498 goto ignore; 342 }
343 break;
344
345 case HID_UP_CONSUMER: /* USB HUT v1.1, pages 56-62 */
346 switch (usage->hid & HID_USAGE) {
347 case 0x000: goto ignore;
348 case 0x034: map_key_clear(KEY_SLEEP); break;
349 case 0x036: map_key_clear(BTN_MISC); break;
350
351 case 0x040: map_key_clear(KEY_MENU); break;
352 case 0x045: map_key_clear(KEY_RADIO); break;
353
354 case 0x083: map_key_clear(KEY_LAST); break;
355 case 0x088: map_key_clear(KEY_PC); break;
356 case 0x089: map_key_clear(KEY_TV); break;
357 case 0x08a: map_key_clear(KEY_WWW); break;
358 case 0x08b: map_key_clear(KEY_DVD); break;
359 case 0x08c: map_key_clear(KEY_PHONE); break;
360 case 0x08d: map_key_clear(KEY_PROGRAM); break;
361 case 0x08e: map_key_clear(KEY_VIDEOPHONE); break;
362 case 0x08f: map_key_clear(KEY_GAMES); break;
363 case 0x090: map_key_clear(KEY_MEMO); break;
364 case 0x091: map_key_clear(KEY_CD); break;
365 case 0x092: map_key_clear(KEY_VCR); break;
366 case 0x093: map_key_clear(KEY_TUNER); break;
367 case 0x094: map_key_clear(KEY_EXIT); break;
368 case 0x095: map_key_clear(KEY_HELP); break;
369 case 0x096: map_key_clear(KEY_TAPE); break;
370 case 0x097: map_key_clear(KEY_TV2); break;
371 case 0x098: map_key_clear(KEY_SAT); break;
372 case 0x09a: map_key_clear(KEY_PVR); break;
373
374 case 0x09c: map_key_clear(KEY_CHANNELUP); break;
375 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break;
376 case 0x0a0: map_key_clear(KEY_VCR2); break;
377
378 case 0x0b0: map_key_clear(KEY_PLAY); break;
379 case 0x0b1: map_key_clear(KEY_PAUSE); break;
380 case 0x0b2: map_key_clear(KEY_RECORD); break;
381 case 0x0b3: map_key_clear(KEY_FASTFORWARD); break;
382 case 0x0b4: map_key_clear(KEY_REWIND); break;
383 case 0x0b5: map_key_clear(KEY_NEXTSONG); break;
384 case 0x0b6: map_key_clear(KEY_PREVIOUSSONG); break;
385 case 0x0b7: map_key_clear(KEY_STOPCD); break;
386 case 0x0b8: map_key_clear(KEY_EJECTCD); break;
387 case 0x0bc: map_key_clear(KEY_MEDIA_REPEAT); break;
388
389 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
390 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
391 case 0x0e2: map_key_clear(KEY_MUTE); break;
392 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
393 case 0x0e9: map_key_clear(KEY_VOLUMEUP); break;
394 case 0x0ea: map_key_clear(KEY_VOLUMEDOWN); break;
395
396 case 0x182: map_key_clear(KEY_BOOKMARKS); break;
397 case 0x183: map_key_clear(KEY_CONFIG); break;
398 case 0x184: map_key_clear(KEY_WORDPROCESSOR); break;
399 case 0x185: map_key_clear(KEY_EDITOR); break;
400 case 0x186: map_key_clear(KEY_SPREADSHEET); break;
401 case 0x187: map_key_clear(KEY_GRAPHICSEDITOR); break;
402 case 0x188: map_key_clear(KEY_PRESENTATION); break;
403 case 0x189: map_key_clear(KEY_DATABASE); break;
404 case 0x18a: map_key_clear(KEY_MAIL); break;
405 case 0x18b: map_key_clear(KEY_NEWS); break;
406 case 0x18c: map_key_clear(KEY_VOICEMAIL); break;
407 case 0x18d: map_key_clear(KEY_ADDRESSBOOK); break;
408 case 0x18e: map_key_clear(KEY_CALENDAR); break;
409 case 0x191: map_key_clear(KEY_FINANCE); break;
410 case 0x192: map_key_clear(KEY_CALC); break;
411 case 0x194: map_key_clear(KEY_FILE); break;
412 case 0x196: map_key_clear(KEY_WWW); break;
413 case 0x19c: map_key_clear(KEY_LOGOFF); break;
414 case 0x19e: map_key_clear(KEY_COFFEE); break;
415 case 0x1a6: map_key_clear(KEY_HELP); break;
416 case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
417 case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
418 case 0x1b6: map_key_clear(KEY_MEDIA); break;
419 case 0x1b7: map_key_clear(KEY_SOUND); break;
420 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
421 case 0x1bd: map_key_clear(KEY_INFO); break;
422 case 0x201: map_key_clear(KEY_NEW); break;
423 case 0x202: map_key_clear(KEY_OPEN); break;
424 case 0x203: map_key_clear(KEY_CLOSE); break;
425 case 0x204: map_key_clear(KEY_EXIT); break;
426 case 0x207: map_key_clear(KEY_SAVE); break;
427 case 0x208: map_key_clear(KEY_PRINT); break;
428 case 0x209: map_key_clear(KEY_PROPS); break;
429 case 0x21a: map_key_clear(KEY_UNDO); break;
430 case 0x21b: map_key_clear(KEY_COPY); break;
431 case 0x21c: map_key_clear(KEY_CUT); break;
432 case 0x21d: map_key_clear(KEY_PASTE); break;
433 case 0x21f: map_key_clear(KEY_FIND); break;
434 case 0x221: map_key_clear(KEY_SEARCH); break;
435 case 0x222: map_key_clear(KEY_GOTO); break;
436 case 0x223: map_key_clear(KEY_HOMEPAGE); break;
437 case 0x224: map_key_clear(KEY_BACK); break;
438 case 0x225: map_key_clear(KEY_FORWARD); break;
439 case 0x226: map_key_clear(KEY_STOP); break;
440 case 0x227: map_key_clear(KEY_REFRESH); break;
441 case 0x22a: map_key_clear(KEY_BOOKMARKS); break;
442 case 0x22d: map_key_clear(KEY_ZOOMIN); break;
443 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;
444 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;
445 case 0x233: map_key_clear(KEY_SCROLLUP); break;
446 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
447 case 0x238: map_rel(REL_HWHEEL); break;
448 case 0x25f: map_key_clear(KEY_CANCEL); break;
449 case 0x279: map_key_clear(KEY_REDO); break;
450
451 case 0x289: map_key_clear(KEY_REPLY); break;
452 case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
453 case 0x28c: map_key_clear(KEY_SEND); break;
454
455 default: goto ignore;
456 }
457 break;
458
459 case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */
460 set_bit(EV_REP, input->evbit);
461 switch (usage->hid & HID_USAGE) {
462 case 0x021: map_key_clear(KEY_PRINT); break;
463 case 0x070: map_key_clear(KEY_HP); break;
464 case 0x071: map_key_clear(KEY_CAMERA); break;
465 case 0x072: map_key_clear(KEY_SOUND); break;
466 case 0x073: map_key_clear(KEY_QUESTION); break;
467 case 0x080: map_key_clear(KEY_EMAIL); break;
468 case 0x081: map_key_clear(KEY_CHAT); break;
469 case 0x082: map_key_clear(KEY_SEARCH); break;
470 case 0x083: map_key_clear(KEY_CONNECT); break;
471 case 0x084: map_key_clear(KEY_FINANCE); break;
472 case 0x085: map_key_clear(KEY_SPORT); break;
473 case 0x086: map_key_clear(KEY_SHOP); break;
474 default: goto ignore;
475 }
476 break;
499 477
500 case HID_UP_LOGIVENDOR: 478 case HID_UP_MSVENDOR:
479 goto ignore;
501 480
502 goto ignore; 481 case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */
503 482 set_bit(EV_REP, input->evbit);
504 case HID_UP_PID: 483 goto ignore;
505 484
506 switch(usage->hid & HID_USAGE) { 485 case HID_UP_LOGIVENDOR:
507 case 0xa4: map_key_clear(BTN_DEAD); break; 486 goto ignore;
508 default: goto ignore; 487
509 } 488 case HID_UP_PID:
510 break; 489 switch (usage->hid & HID_USAGE) {
490 case 0xa4: map_key_clear(BTN_DEAD); break;
491 default: goto ignore;
492 }
493 break;
511 494
512 default: 495 default:
513 unknown: 496 unknown:
514 if (field->report_size == 1) { 497 if (field->report_size == 1) {
515 if (field->report->type == HID_OUTPUT_REPORT) { 498 if (field->report->type == HID_OUTPUT_REPORT) {
516 map_led(LED_MISC); 499 map_led(LED_MISC);
517 break;
518 }
519 map_key(BTN_MISC);
520 break;
521 }
522 if (field->flags & HID_MAIN_ITEM_RELATIVE) {
523 map_rel(REL_MISC);
524 break; 500 break;
525 } 501 }
526 map_abs(ABS_MISC); 502 map_key(BTN_MISC);
527 break; 503 break;
504 }
505 if (field->flags & HID_MAIN_ITEM_RELATIVE) {
506 map_rel(REL_MISC);
507 break;
508 }
509 map_abs(ABS_MISC);
510 break;
528 } 511 }
529 512
530mapped: 513mapped: