aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/Kconfig17
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-cando.c2
-rw-r--r--drivers/hid/hid-core.c7
-rw-r--r--drivers/hid/hid-ids.h7
-rw-r--r--drivers/hid/hid-input.c17
-rw-r--r--drivers/hid/hid-mosart.c1
-rw-r--r--drivers/hid/hid-multitouch.c516
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
9 files changed, 563 insertions, 6 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index ffbc278647bf..24cca2f69dfc 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -295,6 +295,23 @@ config HID_MONTEREY
295 ---help--- 295 ---help---
296 Support for Monterey Genius KB29E. 296 Support for Monterey Genius KB29E.
297 297
298config HID_MULTITOUCH
299 tristate "HID Multitouch panels"
300 depends on USB_HID
301 ---help---
302 Generic support for HID multitouch panels.
303
304 Say Y here if you have one of the following devices:
305 - Cypress TrueTouch panels
306 - Hanvon dual touch panels
307 - Pixcir dual touch panels
308 - 'Sensing Win7-TwoFinger' panel by GeneralTouch
309
310 If unsure, say N.
311
312 To compile this driver as a module, choose M here: the
313 module will be called hid-multitouch.
314
298config HID_NTRIG 315config HID_NTRIG
299 tristate "N-Trig touch screen" 316 tristate "N-Trig touch screen"
300 depends on USB_HID 317 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 6eae9a90b8dd..6efc2a0370ad 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
47obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 47obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
48obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o 48obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
49obj-$(CONFIG_HID_MOSART) += hid-mosart.o 49obj-$(CONFIG_HID_MOSART) += hid-mosart.o
50obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
50obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o 51obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
51obj-$(CONFIG_HID_ORTEK) += hid-ortek.o 52obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
52obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o 53obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c
index 375b50929a50..1ea066c55201 100644
--- a/drivers/hid/hid-cando.c
+++ b/drivers/hid/hid-cando.c
@@ -236,6 +236,8 @@ static const struct hid_device_id cando_devices[] = {
236 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, 236 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
237 USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, 237 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
238 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, 238 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
239 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
240 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
239 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, 241 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
240 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, 242 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
241 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, 243 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 261168607c91..d678cf3d33d5 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1312,7 +1312,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
1312 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1312 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1313 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 1313 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
1314 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 1314 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
1315 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
1315 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, 1316 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
1317 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
1316 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, 1318 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
1317 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, 1319 { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
1318 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1320 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
@@ -1324,6 +1326,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1324 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1326 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1325 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, 1327 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) },
1326 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1328 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1329 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
1327 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, 1330 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
1328 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1331 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
1329 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 1332 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
@@ -1335,11 +1338,13 @@ static const struct hid_device_id hid_have_special_driver[] = {
1335 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1338 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1336 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1339 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1337 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1340 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
1341 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
1338 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 1342 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
1339 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, 1343 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
1340 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1344 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1341 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1345 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1342 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, 1346 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
1347 { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) },
1343 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, 1348 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
1344 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 1349 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
1345 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1350 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
@@ -1422,6 +1427,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1422 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1427 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1423 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 1428 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
1424 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1429 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
1430 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
1425 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, 1431 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
1426 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, 1432 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
1427 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, 1433 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
@@ -1640,7 +1646,6 @@ static const struct hid_device_id hid_ignore_list[] = {
1640 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, 1646 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
1641 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, 1647 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) },
1642 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, 1648 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) },
1643 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) },
1644 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, 1649 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) },
1645 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) }, 1650 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) },
1646 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, 1651 { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index f65cace77729..92a0d61a7379 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -140,7 +140,9 @@
140#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577 140#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577
141 141
142#define USB_VENDOR_ID_CANDO 0x2087 142#define USB_VENDOR_ID_CANDO 0x2087
143#define USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH 0x0703
143#define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 144#define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01
145#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1 0x0a02
144#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 146#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03
145#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 147#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01
146 148
@@ -186,6 +188,7 @@
186#define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 188#define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61
187#define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 189#define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64
188#define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1 190#define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1
191#define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001
189 192
190#define USB_VENDOR_ID_DEALEXTREAME 0x10c5 193#define USB_VENDOR_ID_DEALEXTREAME 0x10c5
191#define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a 194#define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a
@@ -236,6 +239,7 @@
236#define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 239#define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002
237 240
238#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 241#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
242#define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0001
239 243
240#define USB_VENDOR_ID_GLAB 0x06c2 244#define USB_VENDOR_ID_GLAB 0x06c2
241#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 245#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
@@ -318,6 +322,9 @@
318#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000 322#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000
319#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff 323#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff
320 324
325#define USB_VENDOR_ID_HANVON 0x20b3
326#define USB_DEVICE_ID_HANVON_MULTITOUCH 0x0a18
327
321#define USB_VENDOR_ID_HAPP 0x078b 328#define USB_VENDOR_ID_HAPP 0x078b
322#define USB_DEVICE_ID_UGCI_DRIVING 0x0010 329#define USB_DEVICE_ID_UGCI_DRIVING 0x0010
323#define USB_DEVICE_ID_UGCI_FLYING 0x0020 330#define USB_DEVICE_ID_UGCI_FLYING 0x0020
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index e60fdb88101f..7f552bfad32c 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -290,6 +290,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
290 goto ignore; 290 goto ignore;
291 } 291 }
292 292
293 if (field->report_type == HID_FEATURE_REPORT) {
294 if (device->driver->feature_mapping) {
295 device->driver->feature_mapping(device, hidinput, field,
296 usage);
297 }
298 goto ignore;
299 }
300
293 if (device->driver->input_mapping) { 301 if (device->driver->input_mapping) {
294 int ret = device->driver->input_mapping(device, hidinput, field, 302 int ret = device->driver->input_mapping(device, hidinput, field,
295 usage, &bit, &max); 303 usage, &bit, &max);
@@ -839,7 +847,6 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
839 struct hid_input *hidinput = NULL; 847 struct hid_input *hidinput = NULL;
840 struct input_dev *input_dev; 848 struct input_dev *input_dev;
841 int i, j, k; 849 int i, j, k;
842 int max_report_type = HID_OUTPUT_REPORT;
843 850
844 INIT_LIST_HEAD(&hid->inputs); 851 INIT_LIST_HEAD(&hid->inputs);
845 852
@@ -856,10 +863,11 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
856 return -1; 863 return -1;
857 } 864 }
858 865
859 if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) 866 for (k = HID_INPUT_REPORT; k <= HID_FEATURE_REPORT; k++) {
860 max_report_type = HID_INPUT_REPORT; 867 if (k == HID_OUTPUT_REPORT &&
868 hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
869 continue;
861 870
862 for (k = HID_INPUT_REPORT; k <= max_report_type; k++)
863 list_for_each_entry(report, &hid->report_enum[k].report_list, list) { 871 list_for_each_entry(report, &hid->report_enum[k].report_list, list) {
864 872
865 if (!report->maxfield) 873 if (!report->maxfield)
@@ -912,6 +920,7 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
912 hidinput = NULL; 920 hidinput = NULL;
913 } 921 }
914 } 922 }
923 }
915 924
916 if (hidinput && input_register_device(hidinput->input)) 925 if (hidinput && input_register_device(hidinput->input))
917 goto out_cleanup; 926 goto out_cleanup;
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c
index 9fb050ce6f04..aed7ffe36283 100644
--- a/drivers/hid/hid-mosart.c
+++ b/drivers/hid/hid-mosart.c
@@ -257,6 +257,7 @@ static void mosart_remove(struct hid_device *hdev)
257static const struct hid_device_id mosart_devices[] = { 257static const struct hid_device_id mosart_devices[] = {
258 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, 258 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
259 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, 259 { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
260 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
260 { } 261 { }
261}; 262};
262MODULE_DEVICE_TABLE(hid, mosart_devices); 263MODULE_DEVICE_TABLE(hid, mosart_devices);
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
new file mode 100644
index 000000000000..07d3183fdde5
--- /dev/null
+++ b/drivers/hid/hid-multitouch.c
@@ -0,0 +1,516 @@
1/*
2 * HID driver for multitouch panels
3 *
4 * Copyright (c) 2010-2011 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
7 *
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
14 * any later version.
15 */
16
17#include <linux/device.h>
18#include <linux/hid.h>
19#include <linux/module.h>
20#include <linux/slab.h>
21#include <linux/usb.h>
22#include <linux/input/mt.h>
23#include "usbhid/usbhid.h"
24
25
26MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
27MODULE_DESCRIPTION("HID multitouch panels");
28MODULE_LICENSE("GPL");
29
30#include "hid-ids.h"
31
32/* quirks to control the device */
33#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
34#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
35#define MT_QUIRK_CYPRESS (1 << 2)
36#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
37#define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
38#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
39
40struct mt_slot {
41 __s32 x, y, p, w, h;
42 __s32 contactid; /* the device ContactID assigned to this slot */
43 bool touch_state; /* is the touch valid? */
44 bool seen_in_this_frame;/* has this slot been updated */
45};
46
47struct mt_device {
48 struct mt_slot curdata; /* placeholder of incoming data */
49 struct mt_class *mtclass; /* our mt device class */
50 unsigned last_field_index; /* last field index of the report */
51 unsigned last_slot_field; /* the last field of a slot */
52 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
53 __u8 num_received; /* how many contacts we received */
54 __u8 num_expected; /* expected last contact index */
55 bool curvalid; /* is the current contact valid? */
56 struct mt_slot slots[0]; /* first slot */
57};
58
59struct mt_class {
60 __s32 name; /* MT_CLS */
61 __s32 quirks;
62 __s32 sn_move; /* Signal/noise ratio for move events */
63 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
64 __u8 maxcontacts;
65};
66
67/* classes of device behavior */
68#define MT_CLS_DEFAULT 1
69#define MT_CLS_DUAL1 2
70#define MT_CLS_DUAL2 3
71#define MT_CLS_CYPRESS 4
72
73/*
74 * these device-dependent functions determine what slot corresponds
75 * to a valid contact that was just read.
76 */
77
78static int cypress_compute_slot(struct mt_device *td)
79{
80 if (td->curdata.contactid != 0 || td->num_received == 0)
81 return td->curdata.contactid;
82 else
83 return -1;
84}
85
86static int find_slot_from_contactid(struct mt_device *td)
87{
88 int i;
89 for (i = 0; i < td->mtclass->maxcontacts; ++i) {
90 if (td->slots[i].contactid == td->curdata.contactid &&
91 td->slots[i].touch_state)
92 return i;
93 }
94 for (i = 0; i < td->mtclass->maxcontacts; ++i) {
95 if (!td->slots[i].seen_in_this_frame &&
96 !td->slots[i].touch_state)
97 return i;
98 }
99 /* should not occurs. If this happens that means
100 * that the device sent more touches that it says
101 * in the report descriptor. It is ignored then. */
102 return -1;
103}
104
105struct mt_class mt_classes[] = {
106 { .name = MT_CLS_DEFAULT,
107 .quirks = MT_QUIRK_VALID_IS_INRANGE,
108 .maxcontacts = 10 },
109 { .name = MT_CLS_DUAL1,
110 .quirks = MT_QUIRK_VALID_IS_INRANGE |
111 MT_QUIRK_SLOT_IS_CONTACTID,
112 .maxcontacts = 2 },
113 { .name = MT_CLS_DUAL2,
114 .quirks = MT_QUIRK_VALID_IS_INRANGE |
115 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
116 .maxcontacts = 2 },
117 { .name = MT_CLS_CYPRESS,
118 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
119 MT_QUIRK_CYPRESS,
120 .maxcontacts = 10 },
121
122 { }
123};
124
125static void mt_feature_mapping(struct hid_device *hdev, struct hid_input *hi,
126 struct hid_field *field, struct hid_usage *usage)
127{
128 if (usage->hid == HID_DG_INPUTMODE) {
129 struct mt_device *td = hid_get_drvdata(hdev);
130 td->inputmode = field->report->id;
131 }
132}
133
134static void set_abs(struct input_dev *input, unsigned int code,
135 struct hid_field *field, int snratio)
136{
137 int fmin = field->logical_minimum;
138 int fmax = field->logical_maximum;
139 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
140 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
141}
142
143static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
144 struct hid_field *field, struct hid_usage *usage,
145 unsigned long **bit, int *max)
146{
147 struct mt_device *td = hid_get_drvdata(hdev);
148 struct mt_class *cls = td->mtclass;
149 switch (usage->hid & HID_USAGE_PAGE) {
150
151 case HID_UP_GENDESK:
152 switch (usage->hid) {
153 case HID_GD_X:
154 hid_map_usage(hi, usage, bit, max,
155 EV_ABS, ABS_MT_POSITION_X);
156 set_abs(hi->input, ABS_MT_POSITION_X, field,
157 cls->sn_move);
158 /* touchscreen emulation */
159 set_abs(hi->input, ABS_X, field, cls->sn_move);
160 td->last_slot_field = usage->hid;
161 return 1;
162 case HID_GD_Y:
163 hid_map_usage(hi, usage, bit, max,
164 EV_ABS, ABS_MT_POSITION_Y);
165 set_abs(hi->input, ABS_MT_POSITION_Y, field,
166 cls->sn_move);
167 /* touchscreen emulation */
168 set_abs(hi->input, ABS_Y, field, cls->sn_move);
169 td->last_slot_field = usage->hid;
170 return 1;
171 }
172 return 0;
173
174 case HID_UP_DIGITIZER:
175 switch (usage->hid) {
176 case HID_DG_INRANGE:
177 td->last_slot_field = usage->hid;
178 return 1;
179 case HID_DG_CONFIDENCE:
180 td->last_slot_field = usage->hid;
181 return 1;
182 case HID_DG_TIPSWITCH:
183 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
184 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
185 td->last_slot_field = usage->hid;
186 return 1;
187 case HID_DG_CONTACTID:
188 input_mt_init_slots(hi->input,
189 td->mtclass->maxcontacts);
190 td->last_slot_field = usage->hid;
191 return 1;
192 case HID_DG_WIDTH:
193 hid_map_usage(hi, usage, bit, max,
194 EV_ABS, ABS_MT_TOUCH_MAJOR);
195 td->last_slot_field = usage->hid;
196 return 1;
197 case HID_DG_HEIGHT:
198 hid_map_usage(hi, usage, bit, max,
199 EV_ABS, ABS_MT_TOUCH_MINOR);
200 field->logical_maximum = 1;
201 field->logical_minimum = 0;
202 set_abs(hi->input, ABS_MT_ORIENTATION, field, 0);
203 td->last_slot_field = usage->hid;
204 return 1;
205 case HID_DG_TIPPRESSURE:
206 hid_map_usage(hi, usage, bit, max,
207 EV_ABS, ABS_MT_PRESSURE);
208 set_abs(hi->input, ABS_MT_PRESSURE, field,
209 cls->sn_pressure);
210 /* touchscreen emulation */
211 set_abs(hi->input, ABS_PRESSURE, field,
212 cls->sn_pressure);
213 td->last_slot_field = usage->hid;
214 return 1;
215 case HID_DG_CONTACTCOUNT:
216 td->last_field_index = field->report->maxfield - 1;
217 return 1;
218 case HID_DG_CONTACTMAX:
219 /* we don't set td->last_slot_field as contactcount and
220 * contact max are global to the report */
221 return -1;
222 }
223 /* let hid-input decide for the others */
224 return 0;
225
226 case 0xff000000:
227 /* we do not want to map these: no input-oriented meaning */
228 return -1;
229 }
230
231 return 0;
232}
233
234static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
235 struct hid_field *field, struct hid_usage *usage,
236 unsigned long **bit, int *max)
237{
238 if (usage->type == EV_KEY || usage->type == EV_ABS)
239 set_bit(usage->type, hi->input->evbit);
240
241 return -1;
242}
243
244static int mt_compute_slot(struct mt_device *td)
245{
246 __s32 quirks = td->mtclass->quirks;
247
248 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
249 return td->curdata.contactid;
250
251 if (quirks & MT_QUIRK_CYPRESS)
252 return cypress_compute_slot(td);
253
254 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
255 return td->num_received;
256
257 return find_slot_from_contactid(td);
258}
259
260/*
261 * this function is called when a whole contact has been processed,
262 * so that it can assign it to a slot and store the data there
263 */
264static void mt_complete_slot(struct mt_device *td)
265{
266 td->curdata.seen_in_this_frame = true;
267 if (td->curvalid) {
268 int slotnum = mt_compute_slot(td);
269
270 if (slotnum >= 0 && slotnum < td->mtclass->maxcontacts)
271 td->slots[slotnum] = td->curdata;
272 }
273 td->num_received++;
274}
275
276
277/*
278 * this function is called when a whole packet has been received and processed,
279 * so that it can decide what to send to the input layer.
280 */
281static void mt_emit_event(struct mt_device *td, struct input_dev *input)
282{
283 int i;
284
285 for (i = 0; i < td->mtclass->maxcontacts; ++i) {
286 struct mt_slot *s = &(td->slots[i]);
287 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
288 !s->seen_in_this_frame) {
289 s->touch_state = false;
290 }
291
292 input_mt_slot(input, i);
293 input_mt_report_slot_state(input, MT_TOOL_FINGER,
294 s->touch_state);
295 if (s->touch_state) {
296 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
297 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
298 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
299 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, s->w);
300 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, s->h);
301 }
302 s->seen_in_this_frame = false;
303
304 }
305
306 input_mt_report_pointer_emulation(input, true);
307 input_sync(input);
308 td->num_received = 0;
309}
310
311
312
313static int mt_event(struct hid_device *hid, struct hid_field *field,
314 struct hid_usage *usage, __s32 value)
315{
316 struct mt_device *td = hid_get_drvdata(hid);
317 __s32 quirks = td->mtclass->quirks;
318
319 if (hid->claimed & HID_CLAIMED_INPUT) {
320 switch (usage->hid) {
321 case HID_DG_INRANGE:
322 if (quirks & MT_QUIRK_VALID_IS_INRANGE)
323 td->curvalid = value;
324 break;
325 case HID_DG_TIPSWITCH:
326 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
327 td->curvalid = value;
328 td->curdata.touch_state = value;
329 break;
330 case HID_DG_CONFIDENCE:
331 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
332 td->curvalid = value;
333 break;
334 case HID_DG_CONTACTID:
335 td->curdata.contactid = value;
336 break;
337 case HID_DG_TIPPRESSURE:
338 td->curdata.p = value;
339 break;
340 case HID_GD_X:
341 td->curdata.x = value;
342 break;
343 case HID_GD_Y:
344 td->curdata.y = value;
345 break;
346 case HID_DG_WIDTH:
347 td->curdata.w = value;
348 break;
349 case HID_DG_HEIGHT:
350 td->curdata.h = value;
351 break;
352 case HID_DG_CONTACTCOUNT:
353 /*
354 * Includes multi-packet support where subsequent
355 * packets are sent with zero contactcount.
356 */
357 if (value)
358 td->num_expected = value;
359 break;
360
361 default:
362 /* fallback to the generic hidinput handling */
363 return 0;
364 }
365
366 if (usage->hid == td->last_slot_field)
367 mt_complete_slot(td);
368
369 if (field->index == td->last_field_index
370 && td->num_received >= td->num_expected)
371 mt_emit_event(td, field->hidinput->input);
372
373 }
374
375 /* we have handled the hidinput part, now remains hiddev */
376 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
377 hid->hiddev_hid_event(hid, field, usage, value);
378
379 return 1;
380}
381
382static void mt_set_input_mode(struct hid_device *hdev)
383{
384 struct mt_device *td = hid_get_drvdata(hdev);
385 struct hid_report *r;
386 struct hid_report_enum *re;
387
388 if (td->inputmode < 0)
389 return;
390
391 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
392 r = re->report_id_hash[td->inputmode];
393 if (r) {
394 r->field[0]->value[0] = 0x02;
395 usbhid_submit_report(hdev, r, USB_DIR_OUT);
396 }
397}
398
399static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
400{
401 int ret, i;
402 struct mt_device *td;
403 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
404
405 for (i = 0; mt_classes[i].name ; i++) {
406 if (id->driver_data == mt_classes[i].name) {
407 mtclass = &(mt_classes[i]);
408 break;
409 }
410 }
411
412 /* This allows the driver to correctly support devices
413 * that emit events over several HID messages.
414 */
415 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
416
417 td = kzalloc(sizeof(struct mt_device) +
418 mtclass->maxcontacts * sizeof(struct mt_slot),
419 GFP_KERNEL);
420 if (!td) {
421 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
422 return -ENOMEM;
423 }
424 td->mtclass = mtclass;
425 td->inputmode = -1;
426 hid_set_drvdata(hdev, td);
427
428 ret = hid_parse(hdev);
429 if (ret != 0)
430 goto fail;
431
432 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
433 if (ret)
434 goto fail;
435
436 mt_set_input_mode(hdev);
437
438 return 0;
439
440fail:
441 kfree(td);
442 return ret;
443}
444
445#ifdef CONFIG_PM
446static int mt_reset_resume(struct hid_device *hdev)
447{
448 mt_set_input_mode(hdev);
449 return 0;
450}
451#endif
452
453static void mt_remove(struct hid_device *hdev)
454{
455 struct mt_device *td = hid_get_drvdata(hdev);
456 hid_hw_stop(hdev);
457 kfree(td);
458 hid_set_drvdata(hdev, NULL);
459}
460
461static const struct hid_device_id mt_devices[] = {
462
463 /* Cypress panel */
464 { .driver_data = MT_CLS_CYPRESS,
465 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
466 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
467
468 /* GeneralTouch panel */
469 { .driver_data = MT_CLS_DUAL2,
470 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
471 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
472
473 /* PixCir-based panels */
474 { .driver_data = MT_CLS_DUAL1,
475 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
476 USB_DEVICE_ID_HANVON_MULTITOUCH) },
477 { .driver_data = MT_CLS_DUAL1,
478 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
479 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
480
481 { }
482};
483MODULE_DEVICE_TABLE(hid, mt_devices);
484
485static const struct hid_usage_id mt_grabbed_usages[] = {
486 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
487 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
488};
489
490static struct hid_driver mt_driver = {
491 .name = "hid-multitouch",
492 .id_table = mt_devices,
493 .probe = mt_probe,
494 .remove = mt_remove,
495 .input_mapping = mt_input_mapping,
496 .input_mapped = mt_input_mapped,
497 .feature_mapping = mt_feature_mapping,
498 .usage_table = mt_grabbed_usages,
499 .event = mt_event,
500#ifdef CONFIG_PM
501 .reset_resume = mt_reset_resume,
502#endif
503};
504
505static int __init mt_init(void)
506{
507 return hid_register_driver(&mt_driver);
508}
509
510static void __exit mt_exit(void)
511{
512 hid_unregister_driver(&mt_driver);
513}
514
515module_init(mt_init);
516module_exit(mt_exit);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 76b9a149c7df..9a94b643ccde 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -35,7 +35,6 @@ static const struct hid_blacklist {
35 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 35 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
36 { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, 36 { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET },
37 { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, 37 { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT },
38 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT },
39 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 38 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
40 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 39 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
41 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 40 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },