aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@enac.fr>2011-01-07 17:47:27 -0500
committerJiri Kosina <jkosina@suse.cz>2011-01-11 15:26:55 -0500
commit5572da08a784621f2ab4fdc8dc65471261871795 (patch)
tree667ad15cf97f22e9ebeb97884ae114156883bf2a /drivers/hid/hid-multitouch.c
parenta3b5e577d96bfccbc41ebf4df784e3a153072273 (diff)
HID: hid-mulitouch: add support for the 'Sensing Win7-TwoFinger'
Added support for the 'Sensing Win7-TwoFinger' panel by GeneralTouch found on some tablets. Because of conflicting VID/PID, this conflicts with previous support for some single-touch panels by GeneralTouch Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr> Signed-off-by: Stéphane Chatty <chatty@enac.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 7af9f7136bd5..3442ed56e964 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -33,6 +33,7 @@ MODULE_LICENSE("GPL");
33#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0) 33#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
34#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1) 34#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
35#define MT_QUIRK_CYPRESS (1 << 2) 35#define MT_QUIRK_CYPRESS (1 << 2)
36#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
36 37
37struct mt_slot { 38struct mt_slot {
38 __s32 x, y, p, w, h; 39 __s32 x, y, p, w, h;
@@ -63,7 +64,8 @@ struct mt_class {
63/* classes of device behavior */ 64/* classes of device behavior */
64#define MT_CLS_DEFAULT 0 65#define MT_CLS_DEFAULT 0
65#define MT_CLS_DUAL1 1 66#define MT_CLS_DUAL1 1
66#define MT_CLS_CYPRESS 2 67#define MT_CLS_DUAL2 2
68#define MT_CLS_CYPRESS 3
67 69
68/* 70/*
69 * these device-dependent functions determine what slot corresponds 71 * these device-dependent functions determine what slot corresponds
@@ -75,6 +77,11 @@ static int slot_is_contactid(struct mt_device *td)
75 return td->curdata.contactid; 77 return td->curdata.contactid;
76} 78}
77 79
80static int slot_is_contactnumber(struct mt_device *td)
81{
82 return td->num_received;
83}
84
78static int cypress_compute_slot(struct mt_device *td) 85static int cypress_compute_slot(struct mt_device *td)
79{ 86{
80 if (td->curdata.contactid != 0 || td->num_received == 0) 87 if (td->curdata.contactid != 0 || td->num_received == 0)
@@ -105,6 +112,7 @@ static int find_slot_from_contactid(struct mt_device *td)
105struct mt_class mt_classes[] = { 112struct mt_class mt_classes[] = {
106 { 0, 0, 0, 10 }, /* MT_CLS_DEFAULT */ 113 { 0, 0, 0, 10 }, /* MT_CLS_DEFAULT */
107 { MT_QUIRK_SLOT_IS_CONTACTID, 0, 0, 2 }, /* MT_CLS_DUAL1 */ 114 { MT_QUIRK_SLOT_IS_CONTACTID, 0, 0, 2 }, /* MT_CLS_DUAL1 */
115 { MT_QUIRK_SLOT_IS_CONTACTNUMBER, 0, 0, 10 }, /* MT_CLS_DUAL2 */
108 { MT_QUIRK_CYPRESS | MT_QUIRK_NOT_SEEN_MEANS_UP, 0, 0, 10 }, /* MT_CLS_CYPRESS */ 116 { MT_QUIRK_CYPRESS | MT_QUIRK_NOT_SEEN_MEANS_UP, 0, 0, 10 }, /* MT_CLS_CYPRESS */
109}; 117};
110 118
@@ -237,6 +245,9 @@ static int mt_compute_slot(struct mt_device *td)
237 if (cls->quirks & MT_QUIRK_CYPRESS) 245 if (cls->quirks & MT_QUIRK_CYPRESS)
238 return cypress_compute_slot(td); 246 return cypress_compute_slot(td);
239 247
248 if (cls->quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
249 return slot_is_contactnumber(td);
250
240 return find_slot_from_contactid(td); 251 return find_slot_from_contactid(td);
241} 252}
242 253
@@ -441,6 +452,11 @@ static const struct hid_device_id mt_devices[] = {
441 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, 452 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
442 USB_DEVICE_ID_CYPRESS_TRUETOUCH) }, 453 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
443 454
455 /* GeneralTouch panel */
456 { .driver_data = MT_CLS_DUAL2,
457 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
458 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
459
444 /* PixCir-based panels */ 460 /* PixCir-based panels */
445 { .driver_data = MT_CLS_DUAL1, 461 { .driver_data = MT_CLS_DUAL1,
446 HID_USB_DEVICE(USB_VENDOR_ID_HANVON, 462 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,