summaryrefslogtreecommitdiff
path: root/usr/src/dkms_source_tree
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/dkms_source_tree')
-rw-r--r--usr/src/dkms_source_tree/Makefile5
-rw-r--r--usr/src/dkms_source_tree/dkms.conf10
-rw-r--r--usr/src/dkms_source_tree/hid-ids.h601
-rw-r--r--usr/src/dkms_source_tree/hid-multitouch.c660
-rw-r--r--usr/src/dkms_source_tree/input-mt.h155
-rw-r--r--usr/src/dkms_source_tree/usbhid.h106
6 files changed, 1537 insertions, 0 deletions
diff --git a/usr/src/dkms_source_tree/Makefile b/usr/src/dkms_source_tree/Makefile
new file mode 100644
index 0000000..3a1990a
--- /dev/null
+++ b/usr/src/dkms_source_tree/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for input/mouse drivers
3#
4
5obj-m := hid-multitouch.o
diff --git a/usr/src/dkms_source_tree/dkms.conf b/usr/src/dkms_source_tree/dkms.conf
new file mode 100644
index 0000000..50f64db
--- /dev/null
+++ b/usr/src/dkms_source_tree/dkms.conf
@@ -0,0 +1,10 @@
1NAME=hid-multitouch
2VERSION=1.0.0
3PACKAGE_NAME="$NAME"
4PACKAGE_VERSION="$VERSION"
5MAKE[0]="make -C ${kernel_source_dir}
6 SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
7BUILT_MODULE_NAME[0]="hid-multitouch"
8DEST_MODULE_LOCATION[0]="/kernel/drivers/hid"
9POST_INSTALL="scripts/hid-multitouch-post-install"
10AUTOINSTALL="yes"
diff --git a/usr/src/dkms_source_tree/hid-ids.h b/usr/src/dkms_source_tree/hid-ids.h
new file mode 100644
index 0000000..b1dd7ad
--- /dev/null
+++ b/usr/src/dkms_source_tree/hid-ids.h
@@ -0,0 +1,601 @@
1/*
2 * USB HID quirks support for Linux
3 *
4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2007 Paul Walmsley
9 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 */
17
18#ifndef HID_IDS_H_FILE
19#define HID_IDS_H_FILE
20
21#define USB_VENDOR_ID_3M 0x0596
22#define USB_DEVICE_ID_3M1968 0x0500
23#define USB_DEVICE_ID_3M2256 0x0502
24
25#define USB_VENDOR_ID_A4TECH 0x09da
26#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
27#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
28#define USB_DEVICE_ID_A4TECH_RP_649 0x001a
29
30#define USB_VENDOR_ID_AASHIMA 0x06d6
31#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
32#define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026
33
34#define USB_VENDOR_ID_ACECAD 0x0460
35#define USB_DEVICE_ID_ACECAD_FLAIR 0x0004
36#define USB_DEVICE_ID_ACECAD_302 0x0008
37
38#define USB_VENDOR_ID_ACRUX 0x1a34
39
40#define USB_VENDOR_ID_ADS_TECH 0x06e1
41#define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155
42
43#define USB_VENDOR_ID_AFATECH 0x15a4
44#define USB_DEVICE_ID_AFATECH_AF9016 0x9016
45
46#define USB_VENDOR_ID_AIPTEK 0x08ca
47#define USB_DEVICE_ID_AIPTEK_01 0x0001
48#define USB_DEVICE_ID_AIPTEK_10 0x0010
49#define USB_DEVICE_ID_AIPTEK_20 0x0020
50#define USB_DEVICE_ID_AIPTEK_21 0x0021
51#define USB_DEVICE_ID_AIPTEK_22 0x0022
52#define USB_DEVICE_ID_AIPTEK_23 0x0023
53#define USB_DEVICE_ID_AIPTEK_24 0x0024
54
55#define USB_VENDOR_ID_AIRCABLE 0x16CA
56#define USB_DEVICE_ID_AIRCABLE1 0x1502
57
58#define USB_VENDOR_ID_ALCOR 0x058f
59#define USB_DEVICE_ID_ALCOR_USBRS232 0x9720
60
61#define USB_VENDOR_ID_ALPS 0x0433
62#define USB_DEVICE_ID_IBM_GAMEPAD 0x1101
63
64#define USB_VENDOR_ID_APPLE 0x05ac
65#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
66#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
67#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e
68#define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e
69#define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f
70#define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214
71#define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215
72#define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216
73#define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217
74#define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218
75#define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219
76#define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021a
77#define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021b
78#define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021c
79#define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d
80#define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e
81#define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f
82#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
83#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
84#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
85#define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223
86#define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224
87#define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225
88#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229
89#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
90#define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
91#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
92#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
93#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
94#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230
95#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231
96#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
100#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
101#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
102#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
103#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
104#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
105#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
106#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
107#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
108#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
109#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
110#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
111#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
112#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
113
114#define USB_VENDOR_ID_ASUS 0x0486
115#define USB_DEVICE_ID_ASUS_T91MT 0x0185
116#define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO 0x0186
117
118#define USB_VENDOR_ID_ASUSTEK 0x0b05
119#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
120#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
121
122#define USB_VENDOR_ID_ATEN 0x0557
123#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
124#define USB_DEVICE_ID_ATEN_CS124U 0x2202
125#define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204
126#define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205
127#define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208
128
129#define USB_VENDOR_ID_AVERMEDIA 0x07ca
130#define USB_DEVICE_ID_AVER_FM_MR800 0xb800
131
132#define USB_VENDOR_ID_BELKIN 0x050d
133#define USB_DEVICE_ID_FLIP_KVM 0x3201
134
135#define USB_VENDOR_ID_BERKSHIRE 0x0c98
136#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
137
138#define USB_VENDOR_ID_BTC 0x046e
139#define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578
140#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577
141
142#define USB_VENDOR_ID_CANDO 0x2087
143#define USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH 0x0703
144#define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01
145#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1 0x0a02
146#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03
147#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01
148
149#define USB_VENDOR_ID_CH 0x068e
150#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2
151#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4
152#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051
153#define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff
154#define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3
155#define USB_DEVICE_ID_CH_AXIS_295 0x001c
156
157#define USB_VENDOR_ID_CHERRY 0x046a
158#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
159#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
160
161#define USB_VENDOR_ID_CHIC 0x05fe
162#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014
163
164#define USB_VENDOR_ID_CHICONY 0x04f2
165#define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
166#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d
167#define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
168
169#define USB_VENDOR_ID_CIDC 0x1677
170
171#define USB_VENDOR_ID_CMEDIA 0x0d8c
172#define USB_DEVICE_ID_CM109 0x000e
173
174#define USB_VENDOR_ID_CODEMERCS 0x07c0
175#define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500
176#define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff
177
178#define USB_VENDOR_ID_CREATIVELABS 0x041e
179#define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
180
181#define USB_VENDOR_ID_CYGNAL 0x10c4
182#define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a
183
184#define USB_VENDOR_ID_CYPRESS 0x04b4
185#define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001
186#define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500
187#define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417
188#define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61
189#define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64
190#define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1
191#define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001
192
193#define USB_VENDOR_ID_DEALEXTREAME 0x10c5
194#define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a
195
196#define USB_VENDOR_ID_DELORME 0x1163
197#define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
198#define USB_DEVICE_ID_DELORME_EM_LT20 0x0200
199
200#define USB_VENDOR_ID_DMI 0x0c0b
201#define USB_DEVICE_ID_DMI_ENC 0x5fab
202
203#define USB_VENDOR_ID_DRAGONRISE 0x0079
204
205#define USB_VENDOR_ID_DWAV 0x0eef
206#define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001
207#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d
208#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1 0x720c
209#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2 0x72a1
210#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3 0x480e
211#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4 0x726b
212
213#define USB_VENDOR_ID_ELECOM 0x056e
214#define USB_DEVICE_ID_ELECOM_BM084 0x0061
215
216#define USB_VENDOR_ID_DREAM_CHEEKY 0x1d34
217
218#define USB_VENDOR_ID_ELO 0x04E7
219#define USB_DEVICE_ID_ELO_TS2700 0x0020
220
221#define USB_VENDOR_ID_EMS 0x2006
222#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
223
224#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
225#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
226
227#define USB_VENDOR_ID_ETT 0x0664
228#define USB_DEVICE_ID_TC5UH 0x0309
229#define USB_DEVICE_ID_TC4UM 0x0306
230
231#define USB_VENDOR_ID_ETURBOTOUCH 0x22b9
232#define USB_DEVICE_ID_ETURBOTOUCH 0x0006
233
234#define USB_VENDOR_ID_EZKEY 0x0518
235#define USB_DEVICE_ID_BTC_8193 0x0002
236
237#define USB_VENDOR_ID_GAMERON 0x0810
238#define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001
239#define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002
240
241#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
242#define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0001
243
244#define USB_VENDOR_ID_GLAB 0x06c2
245#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
246#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
247#define USB_DEVICE_ID_0_0_4_IF_KIT 0x0040
248#define USB_DEVICE_ID_0_16_16_IF_KIT 0x0044
249#define USB_DEVICE_ID_8_8_8_IF_KIT 0x0045
250#define USB_DEVICE_ID_0_8_7_IF_KIT 0x0051
251#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053
252#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058
253
254#define USB_VENDOR_ID_GOTOP 0x08f2
255#define USB_DEVICE_ID_SUPER_Q2 0x007f
256#define USB_DEVICE_ID_GOGOPEN 0x00ce
257#define USB_DEVICE_ID_PENPOWER 0x00f4
258
259#define USB_VENDOR_ID_GREENASIA 0x0e8f
260
261#define USB_VENDOR_ID_GRETAGMACBETH 0x0971
262#define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005
263
264#define USB_VENDOR_ID_GRIFFIN 0x077d
265#define USB_DEVICE_ID_POWERMATE 0x0410
266#define USB_DEVICE_ID_SOUNDKNOB 0x04AA
267
268#define USB_VENDOR_ID_GTCO 0x078c
269#define USB_DEVICE_ID_GTCO_90 0x0090
270#define USB_DEVICE_ID_GTCO_100 0x0100
271#define USB_DEVICE_ID_GTCO_101 0x0101
272#define USB_DEVICE_ID_GTCO_103 0x0103
273#define USB_DEVICE_ID_GTCO_104 0x0104
274#define USB_DEVICE_ID_GTCO_105 0x0105
275#define USB_DEVICE_ID_GTCO_106 0x0106
276#define USB_DEVICE_ID_GTCO_107 0x0107
277#define USB_DEVICE_ID_GTCO_108 0x0108
278#define USB_DEVICE_ID_GTCO_200 0x0200
279#define USB_DEVICE_ID_GTCO_201 0x0201
280#define USB_DEVICE_ID_GTCO_202 0x0202
281#define USB_DEVICE_ID_GTCO_203 0x0203
282#define USB_DEVICE_ID_GTCO_204 0x0204
283#define USB_DEVICE_ID_GTCO_205 0x0205
284#define USB_DEVICE_ID_GTCO_206 0x0206
285#define USB_DEVICE_ID_GTCO_207 0x0207
286#define USB_DEVICE_ID_GTCO_300 0x0300
287#define USB_DEVICE_ID_GTCO_301 0x0301
288#define USB_DEVICE_ID_GTCO_302 0x0302
289#define USB_DEVICE_ID_GTCO_303 0x0303
290#define USB_DEVICE_ID_GTCO_304 0x0304
291#define USB_DEVICE_ID_GTCO_305 0x0305
292#define USB_DEVICE_ID_GTCO_306 0x0306
293#define USB_DEVICE_ID_GTCO_307 0x0307
294#define USB_DEVICE_ID_GTCO_308 0x0308
295#define USB_DEVICE_ID_GTCO_309 0x0309
296#define USB_DEVICE_ID_GTCO_400 0x0400
297#define USB_DEVICE_ID_GTCO_401 0x0401
298#define USB_DEVICE_ID_GTCO_402 0x0402
299#define USB_DEVICE_ID_GTCO_403 0x0403
300#define USB_DEVICE_ID_GTCO_404 0x0404
301#define USB_DEVICE_ID_GTCO_405 0x0405
302#define USB_DEVICE_ID_GTCO_500 0x0500
303#define USB_DEVICE_ID_GTCO_501 0x0501
304#define USB_DEVICE_ID_GTCO_502 0x0502
305#define USB_DEVICE_ID_GTCO_503 0x0503
306#define USB_DEVICE_ID_GTCO_504 0x0504
307#define USB_DEVICE_ID_GTCO_1000 0x1000
308#define USB_DEVICE_ID_GTCO_1001 0x1001
309#define USB_DEVICE_ID_GTCO_1002 0x1002
310#define USB_DEVICE_ID_GTCO_1003 0x1003
311#define USB_DEVICE_ID_GTCO_1004 0x1004
312#define USB_DEVICE_ID_GTCO_1005 0x1005
313#define USB_DEVICE_ID_GTCO_1006 0x1006
314#define USB_DEVICE_ID_GTCO_1007 0x1007
315
316#define USB_VENDOR_ID_GYRATION 0x0c16
317#define USB_DEVICE_ID_GYRATION_REMOTE 0x0002
318#define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003
319#define USB_DEVICE_ID_GYRATION_REMOTE_3 0x0008
320
321#define USB_VENDOR_ID_HANWANG 0x0b57
322#define USB_DEVICE_ID_HANWANG_TABLET_FIRST 0x5000
323#define USB_DEVICE_ID_HANWANG_TABLET_LAST 0x8fff
324
325#define USB_VENDOR_ID_HANVON 0x20b3
326#define USB_DEVICE_ID_HANVON_MULTITOUCH 0x0a18
327
328#define USB_VENDOR_ID_HAPP 0x078b
329#define USB_DEVICE_ID_UGCI_DRIVING 0x0010
330#define USB_DEVICE_ID_UGCI_FLYING 0x0020
331#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030
332
333#define USB_VENDOR_ID_IMATION 0x0718
334#define USB_DEVICE_ID_DISC_STAKKA 0xd000
335
336#define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615
337#define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070
338
339#define USB_VENDOR_ID_JESS 0x0c45
340#define USB_DEVICE_ID_JESS_YUREX 0x1010
341
342#define USB_VENDOR_ID_KBGEAR 0x084e
343#define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001
344
345#define USB_VENDOR_ID_KENSINGTON 0x047d
346#define USB_DEVICE_ID_KS_SLIMBLADE 0x2041
347
348#define USB_VENDOR_ID_KWORLD 0x1b80
349#define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700
350
351#define USB_VENDOR_ID_KYE 0x0458
352#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
353#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
354
355#define USB_VENDOR_ID_LABTEC 0x1020
356#define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006
357
358#define USB_VENDOR_ID_LD 0x0f11
359#define USB_DEVICE_ID_LD_CASSY 0x1000
360#define USB_DEVICE_ID_LD_POCKETCASSY 0x1010
361#define USB_DEVICE_ID_LD_MOBILECASSY 0x1020
362#define USB_DEVICE_ID_LD_JWM 0x1080
363#define USB_DEVICE_ID_LD_DMMP 0x1081
364#define USB_DEVICE_ID_LD_UMIP 0x1090
365#define USB_DEVICE_ID_LD_XRAY1 0x1100
366#define USB_DEVICE_ID_LD_XRAY2 0x1101
367#define USB_DEVICE_ID_LD_VIDEOCOM 0x1200
368#define USB_DEVICE_ID_LD_COM3LAB 0x2000
369#define USB_DEVICE_ID_LD_TELEPORT 0x2010
370#define USB_DEVICE_ID_LD_NETWORKANALYSER 0x2020
371#define USB_DEVICE_ID_LD_POWERCONTROL 0x2030
372#define USB_DEVICE_ID_LD_MACHINETEST 0x2040
373
374#define USB_VENDOR_ID_LOGITECH 0x046d
375#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
376#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
377#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
378#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a
379#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211
380#define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215
381#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218
382#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219
383#define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283
384#define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286
385#define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287
386#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294
387#define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293
388#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295
389#define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299
390#define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c
391#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
392#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
393#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517
394#define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512
395#define USB_DEVICE_ID_MX3000_RECEIVER 0xc513
396#define USB_DEVICE_ID_SPACETRAVELLER 0xc623
397#define USB_DEVICE_ID_SPACENAVIGATOR 0xc626
398#define USB_DEVICE_ID_DINOVO_DESKTOP 0xc704
399#define USB_DEVICE_ID_DINOVO_EDGE 0xc714
400#define USB_DEVICE_ID_DINOVO_MINI 0xc71f
401#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03
402
403#define USB_VENDOR_ID_MCC 0x09db
404#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
405#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
406
407#define USB_VENDOR_ID_MGE 0x0463
408#define USB_DEVICE_ID_MGE_UPS 0xffff
409#define USB_DEVICE_ID_MGE_UPS1 0x0001
410
411#define USB_VENDOR_ID_MICROCHIP 0x04d8
412#define USB_DEVICE_ID_PICKIT1 0x0032
413#define USB_DEVICE_ID_PICKIT2 0x0033
414#define USB_DEVICE_ID_PICOLCD 0xc002
415#define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002
416
417#define USB_VENDOR_ID_MICROSOFT 0x045e
418#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
419#define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
420#define USB_DEVICE_ID_MS_NE4K 0x00db
421#define USB_DEVICE_ID_MS_LK6K 0x00f9
422#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
423#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
424
425#define USB_VENDOR_ID_MOJO 0x8282
426#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
427
428#define USB_VENDOR_ID_MONTEREY 0x0566
429#define USB_DEVICE_ID_GENIUS_KB29E 0x3004
430
431#define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400
432#define USB_DEVICE_ID_N_S_HARMONY 0xc359
433
434#define USB_VENDOR_ID_NATSU 0x08b7
435#define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001
436
437#define USB_VENDOR_ID_NCR 0x0404
438#define USB_DEVICE_ID_NCR_FIRST 0x0300
439#define USB_DEVICE_ID_NCR_LAST 0x03ff
440
441#define USB_VENDOR_ID_NEC 0x073e
442#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301
443
444#define USB_VENDOR_ID_NEXTWINDOW 0x1926
445#define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003
446
447#define USB_VENDOR_ID_NTRIG 0x1b96
448#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001
449#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003
450#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2 0x0004
451#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3 0x0005
452#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4 0x0006
453#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5 0x0007
454#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6 0x0008
455#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7 0x0009
456#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8 0x000A
457#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9 0x000B
458#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10 0x000C
459#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11 0x000D
460#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12 0x000E
461#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13 0x000F
462#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14 0x0010
463#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15 0x0011
464#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16 0x0012
465#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17 0x0013
466#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18 0x0014
467
468#define USB_VENDOR_ID_ONTRAK 0x0a07
469#define USB_DEVICE_ID_ONTRAK_ADU100 0x0064
470
471#define USB_VENDOR_ID_ORTEK 0x05a4
472#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
473
474#define USB_VENDOR_ID_PANJIT 0x134c
475
476#define USB_VENDOR_ID_PANTHERLORD 0x0810
477#define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK 0x0001
478
479#define USB_VENDOR_ID_PETALYNX 0x18b1
480#define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037
481
482#define USB_VENDOR_ID_PHILIPS 0x0471
483#define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617
484
485#define USB_VENDOR_ID_PI_ENGINEERING 0x05f3
486#define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff
487
488#define USB_VENDOR_ID_PLAYDOTCOM 0x0b43
489#define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003
490
491#define USB_VENDOR_ID_POWERCOM 0x0d9f
492#define USB_DEVICE_ID_POWERCOM_UPS 0x0002
493
494#define USB_VENDOR_ID_PRODIGE 0x05af
495#define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062
496
497#define USB_VENDOR_ID_QUANTA 0x0408
498#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000
499#define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN 0x3001
500
501#define USB_VENDOR_ID_ROCCAT 0x1e7d
502#define USB_DEVICE_ID_ROCCAT_KONE 0x2ced
503#define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51
504#define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24
505#define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6
506
507#define USB_VENDOR_ID_SAITEK 0x06a3
508#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
509
510#define USB_VENDOR_ID_SAMSUNG 0x0419
511#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
512#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600
513
514#define USB_VENDOR_ID_SONY 0x054c
515#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
516#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
517
518#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
519#define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034
520#define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST 0x0046
521
522#define USB_VENDOR_ID_STANTUM 0x1f87
523#define USB_DEVICE_ID_MTP 0x0002
524
525#define USB_VENDOR_ID_STANTUM_STM 0x0483
526#define USB_DEVICE_ID_MTP_STM 0x3261
527
528#define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403
529#define USB_DEVICE_ID_MTP_SITRONIX 0x5001
530
531#define USB_VENDOR_ID_SUN 0x0430
532#define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab
533
534#define USB_VENDOR_ID_SUNPLUS 0x04fc
535#define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8
536
537#define USB_VENDOR_ID_THRUSTMASTER 0x044f
538
539#define USB_VENDOR_ID_TOPSEED 0x0766
540#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
541
542#define USB_VENDOR_ID_TOPSEED2 0x1784
543#define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004
544
545#define USB_VENDOR_ID_TOPMAX 0x0663
546#define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103
547
548#define USB_VENDOR_ID_TOUCHPACK 0x1bfd
549#define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688
550
551#define USB_VENDOR_ID_TURBOX 0x062a
552#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
553#define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100
554
555#define USB_VENDOR_ID_TWINHAN 0x6253
556#define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100
557
558#define USB_VENDOR_ID_UCLOGIC 0x5543
559#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042
560#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001
561#define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003
562#define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004
563#define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005
564
565#define USB_VENDOR_ID_VERNIER 0x08f7
566#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001
567#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
568#define USB_DEVICE_ID_VERNIER_SKIP 0x0003
569#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
570#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
571
572#define USB_VENDOR_ID_WACOM 0x056a
573#define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81
574
575#define USB_VENDOR_ID_WALTOP 0x172f
576#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH 0x0032
577#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH 0x0034
578#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501
579#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500
580
581#define USB_VENDOR_ID_WISEGROUP 0x0925
582#define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005
583#define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101
584#define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104
585#define USB_DEVICE_ID_8_8_4_IF_KIT 0x8201
586#define USB_DEVICE_ID_QUAD_USB_JOYPAD 0x8800
587#define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866
588
589#define USB_VENDOR_ID_WISEGROUP_LTD 0x6666
590#define USB_VENDOR_ID_WISEGROUP_LTD2 0x6677
591#define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802
592
593#define USB_VENDOR_ID_YEALINK 0x6993
594#define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001
595
596#define USB_VENDOR_ID_ZEROPLUS 0x0c12
597
598#define USB_VENDOR_ID_ZYDACRON 0x13EC
599#define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006
600
601#endif
diff --git a/usr/src/dkms_source_tree/hid-multitouch.c b/usr/src/dkms_source_tree/hid-multitouch.c
new file mode 100644
index 0000000..02a6675
--- /dev/null
+++ b/usr/src/dkms_source_tree/hid-multitouch.c
@@ -0,0 +1,660 @@
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 * This code is partly based on hid-egalax.c:
9 *
10 * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
11 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
12 * Copyright (c) 2010 Canonical, Ltd.
13 *
14 * This code is partly based on hid-3m-pct.c:
15 *
16 * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
17 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
18 * Copyright (c) 2010 Canonical, Ltd.
19 *
20 */
21
22/*
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License as published by the Free
25 * Software Foundation; either version 2 of the License, or (at your option)
26 * any later version.
27 */
28
29#include <linux/device.h>
30#include <linux/hid.h>
31#include <linux/module.h>
32#include <linux/slab.h>
33#include <linux/usb.h>
34#include "input-mt.h"
35#include "usbhid.h"
36
37MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
38MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
39MODULE_DESCRIPTION("HID multitouch panels");
40MODULE_LICENSE("GPL");
41
42#include "hid-ids.h"
43
44/* quirks to control the device */
45#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
46#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
47#define MT_QUIRK_CYPRESS (1 << 2)
48#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
49#define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
50#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
51#define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
52
53struct mt_slot {
54 __s32 x, y, p, w, h;
55 __s32 contactid; /* the device ContactID assigned to this slot */
56 bool touch_state; /* is the touch valid? */
57 bool seen_in_this_frame;/* has this slot been updated */
58};
59
60struct mt_device {
61 struct mt_slot curdata; /* placeholder of incoming data */
62 struct mt_class *mtclass; /* our mt device class */
63 unsigned last_field_index; /* last field index of the report */
64 unsigned last_slot_field; /* the last field of a slot */
65 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
66 __u8 num_received; /* how many contacts we received */
67 __u8 num_expected; /* expected last contact index */
68 __u8 maxcontacts;
69 bool curvalid; /* is the current contact valid? */
70 struct mt_slot *slots;
71};
72
73struct mt_class {
74 __s32 name; /* MT_CLS */
75 __s32 quirks;
76 __s32 sn_move; /* Signal/noise ratio for move events */
77 __s32 sn_width; /* Signal/noise ratio for width events */
78 __s32 sn_height; /* Signal/noise ratio for height events */
79 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
80 __u8 maxcontacts;
81};
82
83/* classes of device behavior */
84#define MT_CLS_DEFAULT 1
85#define MT_CLS_DUAL_INRANGE_CONTACTID 2
86#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
87#define MT_CLS_CYPRESS 4
88#define MT_CLS_EGALAX 5
89#define MT_CLS_STANTUM 6
90#define MT_CLS_3M 7
91
92#define MT_DEFAULT_MAXCONTACT 10
93
94/*
95 * these device-dependent functions determine what slot corresponds
96 * to a valid contact that was just read.
97 */
98
99static int cypress_compute_slot(struct mt_device *td)
100{
101 if (td->curdata.contactid != 0 || td->num_received == 0)
102 return td->curdata.contactid;
103 else
104 return -1;
105}
106
107static int find_slot_from_contactid(struct mt_device *td)
108{
109 int i;
110 for (i = 0; i < td->maxcontacts; ++i) {
111 if (td->slots[i].contactid == td->curdata.contactid &&
112 td->slots[i].touch_state)
113 return i;
114 }
115 for (i = 0; i < td->maxcontacts; ++i) {
116 if (!td->slots[i].seen_in_this_frame &&
117 !td->slots[i].touch_state)
118 return i;
119 }
120 /* should not occurs. If this happens that means
121 * that the device sent more touches that it says
122 * in the report descriptor. It is ignored then. */
123 return -1;
124}
125
126struct mt_class mt_classes[] = {
127 { .name = MT_CLS_DEFAULT,
128 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
129 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
130 .quirks = MT_QUIRK_VALID_IS_INRANGE |
131 MT_QUIRK_SLOT_IS_CONTACTID,
132 .maxcontacts = 2 },
133 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
134 .quirks = MT_QUIRK_VALID_IS_INRANGE |
135 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
136 .maxcontacts = 2 },
137 { .name = MT_CLS_CYPRESS,
138 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
139 MT_QUIRK_CYPRESS,
140 .maxcontacts = 10 },
141
142 { .name = MT_CLS_EGALAX,
143 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
144 MT_QUIRK_VALID_IS_INRANGE |
145 MT_QUIRK_EGALAX_XYZ_FIXUP,
146 .maxcontacts = 2,
147 .sn_move = 4096,
148 .sn_pressure = 32,
149 },
150 { .name = MT_CLS_STANTUM,
151 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
152 { .name = MT_CLS_3M,
153 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
154 MT_QUIRK_SLOT_IS_CONTACTID,
155 .sn_move = 2048,
156 .sn_width = 128,
157 .sn_height = 128 },
158
159 { }
160};
161
162static void mt_feature_mapping(struct hid_device *hdev,
163 struct hid_field *field, struct hid_usage *usage)
164{
165 struct mt_device *td = hid_get_drvdata(hdev);
166
167 switch (usage->hid) {
168 case HID_DG_INPUTMODE:
169 td->inputmode = field->report->id;
170 break;
171 case HID_DG_CONTACTMAX:
172 td->maxcontacts = field->value[0];
173 if (td->mtclass->maxcontacts)
174 /* check if the maxcontacts is given by the class */
175 td->maxcontacts = td->mtclass->maxcontacts;
176
177 break;
178 }
179}
180
181static void set_abs(struct input_dev *input, unsigned int code,
182 struct hid_field *field, int snratio)
183{
184 int fmin = field->logical_minimum;
185 int fmax = field->logical_maximum;
186 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
187 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
188}
189
190static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
191 struct hid_field *field, struct hid_usage *usage,
192 unsigned long **bit, int *max)
193{
194 struct mt_device *td = hid_get_drvdata(hdev);
195 struct mt_class *cls = td->mtclass;
196 __s32 quirks = cls->quirks;
197
198 switch (usage->hid & HID_USAGE_PAGE) {
199
200 case HID_UP_GENDESK:
201 switch (usage->hid) {
202 case HID_GD_X:
203 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
204 field->logical_maximum = 32760;
205 hid_map_usage(hi, usage, bit, max,
206 EV_ABS, ABS_MT_POSITION_X);
207 set_abs(hi->input, ABS_MT_POSITION_X, field,
208 cls->sn_move);
209 /* touchscreen emulation */
210 set_abs(hi->input, ABS_X, field, cls->sn_move);
211 td->last_slot_field = usage->hid;
212 return 1;
213 case HID_GD_Y:
214 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
215 field->logical_maximum = 32760;
216 hid_map_usage(hi, usage, bit, max,
217 EV_ABS, ABS_MT_POSITION_Y);
218 set_abs(hi->input, ABS_MT_POSITION_Y, field,
219 cls->sn_move);
220 /* touchscreen emulation */
221 set_abs(hi->input, ABS_Y, field, cls->sn_move);
222 td->last_slot_field = usage->hid;
223 return 1;
224 }
225 return 0;
226
227 case HID_UP_DIGITIZER:
228 switch (usage->hid) {
229 case HID_DG_INRANGE:
230 td->last_slot_field = usage->hid;
231 return 1;
232 case HID_DG_CONFIDENCE:
233 td->last_slot_field = usage->hid;
234 return 1;
235 case HID_DG_TIPSWITCH:
236 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
237 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
238 td->last_slot_field = usage->hid;
239 return 1;
240 case HID_DG_CONTACTID:
241 input_mt_init_slots(hi->input, td->maxcontacts);
242 td->last_slot_field = usage->hid;
243 return 1;
244 case HID_DG_WIDTH:
245 hid_map_usage(hi, usage, bit, max,
246 EV_ABS, ABS_MT_TOUCH_MAJOR);
247 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
248 cls->sn_width);
249 td->last_slot_field = usage->hid;
250 return 1;
251 case HID_DG_HEIGHT:
252 hid_map_usage(hi, usage, bit, max,
253 EV_ABS, ABS_MT_TOUCH_MINOR);
254 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
255 cls->sn_height);
256 input_set_abs_params(hi->input,
257 ABS_MT_ORIENTATION, 0, 1, 0, 0);
258 td->last_slot_field = usage->hid;
259 return 1;
260 case HID_DG_TIPPRESSURE:
261 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
262 field->logical_minimum = 0;
263 hid_map_usage(hi, usage, bit, max,
264 EV_ABS, ABS_MT_PRESSURE);
265 set_abs(hi->input, ABS_MT_PRESSURE, field,
266 cls->sn_pressure);
267 /* touchscreen emulation */
268 set_abs(hi->input, ABS_PRESSURE, field,
269 cls->sn_pressure);
270 td->last_slot_field = usage->hid;
271 return 1;
272 case HID_DG_CONTACTCOUNT:
273 td->last_field_index = field->report->maxfield - 1;
274 return 1;
275 case HID_DG_CONTACTMAX:
276 /* we don't set td->last_slot_field as contactcount and
277 * contact max are global to the report */
278 return -1;
279 }
280 /* let hid-input decide for the others */
281 return 0;
282
283 case 0xff000000:
284 /* we do not want to map these: no input-oriented meaning */
285 return -1;
286 }
287
288 return 0;
289}
290
291static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
292 struct hid_field *field, struct hid_usage *usage,
293 unsigned long **bit, int *max)
294{
295 if (usage->type == EV_KEY || usage->type == EV_ABS)
296 set_bit(usage->type, hi->input->evbit);
297
298 return -1;
299}
300
301static int mt_compute_slot(struct mt_device *td)
302{
303 __s32 quirks = td->mtclass->quirks;
304
305 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
306 return td->curdata.contactid;
307
308 if (quirks & MT_QUIRK_CYPRESS)
309 return cypress_compute_slot(td);
310
311 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
312 return td->num_received;
313
314 return find_slot_from_contactid(td);
315}
316
317/*
318 * this function is called when a whole contact has been processed,
319 * so that it can assign it to a slot and store the data there
320 */
321static void mt_complete_slot(struct mt_device *td)
322{
323 td->curdata.seen_in_this_frame = true;
324 if (td->curvalid) {
325 int slotnum = mt_compute_slot(td);
326
327 if (slotnum >= 0 && slotnum < td->maxcontacts)
328 td->slots[slotnum] = td->curdata;
329 }
330 td->num_received++;
331}
332
333
334/*
335 * this function is called when a whole packet has been received and processed,
336 * so that it can decide what to send to the input layer.
337 */
338static void mt_emit_event(struct mt_device *td, struct input_dev *input)
339{
340 int i;
341
342 for (i = 0; i < td->maxcontacts; ++i) {
343 struct mt_slot *s = &(td->slots[i]);
344 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
345 !s->seen_in_this_frame) {
346 s->touch_state = false;
347 }
348
349 input_mt_slot(input, i);
350 input_mt_report_slot_state(input, MT_TOOL_FINGER,
351 s->touch_state);
352 if (s->touch_state) {
353 /* this finger is on the screen */
354 int wide = (s->w > s->h);
355 /* divided by two to match visual scale of touch */
356 int major = max(s->w, s->h) >> 1;
357 int minor = min(s->w, s->h) >> 1;
358
359 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
360 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
361 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
362 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
363 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
364 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
365 }
366 s->seen_in_this_frame = false;
367
368 }
369
370 input_mt_report_pointer_emulation(input, true);
371 input_sync(input);
372 td->num_received = 0;
373}
374
375
376
377static int mt_event(struct hid_device *hid, struct hid_field *field,
378 struct hid_usage *usage, __s32 value)
379{
380 struct mt_device *td = hid_get_drvdata(hid);
381 __s32 quirks = td->mtclass->quirks;
382
383 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
384 switch (usage->hid) {
385 case HID_DG_INRANGE:
386 if (quirks & MT_QUIRK_VALID_IS_INRANGE)
387 td->curvalid = value;
388 break;
389 case HID_DG_TIPSWITCH:
390 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
391 td->curvalid = value;
392 td->curdata.touch_state = value;
393 break;
394 case HID_DG_CONFIDENCE:
395 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
396 td->curvalid = value;
397 break;
398 case HID_DG_CONTACTID:
399 td->curdata.contactid = value;
400 break;
401 case HID_DG_TIPPRESSURE:
402 td->curdata.p = value;
403 break;
404 case HID_GD_X:
405 td->curdata.x = value;
406 break;
407 case HID_GD_Y:
408 td->curdata.y = value;
409 break;
410 case HID_DG_WIDTH:
411 td->curdata.w = value;
412 break;
413 case HID_DG_HEIGHT:
414 td->curdata.h = value;
415 break;
416 case HID_DG_CONTACTCOUNT:
417 /*
418 * Includes multi-packet support where subsequent
419 * packets are sent with zero contactcount.
420 */
421 if (value)
422 td->num_expected = value;
423 break;
424
425 default:
426 if (td->last_field_index
427 && field->index == td->last_field_index)
428 /* we reach here when the last field in the
429 * report is not related to multitouch.
430 * This is not good. As a temporary solution,
431 * we trigger our mt event completion and
432 * ignore the field.
433 */
434 break;
435 /* fallback to the generic hidinput handling */
436 return 0;
437 }
438
439 if (usage->hid == td->last_slot_field) {
440 mt_complete_slot(td);
441 if (!td->last_field_index)
442 mt_emit_event(td, field->hidinput->input);
443 }
444
445 if (field->index == td->last_field_index
446 && td->num_received >= td->num_expected)
447 mt_emit_event(td, field->hidinput->input);
448
449 }
450
451 /* we have handled the hidinput part, now remains hiddev */
452 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
453 hid->hiddev_hid_event(hid, field, usage, value);
454
455 return 1;
456}
457
458static void mt_set_input_mode(struct hid_device *hdev)
459{
460 struct mt_device *td = hid_get_drvdata(hdev);
461 struct hid_report *r;
462 struct hid_report_enum *re;
463
464 if (td->inputmode < 0)
465 return;
466
467 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
468 r = re->report_id_hash[td->inputmode];
469 if (r) {
470 r->field[0]->value[0] = 0x02;
471 usbhid_submit_report(hdev, r, USB_DIR_OUT);
472 }
473}
474
475static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
476{
477 int ret, i;
478 struct mt_device *td;
479 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
480
481 for (i = 0; mt_classes[i].name ; i++) {
482 if (id->driver_data == mt_classes[i].name) {
483 mtclass = &(mt_classes[i]);
484 break;
485 }
486 }
487
488 /* This allows the driver to correctly support devices
489 * that emit events over several HID messages.
490 */
491 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
492
493 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
494 if (!td) {
495 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
496 return -ENOMEM;
497 }
498 td->mtclass = mtclass;
499 td->inputmode = -1;
500 hid_set_drvdata(hdev, td);
501
502 ret = hid_parse(hdev);
503 if (ret != 0)
504 goto fail;
505
506 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
507 if (ret)
508 goto fail;
509
510 if (!td->maxcontacts)
511 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
512
513 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
514 GFP_KERNEL);
515 if (!td->slots) {
516 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
517 hid_hw_stop(hdev);
518 ret = -ENOMEM;
519 goto fail;
520 }
521
522 mt_set_input_mode(hdev);
523
524 return 0;
525
526fail:
527 kfree(td);
528 return ret;
529}
530
531#ifdef CONFIG_PM
532static int mt_reset_resume(struct hid_device *hdev)
533{
534 mt_set_input_mode(hdev);
535 return 0;
536}
537#endif
538
539static void mt_remove(struct hid_device *hdev)
540{
541 struct mt_device *td = hid_get_drvdata(hdev);
542 hid_hw_stop(hdev);
543 kfree(td->slots);
544 kfree(td);
545 hid_set_drvdata(hdev, NULL);
546}
547
548static const struct hid_device_id mt_devices[] = {
549
550 /* 3M panels */
551 { .driver_data = MT_CLS_3M,
552 HID_USB_DEVICE(USB_VENDOR_ID_3M,
553 USB_DEVICE_ID_3M1968) },
554 { .driver_data = MT_CLS_3M,
555 HID_USB_DEVICE(USB_VENDOR_ID_3M,
556 USB_DEVICE_ID_3M2256) },
557
558 /* Cando panels */
559 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
560 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
561 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
562 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
563 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
564 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
565 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
566 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
567 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
568 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
569 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
570 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
571
572 /* Cypress panel */
573 { .driver_data = MT_CLS_CYPRESS,
574 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
575 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
576
577 /* GeneralTouch panel */
578 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
579 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
580 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
581
582 /* IRTOUCH panels */
583 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
584 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
585 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
586
587 /* PixCir-based panels */
588 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
589 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
590 USB_DEVICE_ID_HANVON_MULTITOUCH) },
591 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
592 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
593 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
594
595 /* Resistive eGalax devices */
596 { .driver_data = MT_CLS_EGALAX,
597 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
598 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
599 { .driver_data = MT_CLS_EGALAX,
600 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
601 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
602
603 /* Capacitive eGalax devices */
604 { .driver_data = MT_CLS_EGALAX,
605 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
606 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
607 { .driver_data = MT_CLS_EGALAX,
608 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
609 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
610 { .driver_data = MT_CLS_EGALAX,
611 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
612 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
613
614 /* Stantum panels */
615 { .driver_data = MT_CLS_STANTUM,
616 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
617 USB_DEVICE_ID_MTP)},
618 { .driver_data = MT_CLS_STANTUM,
619 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
620 USB_DEVICE_ID_MTP_STM)},
621 { .driver_data = MT_CLS_STANTUM,
622 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
623 USB_DEVICE_ID_MTP_SITRONIX)},
624
625 { }
626};
627MODULE_DEVICE_TABLE(hid, mt_devices);
628
629static const struct hid_usage_id mt_grabbed_usages[] = {
630 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
631 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
632};
633
634static struct hid_driver mt_driver = {
635 .name = "hid-multitouch",
636 .id_table = mt_devices,
637 .probe = mt_probe,
638 .remove = mt_remove,
639 .input_mapping = mt_input_mapping,
640 .input_mapped = mt_input_mapped,
641 .feature_mapping = mt_feature_mapping,
642 .usage_table = mt_grabbed_usages,
643 .event = mt_event,
644#ifdef CONFIG_PM
645 .reset_resume = mt_reset_resume,
646#endif
647};
648
649static int __init mt_init(void)
650{
651 return hid_register_driver(&mt_driver);
652}
653
654static void __exit mt_exit(void)
655{
656 hid_unregister_driver(&mt_driver);
657}
658
659module_init(mt_init);
660module_exit(mt_exit);
diff --git a/usr/src/dkms_source_tree/input-mt.h b/usr/src/dkms_source_tree/input-mt.h
new file mode 100644
index 0000000..e53d274
--- /dev/null
+++ b/usr/src/dkms_source_tree/input-mt.h
@@ -0,0 +1,155 @@
1#ifndef _INPUT_MT_LOCAL_H
2#define _INPUT_MT_LOCAL_H
3
4/*
5 * Input Multitouch Library
6 *
7 * Copyright (c) 2010 Henrik Rydberg
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 */
13
14#include <linux/version.h>
15
16#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
17
18#include <linux/input/mt.h>
19
20#else
21
22#include <linux/input.h>
23
24#define MT_TOOL_MAX 1
25
26#define TRKID_MAX 0xffff
27#define TRKID_SGN ((TRKID_MAX + 1) >> 1)
28
29static int trkid;
30
31static inline void input_abs_set_res(struct input_dev *dev,
32 unsigned int axis, int val)
33{
34 dev->absres[axis] = val;
35}
36
37static inline void input_mt_set_value(struct input_mt_slot *slot,
38 unsigned code, int value)
39{
40 slot->abs[code - ABS_MT_FIRST] = value;
41}
42
43static inline int input_mt_get_value(const struct input_mt_slot *slot,
44 unsigned code)
45{
46 return slot->abs[code - ABS_MT_FIRST];
47}
48
49static inline int input_mt_new_trkid(struct input_dev *dev)
50{
51 return trkid++ & TRKID_MAX;
52}
53
54/**
55 * input_mt_init_slots() - initialize MT input slots
56 * @dev: input device supporting MT events and finger tracking
57 * @num_slots: number of slots used by the device
58 *
59 * This function allocates all necessary memory for MT slot handling
60 * in the input device, prepares the ABS_MT_SLOT and
61 * ABS_MT_TRACKING_ID events for use and sets up appropriate buffers.
62 * May be called repeatedly. Returns -EINVAL if attempting to
63 * reinitialize with a different number of slots.
64 */
65static int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots)
66{
67 int ret;
68
69 if (dev->mt)
70 return dev->mtsize != num_slots ? -EINVAL : 0;
71
72 ret = input_mt_create_slots(dev, num_slots);
73 if (ret)
74 return ret;
75
76 input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0);
77 input_set_events_per_packet(dev, 6 * num_slots);
78
79 return 0;
80}
81
82/**
83 * input_mt_report_state() - report contact state
84 * @dev: input device with allocated MT slots
85 * @active: true if contact is active, false otherwise
86 *
87 * Reports an active touch via ABS_MT_TRACKING_ID. If active is
88 * true and the slot is currently inactive, a new tracking id is
89 * assigned to the slot.
90 */
91static void input_mt_report_slot_state(struct input_dev *dev, unsigned type,
92 bool active)
93{
94 struct input_mt_slot *mt = dev->mt;
95 int id;
96
97 if (!mt || !active) {
98 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
99 return;
100 }
101
102 id = input_mt_get_value(&mt[dev->slot], ABS_MT_TRACKING_ID);
103 if (id < 0)
104 id = input_mt_new_trkid(dev);
105 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, id);
106}
107
108/**
109 * input_mt_report_pointer_emulation() - common pointer emulation
110 * @dev: input device with allocated MT slots
111 *
112 * Performs legacy pointer emulation via BTN_TOUCH.
113 */
114static void input_mt_report_pointer_emulation(struct input_dev *dev, bool more)
115{
116 struct input_mt_slot *oldest = 0;
117 int oldid = trkid;
118 int count = 0;
119 int i;
120
121 for (i = 0; i < dev->mtsize; ++i) {
122 struct input_mt_slot *ps = &dev->mt[i];
123 int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
124
125 if (id < 0)
126 continue;
127 if ((id - oldid) & TRKID_SGN) {
128 oldest = ps;
129 oldid = id;
130 }
131 count++;
132 }
133
134 input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
135 input_event(dev, EV_KEY, BTN_TOOL_FINGER, count == 1);
136 input_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, count == 2);
137 input_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, count == 3);
138 input_event(dev, EV_KEY, BTN_TOOL_QUADTAP, count > 3);
139
140 if (oldest) {
141 int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
142 int y = input_mt_get_value(oldest, ABS_MT_POSITION_Y);
143 int p = input_mt_get_value(oldest, ABS_MT_PRESSURE);
144
145 input_event(dev, EV_ABS, ABS_X, x);
146 input_event(dev, EV_ABS, ABS_Y, y);
147 input_event(dev, EV_ABS, ABS_PRESSURE, p);
148 } else {
149 input_event(dev, EV_ABS, ABS_PRESSURE, 0);
150 }
151}
152
153#endif
154
155#endif
diff --git a/usr/src/dkms_source_tree/usbhid.h b/usr/src/dkms_source_tree/usbhid.h
new file mode 100644
index 0000000..1673cac
--- /dev/null
+++ b/usr/src/dkms_source_tree/usbhid.h
@@ -0,0 +1,106 @@
1#ifndef __USBHID_H
2#define __USBHID_H
3
4/*
5 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2001 Vojtech Pavlik
7 * Copyright (c) 2006 Jiri Kosina
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <linux/types.h>
28#include <linux/slab.h>
29#include <linux/list.h>
30#include <linux/mutex.h>
31#include <linux/timer.h>
32#include <linux/wait.h>
33#include <linux/workqueue.h>
34#include <linux/input.h>
35
36/* API provided by hid-core.c for USB HID drivers */
37int usbhid_wait_io(struct hid_device* hid);
38void usbhid_close(struct hid_device *hid);
39int usbhid_open(struct hid_device *hid);
40void usbhid_init_reports(struct hid_device *hid);
41void usbhid_submit_report
42(struct hid_device *hid, struct hid_report *report, unsigned char dir);
43int usbhid_get_power(struct hid_device *hid);
44void usbhid_put_power(struct hid_device *hid);
45struct usb_interface *usbhid_find_interface(int minor);
46
47/* iofl flags */
48#define HID_CTRL_RUNNING 1
49#define HID_OUT_RUNNING 2
50#define HID_IN_RUNNING 3
51#define HID_RESET_PENDING 4
52#define HID_SUSPENDED 5
53#define HID_CLEAR_HALT 6
54#define HID_DISCONNECTED 7
55#define HID_STARTED 8
56#define HID_REPORTED_IDLE 9
57#define HID_KEYS_PRESSED 10
58#define HID_LED_ON 11
59
60/*
61 * USB-specific HID struct, to be pointed to
62 * from struct hid_device->driver_data
63 */
64
65struct usbhid_device {
66 struct hid_device *hid; /* pointer to corresponding HID dev */
67
68 struct usb_interface *intf; /* USB interface */
69 int ifnum; /* USB interface number */
70
71 unsigned int bufsize; /* URB buffer size */
72
73 struct urb *urbin; /* Input URB */
74 char *inbuf; /* Input buffer */
75 dma_addr_t inbuf_dma; /* Input buffer dma */
76
77 struct urb *urbctrl; /* Control URB */
78 struct usb_ctrlrequest *cr; /* Control request struct */
79 struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */
80 unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */
81 char *ctrlbuf; /* Control buffer */
82 dma_addr_t ctrlbuf_dma; /* Control buffer dma */
83 unsigned long last_ctrl; /* record of last output for timeouts */
84
85 struct urb *urbout; /* Output URB */
86 struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */
87 unsigned char outhead, outtail; /* Output pipe fifo head & tail */
88 char *outbuf; /* Output buffer */
89 dma_addr_t outbuf_dma; /* Output buffer dma */
90 unsigned long last_out; /* record of last output for timeouts */
91
92 spinlock_t lock; /* fifo spinlock */
93 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
94 struct timer_list io_retry; /* Retry timer */
95 unsigned long stop_retry; /* Time to give up, in jiffies */
96 unsigned int retry_delay; /* Delay length in ms */
97 struct work_struct reset_work; /* Task context for resets */
98 wait_queue_head_t wait; /* For sleeping */
99 int ledcount; /* counting the number of active leds */
100};
101
102#define hid_to_usb_dev(hid_dev) \
103 container_of(hid_dev->dev.parent->parent, struct usb_device, dev)
104
105#endif
106