aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Troller <patrol@sinus.cz>2007-10-29 06:13:46 -0400
committerJiri Kosina <jkosina@suse.cz>2008-01-28 08:51:19 -0500
commitc80e5ffac0579499ca28444155118ffcdd9b8d7e (patch)
tree628e11f985ee165a7a7f13a547baabcd42fc094e
parenta45d82d19a6c2a717bcc33cff243199b77fa0082 (diff)
HID: Implement horizontal wheel handling for A4 Tech X5-005D
This mouse distinguishes horizontal wheel from vertical by a special "pseudo event" GenericDesktop.00b8, with values of 0 for vertical and 8 for horizontal wheel. Because this event is supplied by the parser too late, we need to delay a wheel event, wait for this one and send either REL_WHEEL or REL_HWHEEL to input depending on the event value. Signed-off-by: Pavel Troller <patrol@sinus.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-input.c20
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
-rw-r--r--include/linux/hid.h3
3 files changed, 22 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 8c4c908177fa..de270b16bde3 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -902,9 +902,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
902 map_key(BTN_1); 902 map_key(BTN_1);
903 } 903 }
904 904
905 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && 905 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5 |
906 (usage->type == EV_REL) && (usage->code == REL_WHEEL)) 906 HID_QUIRK_2WHEEL_MOUSE_HACK_B8)) && (usage->type == EV_REL) &&
907 set_bit(REL_HWHEEL, bit); 907 (usage->code == REL_WHEEL))
908 set_bit(REL_HWHEEL, bit);
908 909
909 if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) 910 if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005))
910 || ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) 911 || ((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007)))
@@ -1002,6 +1003,19 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
1002 return; 1003 return;
1003 } 1004 }
1004 1005
1006 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
1007 (usage->type == EV_REL) &&
1008 (usage->code == REL_WHEEL)) {
1009 hid->delayed_value = value;
1010 return;
1011 }
1012
1013 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
1014 (usage->hid == 0x000100b8)) {
1015 input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value);
1016 return;
1017 }
1018
1005 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) { 1019 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) {
1006 input_event(input, usage->type, usage->code, -value); 1020 input_event(input, usage->type, usage->code, -value);
1007 return; 1021 return;
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 3304b0ab39f7..836b06a86173 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -19,6 +19,7 @@
19 19
20#define USB_VENDOR_ID_A4TECH 0x09da 20#define USB_VENDOR_ID_A4TECH 0x09da
21#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 21#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
22#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
22 23
23#define USB_VENDOR_ID_AASHIMA 0x06d6 24#define USB_VENDOR_ID_AASHIMA 0x06d6
24#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 25#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
@@ -371,6 +372,7 @@ static const struct hid_blacklist {
371} hid_blacklist[] = { 372} hid_blacklist[] = {
372 373
373 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, 374 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 },
375 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D, HID_QUIRK_2WHEEL_MOUSE_HACK_B8 },
374 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, 376 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 },
375 377
376 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS }, 378 { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER, HID_QUIRK_BAD_RELATIVE_KEYS },
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 833f2af8aab9..991bbcdc1ca7 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -281,6 +281,7 @@ struct hid_item {
281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
284#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
284 285
285/* 286/*
286 * Separate quirks for runtime report descriptor fixup 287 * Separate quirks for runtime report descriptor fixup
@@ -456,6 +457,8 @@ struct hid_device { /* device report descriptor */
456 457
457 void *driver_data; 458 void *driver_data;
458 459
460 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */
461
459 /* device-specific function pointers */ 462 /* device-specific function pointers */
460 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); 463 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
461 int (*hid_open) (struct hid_device *); 464 int (*hid_open) (struct hid_device *);