diff options
| author | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2011-09-21 10:56:54 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-26 08:18:18 -0400 |
| commit | b77c3920e90e96103e4f41442999402925fe5f73 (patch) | |
| tree | 04df6c729a1e9b3afaa8e8f06b51fede1ef57779 | |
| parent | a062cc5a76fa1d12f0821e56e3746cad2dc2fc65 (diff) | |
HID: add autodetection of multitouch devices
As mentioned by http://www.microsoft.com/whdc/device/input/DigitizerDrvs_touch.mspx
multitouch devices are those that have the input report HID_CONTACTID.
This patch detects this and unloads the generic-usb driver.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| -rw-r--r-- | drivers/hid/hid-core.c | 6 | ||||
| -rw-r--r-- | drivers/hid/hid-input.c | 11 | ||||
| -rw-r--r-- | include/linux/hid.h | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 956f84968fa4..f869ab35e6d6 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1212,6 +1212,12 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | |||
| 1212 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, | 1212 | if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev, |
| 1213 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) | 1213 | connect_mask & HID_CONNECT_HIDINPUT_FORCE)) |
| 1214 | hdev->claimed |= HID_CLAIMED_INPUT; | 1214 | hdev->claimed |= HID_CLAIMED_INPUT; |
| 1215 | if (hdev->quirks & HID_QUIRK_MULTITOUCH) { | ||
| 1216 | /* this device should be handled by hid-multitouch, skip it */ | ||
| 1217 | hdev->quirks &= ~HID_QUIRK_MULTITOUCH; | ||
| 1218 | return -ENODEV; | ||
| 1219 | } | ||
| 1220 | |||
| 1215 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && | 1221 | if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect && |
| 1216 | !hdev->hiddev_connect(hdev, | 1222 | !hdev->hiddev_connect(hdev, |
| 1217 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) | 1223 | connect_mask & HID_CONNECT_HIDDEV_FORCE)) |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 6559e2e3364e..f333139d1a48 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -474,6 +474,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 474 | map_key_clear(BTN_STYLUS2); | 474 | map_key_clear(BTN_STYLUS2); |
| 475 | break; | 475 | break; |
| 476 | 476 | ||
| 477 | case 0x51: /* ContactID */ | ||
| 478 | device->quirks |= HID_QUIRK_MULTITOUCH; | ||
| 479 | goto unknown; | ||
| 480 | |||
| 477 | default: goto unknown; | 481 | default: goto unknown; |
| 478 | } | 482 | } |
| 479 | break; | 483 | break; |
| @@ -978,6 +982,13 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) | |||
| 978 | } | 982 | } |
| 979 | } | 983 | } |
| 980 | 984 | ||
| 985 | if (hid->quirks & HID_QUIRK_MULTITOUCH) { | ||
| 986 | /* generic hid does not know how to handle multitouch devices */ | ||
| 987 | if (hidinput) | ||
| 988 | goto out_cleanup; | ||
| 989 | goto out_unwind; | ||
| 990 | } | ||
| 991 | |||
| 981 | if (hidinput && input_register_device(hidinput->input)) | 992 | if (hidinput && input_register_device(hidinput->input)) |
| 982 | goto out_cleanup; | 993 | goto out_cleanup; |
| 983 | 994 | ||
diff --git a/include/linux/hid.h b/include/linux/hid.h index 9cf8e7ae7450..6fb743d72bfe 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -312,6 +312,7 @@ struct hid_item { | |||
| 312 | #define HID_QUIRK_BADPAD 0x00000020 | 312 | #define HID_QUIRK_BADPAD 0x00000020 |
| 313 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 313 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
| 314 | #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 | 314 | #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 |
| 315 | #define HID_QUIRK_MULTITOUCH 0x00000100 | ||
| 315 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 316 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
| 316 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 317 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
| 317 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 318 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
