diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index eeba66513997..c8434023ba65 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -71,7 +71,6 @@ static const struct { | |||
71 | #define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0) | 71 | #define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0) |
72 | 72 | ||
73 | #define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0) | 73 | #define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0) |
74 | #define map_rel_clear(c) do { map_rel(c); clear_bit(c, bit); } while (0) | ||
75 | #define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0) | 74 | #define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0) |
76 | 75 | ||
77 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | 76 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK |
@@ -296,7 +295,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
296 | } | 295 | } |
297 | } | 296 | } |
298 | 297 | ||
299 | map_key_clear(code); | 298 | map_key(code); |
300 | break; | 299 | break; |
301 | 300 | ||
302 | 301 | ||
@@ -347,9 +346,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
347 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: | 346 | case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: |
348 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: | 347 | case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: |
349 | if (field->flags & HID_MAIN_ITEM_RELATIVE) | 348 | if (field->flags & HID_MAIN_ITEM_RELATIVE) |
350 | map_rel_clear(usage->hid & 0xf); | 349 | map_rel(usage->hid & 0xf); |
351 | else | 350 | else |
352 | map_abs_clear(usage->hid & 0xf); | 351 | map_abs(usage->hid & 0xf); |
353 | break; | 352 | break; |
354 | 353 | ||
355 | case HID_GD_HATSWITCH: | 354 | case HID_GD_HATSWITCH: |
@@ -519,7 +518,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
519 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | 518 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; |
520 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | 519 | case 0x233: map_key_clear(KEY_SCROLLUP); break; |
521 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | 520 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; |
522 | case 0x238: map_rel_clear(REL_HWHEEL); break; | 521 | case 0x238: map_rel(REL_HWHEEL); break; |
523 | case 0x25f: map_key_clear(KEY_CANCEL); break; | 522 | case 0x25f: map_key_clear(KEY_CANCEL); break; |
524 | case 0x279: map_key_clear(KEY_REDO); break; | 523 | case 0x279: map_key_clear(KEY_REDO); break; |
525 | 524 | ||
@@ -667,6 +666,12 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
667 | 666 | ||
668 | set_bit(usage->type, input->evbit); | 667 | set_bit(usage->type, input->evbit); |
669 | 668 | ||
669 | if (device->quirks & HID_QUIRK_DUPLICATE_USAGES && | ||
670 | (usage->type == EV_KEY || | ||
671 | usage->type == EV_REL || | ||
672 | usage->type == EV_ABS)) | ||
673 | clear_bit(usage->code, bit); | ||
674 | |||
670 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) | 675 | while (usage->code <= max && test_and_set_bit(usage->code, bit)) |
671 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); | 676 | usage->code = find_next_zero_bit(bit, max + 1, usage->code); |
672 | 677 | ||