aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/hid-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input/hid-input.c')
-rw-r--r--drivers/usb/input/hid-input.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 25bc85f8ce39..028e1ad89f5d 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -29,9 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/input.h> 32#include <linux/usb/input.h>
33#include <linux/usb.h>
34#include <linux/usb_input.h>
35 33
36#undef DEBUG 34#undef DEBUG
37 35
@@ -567,16 +565,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
567 break; 565 break;
568 } 566 }
569 567
570 set_bit(usage->type, input->evbit); 568 if (device->quirks & HID_QUIRK_MIGHTYMOUSE) {
571 569 if (usage->hid == HID_GD_Z)
572 while (usage->code <= max && test_and_set_bit(usage->code, bit)) 570 map_rel(REL_HWHEEL);
573 usage->code = find_next_zero_bit(bit, max + 1, usage->code); 571 else if (usage->code == BTN_1)
574 572 map_key(BTN_2);
575 if (usage->code > max) 573 else if (usage->code == BTN_2)
576 goto ignore; 574 map_key(BTN_1);
577 575 }
578 if (((device->quirks & (HID_QUIRK_2WHEEL_POWERMOUSE)) && (usage->hid == 0x00010032)))
579 map_rel(REL_HWHEEL);
580 576
581 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && 577 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) &&
582 (usage->type == EV_REL) && (usage->code == REL_WHEEL)) 578 (usage->type == EV_REL) && (usage->code == REL_WHEEL))
@@ -586,6 +582,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
586 || ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) 582 || ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007)))
587 goto ignore; 583 goto ignore;
588 584
585 set_bit(usage->type, input->evbit);
586
587 while (usage->code <= max && test_and_set_bit(usage->code, bit))
588 usage->code = find_next_zero_bit(bit, max + 1, usage->code);
589
590 if (usage->code > max)
591 goto ignore;
592
593
589 if (usage->type == EV_ABS) { 594 if (usage->type == EV_ABS) {
590 595
591 int a = field->logical_minimum; 596 int a = field->logical_minimum;
@@ -647,6 +652,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
647 return; 652 return;
648 } 653 }
649 654
655 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) {
656 input_event(input, usage->type, usage->code, -value);
657 return;
658 }
659
650 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) { 660 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) {
651 input_event(input, usage->type, REL_HWHEEL, value); 661 input_event(input, usage->type, REL_HWHEEL, value);
652 return; 662 return;