diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-25 17:42:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-25 17:42:39 -0500 |
commit | a85821fce2c100a6680511f9693b76f9717fbdee (patch) | |
tree | 0e764390267adda4367b92cb608d697688f03b49 /drivers | |
parent | 10df38cafc87ef38870154d1b9b1ea2435e69287 (diff) | |
parent | 14ef2b0c026558d37662e5e095d59c64597d5769 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (41 commits)
HID: usbhid: initialize interface pointers early enough
HID: extend mask for BUTTON usage page
HID: hid-ntrig: Single touch mode tap
HID: hid-ntrig: multitouch cleanup and fix
HID: n-trig: remove unnecessary tool switching
HID: hid-ntrig add multi input quirk and clean up
HID: usbhid: introduce timeout for stuck ctrl/out URBs
HID: magicmouse: coding style and probe failure fixes
HID: remove MODULE_VERSION from new drivers
HID: fix up Kconfig entry for MagicMouse
HID: add a device driver for the Apple Magic Mouse.
HID: Export hid_register_report
HID: Support for MosArt multitouch panel
HID: add pressure support for the Stantum multitouch panel
HID: fixed bug in single-touch emulation on the stantum panel
HID: fix typo in error message
HID: add mapping for "AL Network Chat" usage
HID: use multi input quirk for TouchPack touchscreen
HID: make full-fledged hid-bus drivers properly selectable
HID: make Wacom modesetting failures non-fatal
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/Kconfig | 54 | ||||
-rw-r--r-- | drivers/hid/Makefile | 9 | ||||
-rw-r--r-- | drivers/hid/hid-3m-pct.c | 290 | ||||
-rw-r--r-- | drivers/hid/hid-apple.c | 17 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 23 | ||||
-rw-r--r-- | drivers/hid/hid-debug.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 37 | ||||
-rw-r--r-- | drivers/hid/hid-input.c | 12 | ||||
-rw-r--r-- | drivers/hid/hid-lg.c | 7 | ||||
-rw-r--r-- | drivers/hid/hid-lg.h | 6 | ||||
-rw-r--r-- | drivers/hid/hid-lg3ff.c | 176 | ||||
-rw-r--r-- | drivers/hid/hid-lgff.c | 1 | ||||
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 449 | ||||
-rw-r--r-- | drivers/hid/hid-mosart.c | 273 | ||||
-rw-r--r-- | drivers/hid/hid-ntrig.c | 212 | ||||
-rw-r--r-- | drivers/hid/hid-ortek.c | 56 | ||||
-rw-r--r-- | drivers/hid/hid-quanta.c | 260 | ||||
-rw-r--r-- | drivers/hid/hid-sony.c | 23 | ||||
-rw-r--r-- | drivers/hid/hid-stantum.c | 283 | ||||
-rw-r--r-- | drivers/hid/hid-wacom.c | 28 | ||||
-rw-r--r-- | drivers/hid/hidraw.c | 2 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 42 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 3 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 2 |
24 files changed, 2163 insertions, 108 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 24d90ea246ce..71d4c0703629 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -55,6 +55,12 @@ source "drivers/hid/usbhid/Kconfig" | |||
55 | menu "Special HID drivers" | 55 | menu "Special HID drivers" |
56 | depends on HID | 56 | depends on HID |
57 | 57 | ||
58 | config HID_3M_PCT | ||
59 | tristate "3M PCT" | ||
60 | depends on USB_HID | ||
61 | ---help--- | ||
62 | Support for 3M PCT touch screens. | ||
63 | |||
58 | config HID_A4TECH | 64 | config HID_A4TECH |
59 | tristate "A4 tech" if EMBEDDED | 65 | tristate "A4 tech" if EMBEDDED |
60 | depends on USB_HID | 66 | depends on USB_HID |
@@ -183,6 +189,23 @@ config LOGIRUMBLEPAD2_FF | |||
183 | Say Y here if you want to enable force feedback support for Logitech | 189 | Say Y here if you want to enable force feedback support for Logitech |
184 | Rumblepad 2 devices. | 190 | Rumblepad 2 devices. |
185 | 191 | ||
192 | config LOGIG940_FF | ||
193 | bool "Logitech Flight System G940 force feedback support" | ||
194 | depends on HID_LOGITECH | ||
195 | select INPUT_FF_MEMLESS | ||
196 | help | ||
197 | Say Y here if you want to enable force feedback support for Logitech | ||
198 | Flight System G940 devices. | ||
199 | |||
200 | config HID_MAGICMOUSE | ||
201 | tristate "Apple MagicMouse multi-touch support" | ||
202 | depends on BT_HIDP | ||
203 | ---help--- | ||
204 | Support for the Apple Magic Mouse multi-touch. | ||
205 | |||
206 | Say Y here if you want support for the multi-touch features of the | ||
207 | Apple Wireless "Magic" Mouse. | ||
208 | |||
186 | config HID_MICROSOFT | 209 | config HID_MICROSOFT |
187 | tristate "Microsoft" if EMBEDDED | 210 | tristate "Microsoft" if EMBEDDED |
188 | depends on USB_HID | 211 | depends on USB_HID |
@@ -190,6 +213,12 @@ config HID_MICROSOFT | |||
190 | ---help--- | 213 | ---help--- |
191 | Support for Microsoft devices that are not fully compliant with HID standard. | 214 | Support for Microsoft devices that are not fully compliant with HID standard. |
192 | 215 | ||
216 | config HID_MOSART | ||
217 | tristate "MosArt" | ||
218 | depends on USB_HID | ||
219 | ---help--- | ||
220 | Support for MosArt dual-touch panels. | ||
221 | |||
193 | config HID_MONTEREY | 222 | config HID_MONTEREY |
194 | tristate "Monterey" if EMBEDDED | 223 | tristate "Monterey" if EMBEDDED |
195 | depends on USB_HID | 224 | depends on USB_HID |
@@ -198,12 +227,18 @@ config HID_MONTEREY | |||
198 | Support for Monterey Genius KB29E. | 227 | Support for Monterey Genius KB29E. |
199 | 228 | ||
200 | config HID_NTRIG | 229 | config HID_NTRIG |
201 | tristate "NTrig" if EMBEDDED | 230 | tristate "NTrig" |
202 | depends on USB_HID | 231 | depends on USB_HID |
203 | default !EMBEDDED | ||
204 | ---help--- | 232 | ---help--- |
205 | Support for N-Trig touch screen. | 233 | Support for N-Trig touch screen. |
206 | 234 | ||
235 | config HID_ORTEK | ||
236 | tristate "Ortek" if EMBEDDED | ||
237 | depends on USB_HID | ||
238 | default !EMBEDDED | ||
239 | ---help--- | ||
240 | Support for Ortek WKB-2000 wireless keyboard + mouse trackpad. | ||
241 | |||
207 | config HID_PANTHERLORD | 242 | config HID_PANTHERLORD |
208 | tristate "Pantherlord support" if EMBEDDED | 243 | tristate "Pantherlord support" if EMBEDDED |
209 | depends on USB_HID | 244 | depends on USB_HID |
@@ -227,6 +262,12 @@ config HID_PETALYNX | |||
227 | ---help--- | 262 | ---help--- |
228 | Support for Petalynx Maxter remote control. | 263 | Support for Petalynx Maxter remote control. |
229 | 264 | ||
265 | config HID_QUANTA | ||
266 | tristate "Quanta Optical Touch" | ||
267 | depends on USB_HID | ||
268 | ---help--- | ||
269 | Support for Quanta Optical Touch dual-touch panels. | ||
270 | |||
230 | config HID_SAMSUNG | 271 | config HID_SAMSUNG |
231 | tristate "Samsung" if EMBEDDED | 272 | tristate "Samsung" if EMBEDDED |
232 | depends on USB_HID | 273 | depends on USB_HID |
@@ -241,6 +282,12 @@ config HID_SONY | |||
241 | ---help--- | 282 | ---help--- |
242 | Support for Sony PS3 controller. | 283 | Support for Sony PS3 controller. |
243 | 284 | ||
285 | config HID_STANTUM | ||
286 | tristate "Stantum" | ||
287 | depends on USB_HID | ||
288 | ---help--- | ||
289 | Support for Stantum multitouch panel. | ||
290 | |||
244 | config HID_SUNPLUS | 291 | config HID_SUNPLUS |
245 | tristate "Sunplus" if EMBEDDED | 292 | tristate "Sunplus" if EMBEDDED |
246 | depends on USB_HID | 293 | depends on USB_HID |
@@ -305,9 +352,8 @@ config THRUSTMASTER_FF | |||
305 | Rumble Force or Force Feedback Wheel. | 352 | Rumble Force or Force Feedback Wheel. |
306 | 353 | ||
307 | config HID_WACOM | 354 | config HID_WACOM |
308 | tristate "Wacom Bluetooth devices support" if EMBEDDED | 355 | tristate "Wacom Bluetooth devices support" |
309 | depends on BT_HIDP | 356 | depends on BT_HIDP |
310 | default !EMBEDDED | ||
311 | ---help--- | 357 | ---help--- |
312 | Support for Wacom Graphire Bluetooth tablet. | 358 | Support for Wacom Graphire Bluetooth tablet. |
313 | 359 | ||
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 0de2dff5542c..0b2618f092ca 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -18,7 +18,11 @@ endif | |||
18 | ifdef CONFIG_LOGIRUMBLEPAD2_FF | 18 | ifdef CONFIG_LOGIRUMBLEPAD2_FF |
19 | hid-logitech-objs += hid-lg2ff.o | 19 | hid-logitech-objs += hid-lg2ff.o |
20 | endif | 20 | endif |
21 | ifdef CONFIG_LOGIG940_FF | ||
22 | hid-logitech-objs += hid-lg3ff.o | ||
23 | endif | ||
21 | 24 | ||
25 | obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o | ||
22 | obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o | 26 | obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o |
23 | obj-$(CONFIG_HID_APPLE) += hid-apple.o | 27 | obj-$(CONFIG_HID_APPLE) += hid-apple.o |
24 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o | 28 | obj-$(CONFIG_HID_BELKIN) += hid-belkin.o |
@@ -31,14 +35,19 @@ obj-$(CONFIG_HID_GYRATION) += hid-gyration.o | |||
31 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o | 35 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o |
32 | obj-$(CONFIG_HID_KYE) += hid-kye.o | 36 | obj-$(CONFIG_HID_KYE) += hid-kye.o |
33 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | 37 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o |
38 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o | ||
34 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o | 39 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o |
35 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o | 40 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o |
41 | obj-$(CONFIG_HID_MOSART) += hid-mosart.o | ||
36 | obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o | 42 | obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o |
43 | obj-$(CONFIG_HID_ORTEK) += hid-ortek.o | ||
44 | obj-$(CONFIG_HID_QUANTA) += hid-quanta.o | ||
37 | obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o | 45 | obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o |
38 | obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o | 46 | obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o |
39 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o | 47 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o |
40 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o | 48 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o |
41 | obj-$(CONFIG_HID_SONY) += hid-sony.o | 49 | obj-$(CONFIG_HID_SONY) += hid-sony.o |
50 | obj-$(CONFIG_HID_STANTUM) += hid-stantum.o | ||
42 | obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o | 51 | obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o |
43 | obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o | 52 | obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o |
44 | obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o | 53 | obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o |
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c new file mode 100644 index 000000000000..2370aefc86b2 --- /dev/null +++ b/drivers/hid/hid-3m-pct.c | |||
@@ -0,0 +1,290 @@ | |||
1 | /* | ||
2 | * HID driver for 3M PCT multitouch panels | ||
3 | * | ||
4 | * Copyright (c) 2009 Stephane Chatty <chatty@enac.fr> | ||
5 | * | ||
6 | */ | ||
7 | |||
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 as published by the Free | ||
11 | * Software Foundation; either version 2 of the License, or (at your option) | ||
12 | * any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/device.h> | ||
16 | #include <linux/hid.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/usb.h> | ||
19 | |||
20 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | ||
21 | MODULE_DESCRIPTION("3M PCT multitouch panels"); | ||
22 | MODULE_LICENSE("GPL"); | ||
23 | |||
24 | #include "hid-ids.h" | ||
25 | |||
26 | struct mmm_finger { | ||
27 | __s32 x, y; | ||
28 | __u8 rank; | ||
29 | bool touch, valid; | ||
30 | }; | ||
31 | |||
32 | struct mmm_data { | ||
33 | struct mmm_finger f[10]; | ||
34 | __u8 curid, num; | ||
35 | bool touch, valid; | ||
36 | }; | ||
37 | |||
38 | static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
39 | struct hid_field *field, struct hid_usage *usage, | ||
40 | unsigned long **bit, int *max) | ||
41 | { | ||
42 | switch (usage->hid & HID_USAGE_PAGE) { | ||
43 | |||
44 | case HID_UP_BUTTON: | ||
45 | return -1; | ||
46 | |||
47 | case HID_UP_GENDESK: | ||
48 | switch (usage->hid) { | ||
49 | case HID_GD_X: | ||
50 | hid_map_usage(hi, usage, bit, max, | ||
51 | EV_ABS, ABS_MT_POSITION_X); | ||
52 | /* touchscreen emulation */ | ||
53 | input_set_abs_params(hi->input, ABS_X, | ||
54 | field->logical_minimum, | ||
55 | field->logical_maximum, 0, 0); | ||
56 | return 1; | ||
57 | case HID_GD_Y: | ||
58 | hid_map_usage(hi, usage, bit, max, | ||
59 | EV_ABS, ABS_MT_POSITION_Y); | ||
60 | /* touchscreen emulation */ | ||
61 | input_set_abs_params(hi->input, ABS_Y, | ||
62 | field->logical_minimum, | ||
63 | field->logical_maximum, 0, 0); | ||
64 | return 1; | ||
65 | } | ||
66 | return 0; | ||
67 | |||
68 | case HID_UP_DIGITIZER: | ||
69 | switch (usage->hid) { | ||
70 | /* we do not want to map these: no input-oriented meaning */ | ||
71 | case 0x14: | ||
72 | case 0x23: | ||
73 | case HID_DG_INPUTMODE: | ||
74 | case HID_DG_DEVICEINDEX: | ||
75 | case HID_DG_CONTACTCOUNT: | ||
76 | case HID_DG_CONTACTMAX: | ||
77 | case HID_DG_INRANGE: | ||
78 | case HID_DG_CONFIDENCE: | ||
79 | return -1; | ||
80 | case HID_DG_TIPSWITCH: | ||
81 | /* touchscreen emulation */ | ||
82 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | ||
83 | return 1; | ||
84 | case HID_DG_CONTACTID: | ||
85 | hid_map_usage(hi, usage, bit, max, | ||
86 | EV_ABS, ABS_MT_TRACKING_ID); | ||
87 | return 1; | ||
88 | } | ||
89 | /* let hid-input decide for the others */ | ||
90 | return 0; | ||
91 | |||
92 | case 0xff000000: | ||
93 | /* we do not want to map these: no input-oriented meaning */ | ||
94 | return -1; | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
101 | struct hid_field *field, struct hid_usage *usage, | ||
102 | unsigned long **bit, int *max) | ||
103 | { | ||
104 | if (usage->type == EV_KEY || usage->type == EV_ABS) | ||
105 | clear_bit(usage->code, *bit); | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * this function is called when a whole packet has been received and processed, | ||
112 | * so that it can decide what to send to the input layer. | ||
113 | */ | ||
114 | static void mmm_filter_event(struct mmm_data *md, struct input_dev *input) | ||
115 | { | ||
116 | struct mmm_finger *oldest = 0; | ||
117 | bool pressed = false, released = false; | ||
118 | int i; | ||
119 | |||
120 | /* | ||
121 | * we need to iterate on all fingers to decide if we have a press | ||
122 | * or a release event in our touchscreen emulation. | ||
123 | */ | ||
124 | for (i = 0; i < 10; ++i) { | ||
125 | struct mmm_finger *f = &md->f[i]; | ||
126 | if (!f->valid) { | ||
127 | /* this finger is just placeholder data, ignore */ | ||
128 | } else if (f->touch) { | ||
129 | /* this finger is on the screen */ | ||
130 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i); | ||
131 | input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); | ||
132 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); | ||
133 | input_mt_sync(input); | ||
134 | /* | ||
135 | * touchscreen emulation: maintain the age rank | ||
136 | * of this finger, decide if we have a press | ||
137 | */ | ||
138 | if (f->rank == 0) { | ||
139 | f->rank = ++(md->num); | ||
140 | if (f->rank == 1) | ||
141 | pressed = true; | ||
142 | } | ||
143 | if (f->rank == 1) | ||
144 | oldest = f; | ||
145 | } else { | ||
146 | /* this finger took off the screen */ | ||
147 | /* touchscreen emulation: maintain age rank of others */ | ||
148 | int j; | ||
149 | |||
150 | for (j = 0; j < 10; ++j) { | ||
151 | struct mmm_finger *g = &md->f[j]; | ||
152 | if (g->rank > f->rank) { | ||
153 | g->rank--; | ||
154 | if (g->rank == 1) | ||
155 | oldest = g; | ||
156 | } | ||
157 | } | ||
158 | f->rank = 0; | ||
159 | --(md->num); | ||
160 | if (md->num == 0) | ||
161 | released = true; | ||
162 | } | ||
163 | f->valid = 0; | ||
164 | } | ||
165 | |||
166 | /* touchscreen emulation */ | ||
167 | if (oldest) { | ||
168 | if (pressed) | ||
169 | input_event(input, EV_KEY, BTN_TOUCH, 1); | ||
170 | input_event(input, EV_ABS, ABS_X, oldest->x); | ||
171 | input_event(input, EV_ABS, ABS_Y, oldest->y); | ||
172 | } else if (released) { | ||
173 | input_event(input, EV_KEY, BTN_TOUCH, 0); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | /* | ||
178 | * this function is called upon all reports | ||
179 | * so that we can accumulate contact point information, | ||
180 | * and call input_mt_sync after each point. | ||
181 | */ | ||
182 | static int mmm_event(struct hid_device *hid, struct hid_field *field, | ||
183 | struct hid_usage *usage, __s32 value) | ||
184 | { | ||
185 | struct mmm_data *md = hid_get_drvdata(hid); | ||
186 | /* | ||
187 | * strangely, this function can be called before | ||
188 | * field->hidinput is initialized! | ||
189 | */ | ||
190 | if (hid->claimed & HID_CLAIMED_INPUT) { | ||
191 | struct input_dev *input = field->hidinput->input; | ||
192 | switch (usage->hid) { | ||
193 | case HID_DG_TIPSWITCH: | ||
194 | md->touch = value; | ||
195 | break; | ||
196 | case HID_DG_CONFIDENCE: | ||
197 | md->valid = value; | ||
198 | break; | ||
199 | case HID_DG_CONTACTID: | ||
200 | if (md->valid) { | ||
201 | md->curid = value; | ||
202 | md->f[value].touch = md->touch; | ||
203 | md->f[value].valid = 1; | ||
204 | } | ||
205 | break; | ||
206 | case HID_GD_X: | ||
207 | if (md->valid) | ||
208 | md->f[md->curid].x = value; | ||
209 | break; | ||
210 | case HID_GD_Y: | ||
211 | if (md->valid) | ||
212 | md->f[md->curid].y = value; | ||
213 | break; | ||
214 | case HID_DG_CONTACTCOUNT: | ||
215 | mmm_filter_event(md, input); | ||
216 | break; | ||
217 | } | ||
218 | } | ||
219 | |||
220 | /* we have handled the hidinput part, now remains hiddev */ | ||
221 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | ||
222 | hid->hiddev_hid_event(hid, field, usage, value); | ||
223 | |||
224 | return 1; | ||
225 | } | ||
226 | |||
227 | static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
228 | { | ||
229 | int ret; | ||
230 | struct mmm_data *md; | ||
231 | |||
232 | md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL); | ||
233 | if (!md) { | ||
234 | dev_err(&hdev->dev, "cannot allocate 3M data\n"); | ||
235 | return -ENOMEM; | ||
236 | } | ||
237 | hid_set_drvdata(hdev, md); | ||
238 | |||
239 | ret = hid_parse(hdev); | ||
240 | if (!ret) | ||
241 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
242 | |||
243 | if (ret) | ||
244 | kfree(md); | ||
245 | return ret; | ||
246 | } | ||
247 | |||
248 | static void mmm_remove(struct hid_device *hdev) | ||
249 | { | ||
250 | hid_hw_stop(hdev); | ||
251 | kfree(hid_get_drvdata(hdev)); | ||
252 | hid_set_drvdata(hdev, NULL); | ||
253 | } | ||
254 | |||
255 | static const struct hid_device_id mmm_devices[] = { | ||
256 | { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, | ||
257 | { } | ||
258 | }; | ||
259 | MODULE_DEVICE_TABLE(hid, mmm_devices); | ||
260 | |||
261 | static const struct hid_usage_id mmm_grabbed_usages[] = { | ||
262 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | ||
263 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | ||
264 | }; | ||
265 | |||
266 | static struct hid_driver mmm_driver = { | ||
267 | .name = "3m-pct", | ||
268 | .id_table = mmm_devices, | ||
269 | .probe = mmm_probe, | ||
270 | .remove = mmm_remove, | ||
271 | .input_mapping = mmm_input_mapping, | ||
272 | .input_mapped = mmm_input_mapped, | ||
273 | .usage_table = mmm_grabbed_usages, | ||
274 | .event = mmm_event, | ||
275 | }; | ||
276 | |||
277 | static int __init mmm_init(void) | ||
278 | { | ||
279 | return hid_register_driver(&mmm_driver); | ||
280 | } | ||
281 | |||
282 | static void __exit mmm_exit(void) | ||
283 | { | ||
284 | hid_unregister_driver(&mmm_driver); | ||
285 | } | ||
286 | |||
287 | module_init(mmm_init); | ||
288 | module_exit(mmm_exit); | ||
289 | MODULE_LICENSE("GPL"); | ||
290 | |||
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 5b4d66dc1a05..78286b184ace 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -40,6 +40,11 @@ module_param(fnmode, uint, 0644); | |||
40 | MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " | 40 | MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " |
41 | "[1] = fkeyslast, 2 = fkeysfirst)"); | 41 | "[1] = fkeyslast, 2 = fkeysfirst)"); |
42 | 42 | ||
43 | static unsigned int iso_layout = 1; | ||
44 | module_param(iso_layout, uint, 0644); | ||
45 | MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. " | ||
46 | "(0 = disabled, [1] = enabled)"); | ||
47 | |||
43 | struct apple_sc { | 48 | struct apple_sc { |
44 | unsigned long quirks; | 49 | unsigned long quirks; |
45 | unsigned int fn_on; | 50 | unsigned int fn_on; |
@@ -199,11 +204,13 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
199 | } | 204 | } |
200 | } | 205 | } |
201 | 206 | ||
202 | if (asc->quirks & APPLE_ISO_KEYBOARD) { | 207 | if (iso_layout) { |
203 | trans = apple_find_translation(apple_iso_keyboard, usage->code); | 208 | if (asc->quirks & APPLE_ISO_KEYBOARD) { |
204 | if (trans) { | 209 | trans = apple_find_translation(apple_iso_keyboard, usage->code); |
205 | input_event(input, usage->type, trans->to, value); | 210 | if (trans) { |
206 | return 1; | 211 | input_event(input, usage->type, trans->to, value); |
212 | return 1; | ||
213 | } | ||
207 | } | 214 | } |
208 | } | 215 | } |
209 | 216 | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index eabe5f87c6c1..368fbb0c4ca6 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2007 Jiri Kosina | 7 | * Copyright (c) 2006-2010 Jiri Kosina |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(hid_debug); | |||
51 | * Register a new report for a device. | 51 | * Register a new report for a device. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) | 54 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) |
55 | { | 55 | { |
56 | struct hid_report_enum *report_enum = device->report_enum + type; | 56 | struct hid_report_enum *report_enum = device->report_enum + type; |
57 | struct hid_report *report; | 57 | struct hid_report *report; |
@@ -75,6 +75,7 @@ static struct hid_report *hid_register_report(struct hid_device *device, unsigne | |||
75 | 75 | ||
76 | return report; | 76 | return report; |
77 | } | 77 | } |
78 | EXPORT_SYMBOL_GPL(hid_register_report); | ||
78 | 79 | ||
79 | /* | 80 | /* |
80 | * Register a new field for this report. | 81 | * Register a new field for this report. |
@@ -387,7 +388,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) | |||
387 | __u32 data; | 388 | __u32 data; |
388 | unsigned n; | 389 | unsigned n; |
389 | 390 | ||
390 | if (item->size == 0) { | 391 | /* Local delimiter could have value 0, which allows size to be 0 */ |
392 | if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) { | ||
391 | dbg_hid("item data expected for local item\n"); | 393 | dbg_hid("item data expected for local item\n"); |
392 | return -1; | 394 | return -1; |
393 | } | 395 | } |
@@ -1248,11 +1250,13 @@ EXPORT_SYMBOL_GPL(hid_disconnect); | |||
1248 | 1250 | ||
1249 | /* a list of devices for which there is a specialized driver on HID bus */ | 1251 | /* a list of devices for which there is a specialized driver on HID bus */ |
1250 | static const struct hid_device_id hid_blacklist[] = { | 1252 | static const struct hid_device_id hid_blacklist[] = { |
1253 | { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, | ||
1251 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, | 1254 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
1252 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, | 1255 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
1253 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, | 1256 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, |
1254 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | 1257 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, |
1255 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | 1258 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
1259 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | ||
1256 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | 1260 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
1257 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | 1261 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
1258 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | 1262 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
@@ -1324,6 +1328,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1324 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, | 1328 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, |
1325 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, | 1329 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, |
1326 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, | 1330 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, |
1331 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, | ||
1327 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, | 1332 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, |
1328 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, | 1333 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, |
1329 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, | 1334 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
@@ -1337,10 +1342,15 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1337 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | 1342 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
1338 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | 1343 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
1339 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, | 1344 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
1345 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, | ||
1340 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | 1346 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
1347 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, | ||
1348 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, | ||
1341 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1349 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1342 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1350 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1351 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
1343 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | 1352 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1353 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, | ||
1344 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1354 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1345 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | 1355 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
1346 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | 1356 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
@@ -1543,8 +1553,9 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1543 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, | 1553 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, |
1544 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, | 1554 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, |
1545 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, | 1555 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, |
1546 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, | 1556 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT)}, |
1547 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)}, | 1557 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, |
1558 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, | ||
1548 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, | 1559 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, |
1549 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, | 1560 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, |
1550 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, | 1561 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, |
@@ -1661,8 +1672,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1661 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, | 1672 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, |
1662 | { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, | 1673 | { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, |
1663 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, | 1674 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, |
1664 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, | ||
1665 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, | ||
1666 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | 1675 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, |
1667 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | 1676 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, |
1668 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | 1677 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 6abd0369aedb..cd4ece6fdfb9 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -864,13 +864,13 @@ static const char **names[EV_MAX + 1] = { | |||
864 | [EV_SND] = sounds, [EV_REP] = repeats, | 864 | [EV_SND] = sounds, [EV_REP] = repeats, |
865 | }; | 865 | }; |
866 | 866 | ||
867 | void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f) { | 867 | static void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f) |
868 | 868 | { | |
869 | seq_printf(f, "%s.%s", events[type] ? events[type] : "?", | 869 | seq_printf(f, "%s.%s", events[type] ? events[type] : "?", |
870 | names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); | 870 | names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); |
871 | } | 871 | } |
872 | 872 | ||
873 | void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f) | 873 | static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f) |
874 | { | 874 | { |
875 | int i, j, k; | 875 | int i, j, k; |
876 | struct hid_report *report; | 876 | struct hid_report *report; |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 010368e649ed..72c05f90553c 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -18,6 +18,9 @@ | |||
18 | #ifndef HID_IDS_H_FILE | 18 | #ifndef HID_IDS_H_FILE |
19 | #define HID_IDS_H_FILE | 19 | #define HID_IDS_H_FILE |
20 | 20 | ||
21 | #define USB_VENDOR_ID_3M 0x0596 | ||
22 | #define USB_DEVICE_ID_3M1968 0x0500 | ||
23 | |||
21 | #define USB_VENDOR_ID_A4TECH 0x09da | 24 | #define USB_VENDOR_ID_A4TECH 0x09da |
22 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | 25 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 |
23 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a | 26 | #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a |
@@ -56,6 +59,7 @@ | |||
56 | 59 | ||
57 | #define USB_VENDOR_ID_APPLE 0x05ac | 60 | #define USB_VENDOR_ID_APPLE 0x05ac |
58 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | 61 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 |
62 | #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d | ||
59 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | 63 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e |
60 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | 64 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f |
61 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | 65 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 |
@@ -96,9 +100,12 @@ | |||
96 | #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 | 100 | #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 |
97 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 | 101 | #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 |
98 | 102 | ||
99 | #define USB_VENDOR_ID_ASUS 0x0b05 | 103 | #define USB_VENDOR_ID_ASUS 0x0486 |
100 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 | 104 | #define USB_DEVICE_ID_ASUS_T91MT 0x0185 |
101 | #define USB_DEVICE_ID_ASUS_LCM2 0x175b | 105 | |
106 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 | ||
107 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 | ||
108 | #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b | ||
102 | 109 | ||
103 | #define USB_VENDOR_ID_ATEN 0x0557 | 110 | #define USB_VENDOR_ID_ATEN 0x0557 |
104 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | 111 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 |
@@ -169,6 +176,9 @@ | |||
169 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f | 176 | #define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f |
170 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 | 177 | #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 |
171 | 178 | ||
179 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 | ||
180 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 | ||
181 | |||
172 | #define USB_VENDOR_ID_ETT 0x0664 | 182 | #define USB_VENDOR_ID_ETT 0x0664 |
173 | #define USB_DEVICE_ID_TC5UH 0x0309 | 183 | #define USB_DEVICE_ID_TC5UH 0x0309 |
174 | 184 | ||
@@ -303,6 +313,7 @@ | |||
303 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 | 313 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 |
304 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 | 314 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 |
305 | #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 | 315 | #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 |
316 | #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287 | ||
306 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 | 317 | #define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 |
307 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293 | 318 | #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293 |
308 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 | 319 | #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 |
@@ -365,6 +376,9 @@ | |||
365 | #define USB_VENDOR_ID_ONTRAK 0x0a07 | 376 | #define USB_VENDOR_ID_ONTRAK 0x0a07 |
366 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 | 377 | #define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 |
367 | 378 | ||
379 | #define USB_VENDOR_ID_ORTEK 0x05a4 | ||
380 | #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 | ||
381 | |||
368 | #define USB_VENDOR_ID_PANJIT 0x134c | 382 | #define USB_VENDOR_ID_PANJIT 0x134c |
369 | 383 | ||
370 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 | 384 | #define USB_VENDOR_ID_PANTHERLORD 0x0810 |
@@ -382,9 +396,16 @@ | |||
382 | #define USB_VENDOR_ID_POWERCOM 0x0d9f | 396 | #define USB_VENDOR_ID_POWERCOM 0x0d9f |
383 | #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 | 397 | #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 |
384 | 398 | ||
399 | #define USB_VENDOR_ID_PRODIGE 0x05af | ||
400 | #define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062 | ||
401 | |||
385 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 402 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
386 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 403 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
387 | 404 | ||
405 | #define USB_VENDOR_ID_QUANTA 0x0408 | ||
406 | #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH 0x3000 | ||
407 | #define USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN 0x3001 | ||
408 | |||
388 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | 409 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
389 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 410 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
390 | 411 | ||
@@ -396,18 +417,20 @@ | |||
396 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034 | 417 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST 0x0034 |
397 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST 0x0046 | 418 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST 0x0046 |
398 | 419 | ||
420 | #define USB_VENDOR_ID_STANTUM 0x1f87 | ||
421 | #define USB_DEVICE_ID_MTP 0x0002 | ||
422 | |||
399 | #define USB_VENDOR_ID_SUN 0x0430 | 423 | #define USB_VENDOR_ID_SUN 0x0430 |
400 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 424 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
401 | 425 | ||
402 | #define USB_VENDOR_ID_SUNPLUS 0x04fc | 426 | #define USB_VENDOR_ID_SUNPLUS 0x04fc |
403 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 | 427 | #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 |
404 | 428 | ||
405 | #define USB_VENDOR_ID_TENX 0x1130 | ||
406 | #define USB_DEVICE_ID_TENX_IBUDDY1 0x0001 | ||
407 | #define USB_DEVICE_ID_TENX_IBUDDY2 0x0002 | ||
408 | |||
409 | #define USB_VENDOR_ID_THRUSTMASTER 0x044f | 429 | #define USB_VENDOR_ID_THRUSTMASTER 0x044f |
410 | 430 | ||
431 | #define USB_VENDOR_ID_TOUCHPACK 0x1bfd | ||
432 | #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 | ||
433 | |||
411 | #define USB_VENDOR_ID_TOPMAX 0x0663 | 434 | #define USB_VENDOR_ID_TOPMAX 0x0663 |
412 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 | 435 | #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 |
413 | 436 | ||
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 5862b0f3b55d..79d9edd0bdfa 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
3 | * Copyright (c) 2006-2007 Jiri Kosina | 3 | * Copyright (c) 2006-2010 Jiri Kosina |
4 | * | 4 | * |
5 | * HID to Linux Input mapping | 5 | * HID to Linux Input mapping |
6 | */ | 6 | */ |
@@ -193,12 +193,17 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
193 | break; | 193 | break; |
194 | 194 | ||
195 | case HID_UP_BUTTON: | 195 | case HID_UP_BUTTON: |
196 | code = ((usage->hid - 1) & 0xf); | 196 | code = ((usage->hid - 1) & HID_USAGE); |
197 | 197 | ||
198 | switch (field->application) { | 198 | switch (field->application) { |
199 | case HID_GD_MOUSE: | 199 | case HID_GD_MOUSE: |
200 | case HID_GD_POINTER: code += 0x110; break; | 200 | case HID_GD_POINTER: code += 0x110; break; |
201 | case HID_GD_JOYSTICK: code += 0x120; break; | 201 | case HID_GD_JOYSTICK: |
202 | if (code <= 0xf) | ||
203 | code += BTN_JOYSTICK; | ||
204 | else | ||
205 | code += BTN_TRIGGER_HAPPY; | ||
206 | break; | ||
202 | case HID_GD_GAMEPAD: code += 0x130; break; | 207 | case HID_GD_GAMEPAD: code += 0x130; break; |
203 | default: | 208 | default: |
204 | switch (field->physical) { | 209 | switch (field->physical) { |
@@ -400,6 +405,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
400 | case 0x192: map_key_clear(KEY_CALC); break; | 405 | case 0x192: map_key_clear(KEY_CALC); break; |
401 | case 0x194: map_key_clear(KEY_FILE); break; | 406 | case 0x194: map_key_clear(KEY_FILE); break; |
402 | case 0x196: map_key_clear(KEY_WWW); break; | 407 | case 0x196: map_key_clear(KEY_WWW); break; |
408 | case 0x199: map_key_clear(KEY_CHAT); break; | ||
403 | case 0x19c: map_key_clear(KEY_LOGOFF); break; | 409 | case 0x19c: map_key_clear(KEY_LOGOFF); break; |
404 | case 0x19e: map_key_clear(KEY_COFFEE); break; | 410 | case 0x19e: map_key_clear(KEY_COFFEE); break; |
405 | case 0x1a6: map_key_clear(KEY_HELP); break; | 411 | case 0x1a6: map_key_clear(KEY_HELP); break; |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 9fcd3d017ab3..3677c9037a11 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #define LG_FF 0x200 | 34 | #define LG_FF 0x200 |
35 | #define LG_FF2 0x400 | 35 | #define LG_FF2 0x400 |
36 | #define LG_RDESC_REL_ABS 0x800 | 36 | #define LG_RDESC_REL_ABS 0x800 |
37 | #define LG_FF3 0x1000 | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * Certain Logitech keyboards send in report #3 keys which are far | 40 | * Certain Logitech keyboards send in report #3 keys which are far |
@@ -266,7 +267,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
266 | goto err_free; | 267 | goto err_free; |
267 | } | 268 | } |
268 | 269 | ||
269 | if (quirks & (LG_FF | LG_FF2)) | 270 | if (quirks & (LG_FF | LG_FF2 | LG_FF3)) |
270 | connect_mask &= ~HID_CONNECT_FF; | 271 | connect_mask &= ~HID_CONNECT_FF; |
271 | 272 | ||
272 | ret = hid_hw_start(hdev, connect_mask); | 273 | ret = hid_hw_start(hdev, connect_mask); |
@@ -279,6 +280,8 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
279 | lgff_init(hdev); | 280 | lgff_init(hdev); |
280 | if (quirks & LG_FF2) | 281 | if (quirks & LG_FF2) |
281 | lg2ff_init(hdev); | 282 | lg2ff_init(hdev); |
283 | if (quirks & LG_FF3) | ||
284 | lg3ff_init(hdev); | ||
282 | 285 | ||
283 | return 0; | 286 | return 0; |
284 | err_free: | 287 | err_free: |
@@ -331,6 +334,8 @@ static const struct hid_device_id lg_devices[] = { | |||
331 | .driver_data = LG_FF }, | 334 | .driver_data = LG_FF }, |
332 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), | 335 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), |
333 | .driver_data = LG_FF2 }, | 336 | .driver_data = LG_FF2 }, |
337 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), | ||
338 | .driver_data = LG_FF3 }, | ||
334 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), | 339 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR), |
335 | .driver_data = LG_RDESC_REL_ABS }, | 340 | .driver_data = LG_RDESC_REL_ABS }, |
336 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER), | 341 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER), |
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h index bf31592eaf79..ce2ac8672624 100644 --- a/drivers/hid/hid-lg.h +++ b/drivers/hid/hid-lg.h | |||
@@ -13,4 +13,10 @@ int lg2ff_init(struct hid_device *hdev); | |||
13 | static inline int lg2ff_init(struct hid_device *hdev) { return -1; } | 13 | static inline int lg2ff_init(struct hid_device *hdev) { return -1; } |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #ifdef CONFIG_LOGIG940_FF | ||
17 | int lg3ff_init(struct hid_device *hdev); | ||
18 | #else | ||
19 | static inline int lg3ff_init(struct hid_device *hdev) { return -1; } | ||
20 | #endif | ||
21 | |||
16 | #endif | 22 | #endif |
diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c new file mode 100644 index 000000000000..4002832ee4af --- /dev/null +++ b/drivers/hid/hid-lg3ff.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * Force feedback support for Logitech Flight System G940 | ||
3 | * | ||
4 | * Copyright (c) 2009 Gary Stein <LordCnidarian@gmail.com> | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/input.h> | ||
25 | #include <linux/usb.h> | ||
26 | #include <linux/hid.h> | ||
27 | |||
28 | #include "usbhid/usbhid.h" | ||
29 | #include "hid-lg.h" | ||
30 | |||
31 | /* | ||
32 | * G940 Theory of Operation (from experimentation) | ||
33 | * | ||
34 | * There are 63 fields (only 3 of them currently used) | ||
35 | * 0 - seems to be command field | ||
36 | * 1 - 30 deal with the x axis | ||
37 | * 31 -60 deal with the y axis | ||
38 | * | ||
39 | * Field 1 is x axis constant force | ||
40 | * Field 31 is y axis constant force | ||
41 | * | ||
42 | * other interesting fields 1,2,3,4 on x axis | ||
43 | * (same for 31,32,33,34 on y axis) | ||
44 | * | ||
45 | * 0 0 127 127 makes the joystick autocenter hard | ||
46 | * | ||
47 | * 127 0 127 127 makes the joystick loose on the right, | ||
48 | * but stops all movemnt left | ||
49 | * | ||
50 | * -127 0 -127 -127 makes the joystick loose on the left, | ||
51 | * but stops all movement right | ||
52 | * | ||
53 | * 0 0 -127 -127 makes the joystick rattle very hard | ||
54 | * | ||
55 | * I'm sure these are effects that I don't know enough about them | ||
56 | */ | ||
57 | |||
58 | struct lg3ff_device { | ||
59 | struct hid_report *report; | ||
60 | }; | ||
61 | |||
62 | static int hid_lg3ff_play(struct input_dev *dev, void *data, | ||
63 | struct ff_effect *effect) | ||
64 | { | ||
65 | struct hid_device *hid = input_get_drvdata(dev); | ||
66 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
67 | struct hid_report *report = list_entry(report_list->next, struct hid_report, list); | ||
68 | int x, y; | ||
69 | |||
70 | /* | ||
71 | * Maxusage should always be 63 (maximum fields) | ||
72 | * likely a better way to ensure this data is clean | ||
73 | */ | ||
74 | memset(report->field[0]->value, 0, sizeof(__s32)*report->field[0]->maxusage); | ||
75 | |||
76 | switch (effect->type) { | ||
77 | case FF_CONSTANT: | ||
78 | /* | ||
79 | * Already clamped in ff_memless | ||
80 | * 0 is center (different then other logitech) | ||
81 | */ | ||
82 | x = effect->u.ramp.start_level; | ||
83 | y = effect->u.ramp.end_level; | ||
84 | |||
85 | /* send command byte */ | ||
86 | report->field[0]->value[0] = 0x51; | ||
87 | |||
88 | /* | ||
89 | * Sign backwards from other Force3d pro | ||
90 | * which get recast here in two's complement 8 bits | ||
91 | */ | ||
92 | report->field[0]->value[1] = (unsigned char)(-x); | ||
93 | report->field[0]->value[31] = (unsigned char)(-y); | ||
94 | |||
95 | usbhid_submit_report(hid, report, USB_DIR_OUT); | ||
96 | break; | ||
97 | } | ||
98 | return 0; | ||
99 | } | ||
100 | static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude) | ||
101 | { | ||
102 | struct hid_device *hid = input_get_drvdata(dev); | ||
103 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
104 | struct hid_report *report = list_entry(report_list->next, struct hid_report, list); | ||
105 | |||
106 | /* | ||
107 | * Auto Centering probed from device | ||
108 | * NOTE: deadman's switch on G940 must be covered | ||
109 | * for effects to work | ||
110 | */ | ||
111 | report->field[0]->value[0] = 0x51; | ||
112 | report->field[0]->value[1] = 0x00; | ||
113 | report->field[0]->value[2] = 0x00; | ||
114 | report->field[0]->value[3] = 0x7F; | ||
115 | report->field[0]->value[4] = 0x7F; | ||
116 | report->field[0]->value[31] = 0x00; | ||
117 | report->field[0]->value[32] = 0x00; | ||
118 | report->field[0]->value[33] = 0x7F; | ||
119 | report->field[0]->value[34] = 0x7F; | ||
120 | |||
121 | usbhid_submit_report(hid, report, USB_DIR_OUT); | ||
122 | } | ||
123 | |||
124 | |||
125 | static const signed short ff3_joystick_ac[] = { | ||
126 | FF_CONSTANT, | ||
127 | FF_AUTOCENTER, | ||
128 | -1 | ||
129 | }; | ||
130 | |||
131 | int lg3ff_init(struct hid_device *hid) | ||
132 | { | ||
133 | struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); | ||
134 | struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; | ||
135 | struct input_dev *dev = hidinput->input; | ||
136 | struct hid_report *report; | ||
137 | struct hid_field *field; | ||
138 | const signed short *ff_bits = ff3_joystick_ac; | ||
139 | int error; | ||
140 | int i; | ||
141 | |||
142 | /* Find the report to use */ | ||
143 | if (list_empty(report_list)) { | ||
144 | err_hid("No output report found"); | ||
145 | return -1; | ||
146 | } | ||
147 | |||
148 | /* Check that the report looks ok */ | ||
149 | report = list_entry(report_list->next, struct hid_report, list); | ||
150 | if (!report) { | ||
151 | err_hid("NULL output report"); | ||
152 | return -1; | ||
153 | } | ||
154 | |||
155 | field = report->field[0]; | ||
156 | if (!field) { | ||
157 | err_hid("NULL field"); | ||
158 | return -1; | ||
159 | } | ||
160 | |||
161 | /* Assume single fixed device G940 */ | ||
162 | for (i = 0; ff_bits[i] >= 0; i++) | ||
163 | set_bit(ff_bits[i], dev->ffbit); | ||
164 | |||
165 | error = input_ff_create_memless(dev, NULL, hid_lg3ff_play); | ||
166 | if (error) | ||
167 | return error; | ||
168 | |||
169 | if (test_bit(FF_AUTOCENTER, dev->ffbit)) | ||
170 | dev->ff->set_autocenter = hid_lg3ff_set_autocenter; | ||
171 | |||
172 | dev_info(&hid->dev, "Force feedback for Logitech Flight System G940 by " | ||
173 | "Gary Stein <LordCnidarian@gmail.com>\n"); | ||
174 | return 0; | ||
175 | } | ||
176 | |||
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c index 987abebe0829..61142b76a9b1 100644 --- a/drivers/hid/hid-lgff.c +++ b/drivers/hid/hid-lgff.c | |||
@@ -67,6 +67,7 @@ static const struct dev_type devices[] = { | |||
67 | { 0x046d, 0xc219, ff_rumble }, | 67 | { 0x046d, 0xc219, ff_rumble }, |
68 | { 0x046d, 0xc283, ff_joystick }, | 68 | { 0x046d, 0xc283, ff_joystick }, |
69 | { 0x046d, 0xc286, ff_joystick_ac }, | 69 | { 0x046d, 0xc286, ff_joystick_ac }, |
70 | { 0x046d, 0xc287, ff_joystick_ac }, | ||
70 | { 0x046d, 0xc293, ff_joystick }, | 71 | { 0x046d, 0xc293, ff_joystick }, |
71 | { 0x046d, 0xc294, ff_wheel }, | 72 | { 0x046d, 0xc294, ff_wheel }, |
72 | { 0x046d, 0xc295, ff_joystick }, | 73 | { 0x046d, 0xc295, ff_joystick }, |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c new file mode 100644 index 000000000000..4a3a94f2b10c --- /dev/null +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * Apple "Magic" Wireless Mouse driver | ||
3 | * | ||
4 | * Copyright (c) 2010 Michael Poole <mdpoole@troilus.org> | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation; either version 2 of the License, or (at your option) | ||
11 | * any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/device.h> | ||
15 | #include <linux/hid.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/usb.h> | ||
18 | |||
19 | #include "hid-ids.h" | ||
20 | |||
21 | static bool emulate_3button = true; | ||
22 | module_param(emulate_3button, bool, 0644); | ||
23 | MODULE_PARM_DESC(emulate_3button, "Emulate a middle button"); | ||
24 | |||
25 | static int middle_button_start = -350; | ||
26 | static int middle_button_stop = +350; | ||
27 | |||
28 | static bool emulate_scroll_wheel = true; | ||
29 | module_param(emulate_scroll_wheel, bool, 0644); | ||
30 | MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel"); | ||
31 | |||
32 | static bool report_touches = true; | ||
33 | module_param(report_touches, bool, 0644); | ||
34 | MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); | ||
35 | |||
36 | static bool report_undeciphered; | ||
37 | module_param(report_undeciphered, bool, 0644); | ||
38 | MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event"); | ||
39 | |||
40 | #define TOUCH_REPORT_ID 0x29 | ||
41 | /* These definitions are not precise, but they're close enough. (Bits | ||
42 | * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem | ||
43 | * to be some kind of bit mask -- 0x20 may be a near-field reading, | ||
44 | * and 0x40 is actual contact, and 0x10 may be a start/stop or change | ||
45 | * indication.) | ||
46 | */ | ||
47 | #define TOUCH_STATE_MASK 0xf0 | ||
48 | #define TOUCH_STATE_NONE 0x00 | ||
49 | #define TOUCH_STATE_START 0x30 | ||
50 | #define TOUCH_STATE_DRAG 0x40 | ||
51 | |||
52 | /** | ||
53 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. | ||
54 | * @input: Input device through which we report events. | ||
55 | * @quirks: Currently unused. | ||
56 | * @last_timestamp: Timestamp from most recent (18-bit) touch report | ||
57 | * (units of milliseconds over short windows, but seems to | ||
58 | * increase faster when there are no touches). | ||
59 | * @delta_time: 18-bit difference between the two most recent touch | ||
60 | * reports from the mouse. | ||
61 | * @ntouches: Number of touches in most recent touch report. | ||
62 | * @scroll_accel: Number of consecutive scroll motions. | ||
63 | * @scroll_jiffies: Time of last scroll motion. | ||
64 | * @touches: Most recent data for a touch, indexed by tracking ID. | ||
65 | * @tracking_ids: Mapping of current touch input data to @touches. | ||
66 | */ | ||
67 | struct magicmouse_sc { | ||
68 | struct input_dev *input; | ||
69 | unsigned long quirks; | ||
70 | |||
71 | int last_timestamp; | ||
72 | int delta_time; | ||
73 | int ntouches; | ||
74 | int scroll_accel; | ||
75 | unsigned long scroll_jiffies; | ||
76 | |||
77 | struct { | ||
78 | short x; | ||
79 | short y; | ||
80 | short scroll_y; | ||
81 | u8 size; | ||
82 | } touches[16]; | ||
83 | int tracking_ids[16]; | ||
84 | }; | ||
85 | |||
86 | static int magicmouse_firm_touch(struct magicmouse_sc *msc) | ||
87 | { | ||
88 | int touch = -1; | ||
89 | int ii; | ||
90 | |||
91 | /* If there is only one "firm" touch, set touch to its | ||
92 | * tracking ID. | ||
93 | */ | ||
94 | for (ii = 0; ii < msc->ntouches; ii++) { | ||
95 | int idx = msc->tracking_ids[ii]; | ||
96 | if (msc->touches[idx].size < 8) { | ||
97 | /* Ignore this touch. */ | ||
98 | } else if (touch >= 0) { | ||
99 | touch = -1; | ||
100 | break; | ||
101 | } else { | ||
102 | touch = idx; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | return touch; | ||
107 | } | ||
108 | |||
109 | static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state) | ||
110 | { | ||
111 | int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 | | ||
112 | test_bit(BTN_RIGHT, msc->input->key) << 1 | | ||
113 | test_bit(BTN_MIDDLE, msc->input->key) << 2; | ||
114 | |||
115 | if (emulate_3button) { | ||
116 | int id; | ||
117 | |||
118 | /* If some button was pressed before, keep it held | ||
119 | * down. Otherwise, if there's exactly one firm | ||
120 | * touch, use that to override the mouse's guess. | ||
121 | */ | ||
122 | if (state == 0) { | ||
123 | /* The button was released. */ | ||
124 | } else if (last_state != 0) { | ||
125 | state = last_state; | ||
126 | } else if ((id = magicmouse_firm_touch(msc)) >= 0) { | ||
127 | int x = msc->touches[id].x; | ||
128 | if (x < middle_button_start) | ||
129 | state = 1; | ||
130 | else if (x > middle_button_stop) | ||
131 | state = 2; | ||
132 | else | ||
133 | state = 4; | ||
134 | } /* else: we keep the mouse's guess */ | ||
135 | |||
136 | input_report_key(msc->input, BTN_MIDDLE, state & 4); | ||
137 | } | ||
138 | |||
139 | input_report_key(msc->input, BTN_LEFT, state & 1); | ||
140 | input_report_key(msc->input, BTN_RIGHT, state & 2); | ||
141 | |||
142 | if (state != last_state) | ||
143 | msc->scroll_accel = 0; | ||
144 | } | ||
145 | |||
146 | static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) | ||
147 | { | ||
148 | struct input_dev *input = msc->input; | ||
149 | __s32 x_y = tdata[0] << 8 | tdata[1] << 16 | tdata[2] << 24; | ||
150 | int misc = tdata[5] | tdata[6] << 8; | ||
151 | int id = (misc >> 6) & 15; | ||
152 | int x = x_y << 12 >> 20; | ||
153 | int y = -(x_y >> 20); | ||
154 | |||
155 | /* Store tracking ID and other fields. */ | ||
156 | msc->tracking_ids[raw_id] = id; | ||
157 | msc->touches[id].x = x; | ||
158 | msc->touches[id].y = y; | ||
159 | msc->touches[id].size = misc & 63; | ||
160 | |||
161 | /* If requested, emulate a scroll wheel by detecting small | ||
162 | * vertical touch motions along the middle of the mouse. | ||
163 | */ | ||
164 | if (emulate_scroll_wheel && | ||
165 | middle_button_start < x && x < middle_button_stop) { | ||
166 | static const int accel_profile[] = { | ||
167 | 256, 228, 192, 160, 128, 96, 64, 32, | ||
168 | }; | ||
169 | unsigned long now = jiffies; | ||
170 | int step = msc->touches[id].scroll_y - y; | ||
171 | |||
172 | /* Reset acceleration after half a second. */ | ||
173 | if (time_after(now, msc->scroll_jiffies + HZ / 2)) | ||
174 | msc->scroll_accel = 0; | ||
175 | |||
176 | /* Calculate and apply the scroll motion. */ | ||
177 | switch (tdata[7] & TOUCH_STATE_MASK) { | ||
178 | case TOUCH_STATE_START: | ||
179 | msc->touches[id].scroll_y = y; | ||
180 | msc->scroll_accel = min_t(int, msc->scroll_accel + 1, | ||
181 | ARRAY_SIZE(accel_profile) - 1); | ||
182 | break; | ||
183 | case TOUCH_STATE_DRAG: | ||
184 | step = step / accel_profile[msc->scroll_accel]; | ||
185 | if (step != 0) { | ||
186 | msc->touches[id].scroll_y = y; | ||
187 | msc->scroll_jiffies = now; | ||
188 | input_report_rel(input, REL_WHEEL, step); | ||
189 | } | ||
190 | break; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | /* Generate the input events for this touch. */ | ||
195 | if (report_touches) { | ||
196 | int orientation = (misc >> 10) - 32; | ||
197 | |||
198 | input_report_abs(input, ABS_MT_TRACKING_ID, id); | ||
199 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); | ||
200 | input_report_abs(input, ABS_MT_TOUCH_MINOR, tdata[4]); | ||
201 | input_report_abs(input, ABS_MT_ORIENTATION, orientation); | ||
202 | input_report_abs(input, ABS_MT_POSITION_X, x); | ||
203 | input_report_abs(input, ABS_MT_POSITION_Y, y); | ||
204 | |||
205 | if (report_undeciphered) | ||
206 | input_event(input, EV_MSC, MSC_RAW, tdata[7]); | ||
207 | |||
208 | input_mt_sync(input); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | static int magicmouse_raw_event(struct hid_device *hdev, | ||
213 | struct hid_report *report, u8 *data, int size) | ||
214 | { | ||
215 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); | ||
216 | struct input_dev *input = msc->input; | ||
217 | int x, y, ts, ii, clicks; | ||
218 | |||
219 | switch (data[0]) { | ||
220 | case 0x10: | ||
221 | if (size != 6) | ||
222 | return 0; | ||
223 | x = (__s16)(data[2] | data[3] << 8); | ||
224 | y = (__s16)(data[4] | data[5] << 8); | ||
225 | clicks = data[1]; | ||
226 | break; | ||
227 | case TOUCH_REPORT_ID: | ||
228 | /* Expect six bytes of prefix, and N*8 bytes of touch data. */ | ||
229 | if (size < 6 || ((size - 6) % 8) != 0) | ||
230 | return 0; | ||
231 | ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; | ||
232 | msc->delta_time = (ts - msc->last_timestamp) & 0x3ffff; | ||
233 | msc->last_timestamp = ts; | ||
234 | msc->ntouches = (size - 6) / 8; | ||
235 | for (ii = 0; ii < msc->ntouches; ii++) | ||
236 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); | ||
237 | /* When emulating three-button mode, it is important | ||
238 | * to have the current touch information before | ||
239 | * generating a click event. | ||
240 | */ | ||
241 | x = (signed char)data[1]; | ||
242 | y = (signed char)data[2]; | ||
243 | clicks = data[3]; | ||
244 | break; | ||
245 | case 0x20: /* Theoretically battery status (0-100), but I have | ||
246 | * never seen it -- maybe it is only upon request. | ||
247 | */ | ||
248 | case 0x60: /* Unknown, maybe laser on/off. */ | ||
249 | case 0x61: /* Laser reflection status change. | ||
250 | * data[1]: 0 = spotted, 1 = lost | ||
251 | */ | ||
252 | default: | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | magicmouse_emit_buttons(msc, clicks & 3); | ||
257 | input_report_rel(input, REL_X, x); | ||
258 | input_report_rel(input, REL_Y, y); | ||
259 | input_sync(input); | ||
260 | return 1; | ||
261 | } | ||
262 | |||
263 | static int magicmouse_input_open(struct input_dev *dev) | ||
264 | { | ||
265 | struct hid_device *hid = input_get_drvdata(dev); | ||
266 | |||
267 | return hid->ll_driver->open(hid); | ||
268 | } | ||
269 | |||
270 | static void magicmouse_input_close(struct input_dev *dev) | ||
271 | { | ||
272 | struct hid_device *hid = input_get_drvdata(dev); | ||
273 | |||
274 | hid->ll_driver->close(hid); | ||
275 | } | ||
276 | |||
277 | static void magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) | ||
278 | { | ||
279 | input_set_drvdata(input, hdev); | ||
280 | input->event = hdev->ll_driver->hidinput_input_event; | ||
281 | input->open = magicmouse_input_open; | ||
282 | input->close = magicmouse_input_close; | ||
283 | |||
284 | input->name = hdev->name; | ||
285 | input->phys = hdev->phys; | ||
286 | input->uniq = hdev->uniq; | ||
287 | input->id.bustype = hdev->bus; | ||
288 | input->id.vendor = hdev->vendor; | ||
289 | input->id.product = hdev->product; | ||
290 | input->id.version = hdev->version; | ||
291 | input->dev.parent = hdev->dev.parent; | ||
292 | |||
293 | __set_bit(EV_KEY, input->evbit); | ||
294 | __set_bit(BTN_LEFT, input->keybit); | ||
295 | __set_bit(BTN_RIGHT, input->keybit); | ||
296 | if (emulate_3button) | ||
297 | __set_bit(BTN_MIDDLE, input->keybit); | ||
298 | __set_bit(BTN_TOOL_FINGER, input->keybit); | ||
299 | |||
300 | __set_bit(EV_REL, input->evbit); | ||
301 | __set_bit(REL_X, input->relbit); | ||
302 | __set_bit(REL_Y, input->relbit); | ||
303 | if (emulate_scroll_wheel) | ||
304 | __set_bit(REL_WHEEL, input->relbit); | ||
305 | |||
306 | if (report_touches) { | ||
307 | __set_bit(EV_ABS, input->evbit); | ||
308 | |||
309 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); | ||
310 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0); | ||
311 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0); | ||
312 | input_set_abs_params(input, ABS_MT_ORIENTATION, -32, 31, 1, 0); | ||
313 | input_set_abs_params(input, ABS_MT_POSITION_X, -1100, 1358, | ||
314 | 4, 0); | ||
315 | /* Note: Touch Y position from the device is inverted relative | ||
316 | * to how pointer motion is reported (and relative to how USB | ||
317 | * HID recommends the coordinates work). This driver keeps | ||
318 | * the origin at the same position, and just uses the additive | ||
319 | * inverse of the reported Y. | ||
320 | */ | ||
321 | input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, 2047, | ||
322 | 4, 0); | ||
323 | } | ||
324 | |||
325 | if (report_undeciphered) { | ||
326 | __set_bit(EV_MSC, input->evbit); | ||
327 | __set_bit(MSC_RAW, input->mscbit); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | static int magicmouse_probe(struct hid_device *hdev, | ||
332 | const struct hid_device_id *id) | ||
333 | { | ||
334 | __u8 feature_1[] = { 0xd7, 0x01 }; | ||
335 | __u8 feature_2[] = { 0xf8, 0x01, 0x32 }; | ||
336 | struct input_dev *input; | ||
337 | struct magicmouse_sc *msc; | ||
338 | struct hid_report *report; | ||
339 | int ret; | ||
340 | |||
341 | msc = kzalloc(sizeof(*msc), GFP_KERNEL); | ||
342 | if (msc == NULL) { | ||
343 | dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); | ||
344 | return -ENOMEM; | ||
345 | } | ||
346 | |||
347 | msc->quirks = id->driver_data; | ||
348 | hid_set_drvdata(hdev, msc); | ||
349 | |||
350 | ret = hid_parse(hdev); | ||
351 | if (ret) { | ||
352 | dev_err(&hdev->dev, "magicmouse hid parse failed\n"); | ||
353 | goto err_free; | ||
354 | } | ||
355 | |||
356 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
357 | if (ret) { | ||
358 | dev_err(&hdev->dev, "magicmouse hw start failed\n"); | ||
359 | goto err_free; | ||
360 | } | ||
361 | |||
362 | report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID); | ||
363 | if (!report) { | ||
364 | dev_err(&hdev->dev, "unable to register touch report\n"); | ||
365 | ret = -ENOMEM; | ||
366 | goto err_stop_hw; | ||
367 | } | ||
368 | report->size = 6; | ||
369 | |||
370 | ret = hdev->hid_output_raw_report(hdev, feature_1, sizeof(feature_1), | ||
371 | HID_FEATURE_REPORT); | ||
372 | if (ret != sizeof(feature_1)) { | ||
373 | dev_err(&hdev->dev, "unable to request touch data (1:%d)\n", | ||
374 | ret); | ||
375 | goto err_stop_hw; | ||
376 | } | ||
377 | ret = hdev->hid_output_raw_report(hdev, feature_2, | ||
378 | sizeof(feature_2), HID_FEATURE_REPORT); | ||
379 | if (ret != sizeof(feature_2)) { | ||
380 | dev_err(&hdev->dev, "unable to request touch data (2:%d)\n", | ||
381 | ret); | ||
382 | goto err_stop_hw; | ||
383 | } | ||
384 | |||
385 | input = input_allocate_device(); | ||
386 | if (!input) { | ||
387 | dev_err(&hdev->dev, "can't alloc input device\n"); | ||
388 | ret = -ENOMEM; | ||
389 | goto err_stop_hw; | ||
390 | } | ||
391 | magicmouse_setup_input(input, hdev); | ||
392 | |||
393 | ret = input_register_device(input); | ||
394 | if (ret) { | ||
395 | dev_err(&hdev->dev, "input device registration failed\n"); | ||
396 | goto err_input; | ||
397 | } | ||
398 | msc->input = input; | ||
399 | |||
400 | return 0; | ||
401 | err_input: | ||
402 | input_free_device(input); | ||
403 | err_stop_hw: | ||
404 | hid_hw_stop(hdev); | ||
405 | err_free: | ||
406 | kfree(msc); | ||
407 | return ret; | ||
408 | } | ||
409 | |||
410 | static void magicmouse_remove(struct hid_device *hdev) | ||
411 | { | ||
412 | hid_hw_stop(hdev); | ||
413 | kfree(hid_get_drvdata(hdev)); | ||
414 | } | ||
415 | |||
416 | static const struct hid_device_id magic_mice[] = { | ||
417 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE), | ||
418 | .driver_data = 0 }, | ||
419 | { } | ||
420 | }; | ||
421 | MODULE_DEVICE_TABLE(hid, magic_mice); | ||
422 | |||
423 | static struct hid_driver magicmouse_driver = { | ||
424 | .name = "magicmouse", | ||
425 | .id_table = magic_mice, | ||
426 | .probe = magicmouse_probe, | ||
427 | .remove = magicmouse_remove, | ||
428 | .raw_event = magicmouse_raw_event, | ||
429 | }; | ||
430 | |||
431 | static int __init magicmouse_init(void) | ||
432 | { | ||
433 | int ret; | ||
434 | |||
435 | ret = hid_register_driver(&magicmouse_driver); | ||
436 | if (ret) | ||
437 | printk(KERN_ERR "can't register magicmouse driver\n"); | ||
438 | |||
439 | return ret; | ||
440 | } | ||
441 | |||
442 | static void __exit magicmouse_exit(void) | ||
443 | { | ||
444 | hid_unregister_driver(&magicmouse_driver); | ||
445 | } | ||
446 | |||
447 | module_init(magicmouse_init); | ||
448 | module_exit(magicmouse_exit); | ||
449 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c new file mode 100644 index 000000000000..c8718168fe42 --- /dev/null +++ b/drivers/hid/hid-mosart.c | |||
@@ -0,0 +1,273 @@ | |||
1 | /* | ||
2 | * HID driver for the multitouch panel on the ASUS EeePC T91MT | ||
3 | * | ||
4 | * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr> | ||
5 | * Copyright (c) 2010 Teemu Tuominen <teemu.tuominen@cybercom.com> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation; either version 2 of the License, or (at your option) | ||
13 | * any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/device.h> | ||
17 | #include <linux/hid.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/usb.h> | ||
20 | #include "usbhid/usbhid.h" | ||
21 | |||
22 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | ||
23 | MODULE_DESCRIPTION("MosArt dual-touch panel"); | ||
24 | MODULE_LICENSE("GPL"); | ||
25 | |||
26 | #include "hid-ids.h" | ||
27 | |||
28 | struct mosart_data { | ||
29 | __u16 x, y; | ||
30 | __u8 id; | ||
31 | bool valid; /* valid finger data, or just placeholder? */ | ||
32 | bool first; /* is this the first finger in this frame? */ | ||
33 | bool activity_now; /* at least one active finger in this frame? */ | ||
34 | bool activity; /* at least one active finger previously? */ | ||
35 | }; | ||
36 | |||
37 | static int mosart_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
38 | struct hid_field *field, struct hid_usage *usage, | ||
39 | unsigned long **bit, int *max) | ||
40 | { | ||
41 | switch (usage->hid & HID_USAGE_PAGE) { | ||
42 | |||
43 | case HID_UP_GENDESK: | ||
44 | switch (usage->hid) { | ||
45 | case HID_GD_X: | ||
46 | hid_map_usage(hi, usage, bit, max, | ||
47 | EV_ABS, ABS_MT_POSITION_X); | ||
48 | /* touchscreen emulation */ | ||
49 | input_set_abs_params(hi->input, ABS_X, | ||
50 | field->logical_minimum, | ||
51 | field->logical_maximum, 0, 0); | ||
52 | return 1; | ||
53 | case HID_GD_Y: | ||
54 | hid_map_usage(hi, usage, bit, max, | ||
55 | EV_ABS, ABS_MT_POSITION_Y); | ||
56 | /* touchscreen emulation */ | ||
57 | input_set_abs_params(hi->input, ABS_Y, | ||
58 | field->logical_minimum, | ||
59 | field->logical_maximum, 0, 0); | ||
60 | return 1; | ||
61 | } | ||
62 | return 0; | ||
63 | |||
64 | case HID_UP_DIGITIZER: | ||
65 | switch (usage->hid) { | ||
66 | case HID_DG_CONFIDENCE: | ||
67 | case HID_DG_TIPSWITCH: | ||
68 | case HID_DG_INPUTMODE: | ||
69 | case HID_DG_DEVICEINDEX: | ||
70 | case HID_DG_CONTACTCOUNT: | ||
71 | case HID_DG_CONTACTMAX: | ||
72 | case HID_DG_TIPPRESSURE: | ||
73 | case HID_DG_WIDTH: | ||
74 | case HID_DG_HEIGHT: | ||
75 | return -1; | ||
76 | case HID_DG_INRANGE: | ||
77 | /* touchscreen emulation */ | ||
78 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | ||
79 | return 1; | ||
80 | |||
81 | case HID_DG_CONTACTID: | ||
82 | hid_map_usage(hi, usage, bit, max, | ||
83 | EV_ABS, ABS_MT_TRACKING_ID); | ||
84 | return 1; | ||
85 | |||
86 | } | ||
87 | return 0; | ||
88 | |||
89 | case 0xff000000: | ||
90 | /* ignore HID features */ | ||
91 | return -1; | ||
92 | } | ||
93 | |||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | static int mosart_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
98 | struct hid_field *field, struct hid_usage *usage, | ||
99 | unsigned long **bit, int *max) | ||
100 | { | ||
101 | if (usage->type == EV_KEY || usage->type == EV_ABS) | ||
102 | clear_bit(usage->code, *bit); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * this function is called when a whole finger has been parsed, | ||
109 | * so that it can decide what to send to the input layer. | ||
110 | */ | ||
111 | static void mosart_filter_event(struct mosart_data *td, struct input_dev *input) | ||
112 | { | ||
113 | td->first = !td->first; /* touchscreen emulation */ | ||
114 | |||
115 | if (!td->valid) { | ||
116 | /* | ||
117 | * touchscreen emulation: if no finger in this frame is valid | ||
118 | * and there previously was finger activity, this is a release | ||
119 | */ | ||
120 | if (!td->first && !td->activity_now && td->activity) { | ||
121 | input_event(input, EV_KEY, BTN_TOUCH, 0); | ||
122 | td->activity = false; | ||
123 | } | ||
124 | return; | ||
125 | } | ||
126 | |||
127 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); | ||
128 | input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); | ||
129 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); | ||
130 | |||
131 | input_mt_sync(input); | ||
132 | td->valid = false; | ||
133 | |||
134 | /* touchscreen emulation: if first active finger in this frame... */ | ||
135 | if (!td->activity_now) { | ||
136 | /* if there was no previous activity, emit touch event */ | ||
137 | if (!td->activity) { | ||
138 | input_event(input, EV_KEY, BTN_TOUCH, 1); | ||
139 | td->activity = true; | ||
140 | } | ||
141 | td->activity_now = true; | ||
142 | /* and in any case this is our preferred finger */ | ||
143 | input_event(input, EV_ABS, ABS_X, td->x); | ||
144 | input_event(input, EV_ABS, ABS_Y, td->y); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | |||
149 | static int mosart_event(struct hid_device *hid, struct hid_field *field, | ||
150 | struct hid_usage *usage, __s32 value) | ||
151 | { | ||
152 | struct mosart_data *td = hid_get_drvdata(hid); | ||
153 | |||
154 | if (hid->claimed & HID_CLAIMED_INPUT) { | ||
155 | struct input_dev *input = field->hidinput->input; | ||
156 | switch (usage->hid) { | ||
157 | case HID_DG_INRANGE: | ||
158 | td->valid = !!value; | ||
159 | break; | ||
160 | case HID_GD_X: | ||
161 | td->x = value; | ||
162 | break; | ||
163 | case HID_GD_Y: | ||
164 | td->y = value; | ||
165 | mosart_filter_event(td, input); | ||
166 | break; | ||
167 | case HID_DG_CONTACTID: | ||
168 | td->id = value; | ||
169 | break; | ||
170 | case HID_DG_CONTACTCOUNT: | ||
171 | /* touch emulation: this is the last field in a frame */ | ||
172 | td->first = false; | ||
173 | td->activity_now = false; | ||
174 | break; | ||
175 | case HID_DG_CONFIDENCE: | ||
176 | case HID_DG_TIPSWITCH: | ||
177 | /* avoid interference from generic hidinput handling */ | ||
178 | break; | ||
179 | |||
180 | default: | ||
181 | /* fallback to the generic hidinput handling */ | ||
182 | return 0; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | /* we have handled the hidinput part, now remains hiddev */ | ||
187 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | ||
188 | hid->hiddev_hid_event(hid, field, usage, value); | ||
189 | |||
190 | return 1; | ||
191 | } | ||
192 | |||
193 | static int mosart_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
194 | { | ||
195 | int ret; | ||
196 | struct mosart_data *td; | ||
197 | |||
198 | |||
199 | td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL); | ||
200 | if (!td) { | ||
201 | dev_err(&hdev->dev, "cannot allocate MosArt data\n"); | ||
202 | return -ENOMEM; | ||
203 | } | ||
204 | td->valid = false; | ||
205 | td->activity = false; | ||
206 | td->activity_now = false; | ||
207 | td->first = false; | ||
208 | hid_set_drvdata(hdev, td); | ||
209 | |||
210 | /* currently, it's better to have one evdev device only */ | ||
211 | #if 0 | ||
212 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | ||
213 | #endif | ||
214 | |||
215 | ret = hid_parse(hdev); | ||
216 | if (ret == 0) | ||
217 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
218 | |||
219 | if (ret == 0) { | ||
220 | struct hid_report_enum *re = hdev->report_enum | ||
221 | + HID_FEATURE_REPORT; | ||
222 | struct hid_report *r = re->report_id_hash[7]; | ||
223 | |||
224 | r->field[0]->value[0] = 0x02; | ||
225 | usbhid_submit_report(hdev, r, USB_DIR_OUT); | ||
226 | } else | ||
227 | kfree(td); | ||
228 | |||
229 | return ret; | ||
230 | } | ||
231 | |||
232 | static void mosart_remove(struct hid_device *hdev) | ||
233 | { | ||
234 | hid_hw_stop(hdev); | ||
235 | kfree(hid_get_drvdata(hdev)); | ||
236 | hid_set_drvdata(hdev, NULL); | ||
237 | } | ||
238 | |||
239 | static const struct hid_device_id mosart_devices[] = { | ||
240 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, | ||
241 | { } | ||
242 | }; | ||
243 | MODULE_DEVICE_TABLE(hid, mosart_devices); | ||
244 | |||
245 | static const struct hid_usage_id mosart_grabbed_usages[] = { | ||
246 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | ||
247 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | ||
248 | }; | ||
249 | |||
250 | static struct hid_driver mosart_driver = { | ||
251 | .name = "mosart", | ||
252 | .id_table = mosart_devices, | ||
253 | .probe = mosart_probe, | ||
254 | .remove = mosart_remove, | ||
255 | .input_mapping = mosart_input_mapping, | ||
256 | .input_mapped = mosart_input_mapped, | ||
257 | .usage_table = mosart_grabbed_usages, | ||
258 | .event = mosart_event, | ||
259 | }; | ||
260 | |||
261 | static int __init mosart_init(void) | ||
262 | { | ||
263 | return hid_register_driver(&mosart_driver); | ||
264 | } | ||
265 | |||
266 | static void __exit mosart_exit(void) | ||
267 | { | ||
268 | hid_unregister_driver(&mosart_driver); | ||
269 | } | ||
270 | |||
271 | module_init(mosart_init); | ||
272 | module_exit(mosart_exit); | ||
273 | |||
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 49ce69d7bba7..3234c729a895 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c | |||
@@ -25,11 +25,16 @@ | |||
25 | EV_KEY, (c)) | 25 | EV_KEY, (c)) |
26 | 26 | ||
27 | struct ntrig_data { | 27 | struct ntrig_data { |
28 | __s32 x, y, id, w, h; | 28 | /* Incoming raw values for a single contact */ |
29 | char reading_a_point, found_contact_id; | 29 | __u16 x, y, w, h; |
30 | char pen_active; | 30 | __u16 id; |
31 | char finger_active; | 31 | __u8 confidence; |
32 | char inverted; | 32 | |
33 | bool reading_mt; | ||
34 | __u8 first_contact_confidence; | ||
35 | |||
36 | __u8 mt_footer[4]; | ||
37 | __u8 mt_foot_count; | ||
33 | }; | 38 | }; |
34 | 39 | ||
35 | /* | 40 | /* |
@@ -42,8 +47,11 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
42 | struct hid_field *field, struct hid_usage *usage, | 47 | struct hid_field *field, struct hid_usage *usage, |
43 | unsigned long **bit, int *max) | 48 | unsigned long **bit, int *max) |
44 | { | 49 | { |
45 | switch (usage->hid & HID_USAGE_PAGE) { | 50 | /* No special mappings needed for the pen and single touch */ |
51 | if (field->physical) | ||
52 | return 0; | ||
46 | 53 | ||
54 | switch (usage->hid & HID_USAGE_PAGE) { | ||
47 | case HID_UP_GENDESK: | 55 | case HID_UP_GENDESK: |
48 | switch (usage->hid) { | 56 | switch (usage->hid) { |
49 | case HID_GD_X: | 57 | case HID_GD_X: |
@@ -66,18 +74,12 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
66 | case HID_UP_DIGITIZER: | 74 | case HID_UP_DIGITIZER: |
67 | switch (usage->hid) { | 75 | switch (usage->hid) { |
68 | /* we do not want to map these for now */ | 76 | /* we do not want to map these for now */ |
69 | case HID_DG_CONTACTID: /* value is useless */ | 77 | case HID_DG_CONTACTID: /* Not trustworthy, squelch for now */ |
70 | case HID_DG_INPUTMODE: | 78 | case HID_DG_INPUTMODE: |
71 | case HID_DG_DEVICEINDEX: | 79 | case HID_DG_DEVICEINDEX: |
72 | case HID_DG_CONTACTCOUNT: | ||
73 | case HID_DG_CONTACTMAX: | 80 | case HID_DG_CONTACTMAX: |
74 | return -1; | 81 | return -1; |
75 | 82 | ||
76 | /* original mapping by Rafi Rubin */ | ||
77 | case HID_DG_CONFIDENCE: | ||
78 | nt_map_key_clear(BTN_TOOL_DOUBLETAP); | ||
79 | return 1; | ||
80 | |||
81 | /* width/height mapped on TouchMajor/TouchMinor/Orientation */ | 83 | /* width/height mapped on TouchMajor/TouchMinor/Orientation */ |
82 | case HID_DG_WIDTH: | 84 | case HID_DG_WIDTH: |
83 | hid_map_usage(hi, usage, bit, max, | 85 | hid_map_usage(hi, usage, bit, max, |
@@ -104,6 +106,10 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, | |||
104 | struct hid_field *field, struct hid_usage *usage, | 106 | struct hid_field *field, struct hid_usage *usage, |
105 | unsigned long **bit, int *max) | 107 | unsigned long **bit, int *max) |
106 | { | 108 | { |
109 | /* No special mappings needed for the pen and single touch */ | ||
110 | if (field->physical) | ||
111 | return 0; | ||
112 | |||
107 | if (usage->type == EV_KEY || usage->type == EV_REL | 113 | if (usage->type == EV_KEY || usage->type == EV_REL |
108 | || usage->type == EV_ABS) | 114 | || usage->type == EV_ABS) |
109 | clear_bit(usage->code, *bit); | 115 | clear_bit(usage->code, *bit); |
@@ -123,31 +129,30 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
123 | struct input_dev *input = field->hidinput->input; | 129 | struct input_dev *input = field->hidinput->input; |
124 | struct ntrig_data *nd = hid_get_drvdata(hid); | 130 | struct ntrig_data *nd = hid_get_drvdata(hid); |
125 | 131 | ||
132 | /* No special handling needed for the pen */ | ||
133 | if (field->application == HID_DG_PEN) | ||
134 | return 0; | ||
135 | |||
126 | if (hid->claimed & HID_CLAIMED_INPUT) { | 136 | if (hid->claimed & HID_CLAIMED_INPUT) { |
127 | switch (usage->hid) { | 137 | switch (usage->hid) { |
128 | 138 | case 0xff000001: | |
129 | case HID_DG_INRANGE: | 139 | /* Tag indicating the start of a multitouch group */ |
130 | if (field->application & 0x3) | 140 | nd->reading_mt = 1; |
131 | nd->pen_active = (value != 0); | 141 | nd->first_contact_confidence = 0; |
132 | else | 142 | break; |
133 | nd->finger_active = (value != 0); | 143 | case HID_DG_CONFIDENCE: |
134 | return 0; | 144 | nd->confidence = value; |
135 | 145 | break; | |
136 | case HID_DG_INVERT: | ||
137 | nd->inverted = value; | ||
138 | return 0; | ||
139 | |||
140 | case HID_GD_X: | 146 | case HID_GD_X: |
141 | nd->x = value; | 147 | nd->x = value; |
142 | nd->reading_a_point = 1; | 148 | /* Clear the contact footer */ |
149 | nd->mt_foot_count = 0; | ||
143 | break; | 150 | break; |
144 | case HID_GD_Y: | 151 | case HID_GD_Y: |
145 | nd->y = value; | 152 | nd->y = value; |
146 | break; | 153 | break; |
147 | case HID_DG_CONTACTID: | 154 | case HID_DG_CONTACTID: |
148 | nd->id = value; | 155 | nd->id = value; |
149 | /* we receive this only when in multitouch mode */ | ||
150 | nd->found_contact_id = 1; | ||
151 | break; | 156 | break; |
152 | case HID_DG_WIDTH: | 157 | case HID_DG_WIDTH: |
153 | nd->w = value; | 158 | nd->w = value; |
@@ -159,35 +164,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
159 | * report received in a finger event. We want | 164 | * report received in a finger event. We want |
160 | * to emit a normal (X, Y) position | 165 | * to emit a normal (X, Y) position |
161 | */ | 166 | */ |
162 | if (!nd->found_contact_id) { | 167 | if (!nd->reading_mt) { |
163 | if (nd->pen_active && nd->finger_active) { | 168 | input_report_key(input, BTN_TOOL_DOUBLETAP, |
164 | input_report_key(input, BTN_TOOL_DOUBLETAP, 0); | 169 | (nd->confidence != 0)); |
165 | input_report_key(input, BTN_TOOL_DOUBLETAP, 1); | ||
166 | } | ||
167 | input_event(input, EV_ABS, ABS_X, nd->x); | 170 | input_event(input, EV_ABS, ABS_X, nd->x); |
168 | input_event(input, EV_ABS, ABS_Y, nd->y); | 171 | input_event(input, EV_ABS, ABS_Y, nd->y); |
169 | } | 172 | } |
170 | break; | 173 | break; |
171 | case HID_DG_TIPPRESSURE: | ||
172 | /* | ||
173 | * when in single touch mode, this is the last | ||
174 | * report received in a pen event. We want | ||
175 | * to emit a normal (X, Y) position | ||
176 | */ | ||
177 | if (! nd->found_contact_id) { | ||
178 | if (nd->pen_active && nd->finger_active) { | ||
179 | input_report_key(input, | ||
180 | nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN | ||
181 | , 0); | ||
182 | input_report_key(input, | ||
183 | nd->inverted ? BTN_TOOL_RUBBER : BTN_TOOL_PEN | ||
184 | , 1); | ||
185 | } | ||
186 | input_event(input, EV_ABS, ABS_X, nd->x); | ||
187 | input_event(input, EV_ABS, ABS_Y, nd->y); | ||
188 | input_event(input, EV_ABS, ABS_PRESSURE, value); | ||
189 | } | ||
190 | break; | ||
191 | case 0xff000002: | 174 | case 0xff000002: |
192 | /* | 175 | /* |
193 | * we receive this when the device is in multitouch | 176 | * we receive this when the device is in multitouch |
@@ -195,10 +178,34 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
195 | * this usage tells if the contact point is real | 178 | * this usage tells if the contact point is real |
196 | * or a placeholder | 179 | * or a placeholder |
197 | */ | 180 | */ |
198 | if (!nd->reading_a_point || value != 1) | 181 | |
182 | /* Shouldn't get more than 4 footer packets, so skip */ | ||
183 | if (nd->mt_foot_count >= 4) | ||
199 | break; | 184 | break; |
185 | |||
186 | nd->mt_footer[nd->mt_foot_count++] = value; | ||
187 | |||
188 | /* if the footer isn't complete break */ | ||
189 | if (nd->mt_foot_count != 4) | ||
190 | break; | ||
191 | |||
192 | /* Pen activity signal, trigger end of touch. */ | ||
193 | if (nd->mt_footer[2]) { | ||
194 | nd->confidence = 0; | ||
195 | break; | ||
196 | } | ||
197 | |||
198 | /* If the contact was invalid */ | ||
199 | if (!(nd->confidence && nd->mt_footer[0]) | ||
200 | || nd->w <= 250 | ||
201 | || nd->h <= 190) { | ||
202 | nd->confidence = 0; | ||
203 | break; | ||
204 | } | ||
205 | |||
200 | /* emit a normal (X, Y) for the first point only */ | 206 | /* emit a normal (X, Y) for the first point only */ |
201 | if (nd->id == 0) { | 207 | if (nd->id == 0) { |
208 | nd->first_contact_confidence = nd->confidence; | ||
202 | input_event(input, EV_ABS, ABS_X, nd->x); | 209 | input_event(input, EV_ABS, ABS_X, nd->x); |
203 | input_event(input, EV_ABS, ABS_Y, nd->y); | 210 | input_event(input, EV_ABS, ABS_Y, nd->y); |
204 | } | 211 | } |
@@ -220,8 +227,39 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
220 | ABS_MT_TOUCH_MINOR, nd->w); | 227 | ABS_MT_TOUCH_MINOR, nd->w); |
221 | } | 228 | } |
222 | input_mt_sync(field->hidinput->input); | 229 | input_mt_sync(field->hidinput->input); |
223 | nd->reading_a_point = 0; | 230 | break; |
224 | nd->found_contact_id = 0; | 231 | |
232 | case HID_DG_CONTACTCOUNT: /* End of a multitouch group */ | ||
233 | if (!nd->reading_mt) | ||
234 | break; | ||
235 | |||
236 | nd->reading_mt = 0; | ||
237 | |||
238 | if (nd->first_contact_confidence) { | ||
239 | switch (value) { | ||
240 | case 0: /* for single touch devices */ | ||
241 | case 1: | ||
242 | input_report_key(input, | ||
243 | BTN_TOOL_DOUBLETAP, 1); | ||
244 | break; | ||
245 | case 2: | ||
246 | input_report_key(input, | ||
247 | BTN_TOOL_TRIPLETAP, 1); | ||
248 | break; | ||
249 | case 3: | ||
250 | default: | ||
251 | input_report_key(input, | ||
252 | BTN_TOOL_QUADTAP, 1); | ||
253 | } | ||
254 | input_report_key(input, BTN_TOUCH, 1); | ||
255 | } else { | ||
256 | input_report_key(input, | ||
257 | BTN_TOOL_DOUBLETAP, 0); | ||
258 | input_report_key(input, | ||
259 | BTN_TOOL_TRIPLETAP, 0); | ||
260 | input_report_key(input, | ||
261 | BTN_TOOL_QUADTAP, 0); | ||
262 | } | ||
225 | break; | 263 | break; |
226 | 264 | ||
227 | default: | 265 | default: |
@@ -231,8 +269,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
231 | } | 269 | } |
232 | 270 | ||
233 | /* we have handled the hidinput part, now remains hiddev */ | 271 | /* we have handled the hidinput part, now remains hiddev */ |
234 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | 272 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event) |
235 | hid->hiddev_hid_event(hid, field, usage, value); | 273 | hid->hiddev_hid_event(hid, field, usage, value); |
236 | 274 | ||
237 | return 1; | 275 | return 1; |
238 | } | 276 | } |
@@ -241,23 +279,67 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
241 | { | 279 | { |
242 | int ret; | 280 | int ret; |
243 | struct ntrig_data *nd; | 281 | struct ntrig_data *nd; |
282 | struct hid_input *hidinput; | ||
283 | struct input_dev *input; | ||
284 | |||
285 | if (id->driver_data) | ||
286 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | ||
244 | 287 | ||
245 | nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL); | 288 | nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL); |
246 | if (!nd) { | 289 | if (!nd) { |
247 | dev_err(&hdev->dev, "cannot allocate N-Trig data\n"); | 290 | dev_err(&hdev->dev, "cannot allocate N-Trig data\n"); |
248 | return -ENOMEM; | 291 | return -ENOMEM; |
249 | } | 292 | } |
250 | nd->reading_a_point = 0; | 293 | |
251 | nd->found_contact_id = 0; | 294 | nd->reading_mt = 0; |
252 | hid_set_drvdata(hdev, nd); | 295 | hid_set_drvdata(hdev, nd); |
253 | 296 | ||
254 | ret = hid_parse(hdev); | 297 | ret = hid_parse(hdev); |
255 | if (!ret) | 298 | if (ret) { |
256 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 299 | dev_err(&hdev->dev, "parse failed\n"); |
300 | goto err_free; | ||
301 | } | ||
302 | |||
303 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); | ||
304 | if (ret) { | ||
305 | dev_err(&hdev->dev, "hw start failed\n"); | ||
306 | goto err_free; | ||
307 | } | ||
257 | 308 | ||
258 | if (ret) | ||
259 | kfree (nd); | ||
260 | 309 | ||
310 | list_for_each_entry(hidinput, &hdev->inputs, list) { | ||
311 | input = hidinput->input; | ||
312 | switch (hidinput->report->field[0]->application) { | ||
313 | case HID_DG_PEN: | ||
314 | input->name = "N-Trig Pen"; | ||
315 | break; | ||
316 | case HID_DG_TOUCHSCREEN: | ||
317 | __clear_bit(BTN_TOOL_PEN, input->keybit); | ||
318 | /* | ||
319 | * A little something special to enable | ||
320 | * two and three finger taps. | ||
321 | */ | ||
322 | __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); | ||
323 | __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); | ||
324 | __set_bit(BTN_TOOL_QUADTAP, input->keybit); | ||
325 | /* | ||
326 | * The physical touchscreen (single touch) | ||
327 | * input has a value for physical, whereas | ||
328 | * the multitouch only has logical input | ||
329 | * fields. | ||
330 | */ | ||
331 | input->name = | ||
332 | (hidinput->report->field[0] | ||
333 | ->physical) ? | ||
334 | "N-Trig Touchscreen" : | ||
335 | "N-Trig MultiTouch"; | ||
336 | break; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | return 0; | ||
341 | err_free: | ||
342 | kfree(nd); | ||
261 | return ret; | 343 | return ret; |
262 | } | 344 | } |
263 | 345 | ||
@@ -276,7 +358,7 @@ MODULE_DEVICE_TABLE(hid, ntrig_devices); | |||
276 | 358 | ||
277 | static const struct hid_usage_id ntrig_grabbed_usages[] = { | 359 | static const struct hid_usage_id ntrig_grabbed_usages[] = { |
278 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | 360 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, |
279 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | 361 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 } |
280 | }; | 362 | }; |
281 | 363 | ||
282 | static struct hid_driver ntrig_driver = { | 364 | static struct hid_driver ntrig_driver = { |
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c new file mode 100644 index 000000000000..aa9a960f73a4 --- /dev/null +++ b/drivers/hid/hid-ortek.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * HID driver for Ortek WKB-2000 (wireless keyboard + mouse trackpad). | ||
3 | * Fixes LogicalMaximum error in USB report description, see | ||
4 | * http://bugzilla.kernel.org/show_bug.cgi?id=14787 | ||
5 | * | ||
6 | * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation; either version 2 of the License, or (at your option) | ||
13 | * any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/device.h> | ||
17 | #include <linux/hid.h> | ||
18 | #include <linux/module.h> | ||
19 | |||
20 | #include "hid-ids.h" | ||
21 | |||
22 | static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
23 | unsigned int rsize) | ||
24 | { | ||
25 | if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { | ||
26 | dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " | ||
27 | "report descriptor.\n"); | ||
28 | rdesc[55] = 0x92; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | static const struct hid_device_id ortek_devices[] = { | ||
33 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, | ||
34 | { } | ||
35 | }; | ||
36 | MODULE_DEVICE_TABLE(hid, ortek_devices); | ||
37 | |||
38 | static struct hid_driver ortek_driver = { | ||
39 | .name = "ortek", | ||
40 | .id_table = ortek_devices, | ||
41 | .report_fixup = ortek_report_fixup | ||
42 | }; | ||
43 | |||
44 | static int __init ortek_init(void) | ||
45 | { | ||
46 | return hid_register_driver(&ortek_driver); | ||
47 | } | ||
48 | |||
49 | static void __exit ortek_exit(void) | ||
50 | { | ||
51 | hid_unregister_driver(&ortek_driver); | ||
52 | } | ||
53 | |||
54 | module_init(ortek_init); | ||
55 | module_exit(ortek_exit); | ||
56 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-quanta.c b/drivers/hid/hid-quanta.c new file mode 100644 index 000000000000..01dd51c4986c --- /dev/null +++ b/drivers/hid/hid-quanta.c | |||
@@ -0,0 +1,260 @@ | |||
1 | /* | ||
2 | * HID driver for Quanta Optical Touch dual-touch panels | ||
3 | * | ||
4 | * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr> | ||
5 | * | ||
6 | */ | ||
7 | |||
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 as published by the Free | ||
11 | * Software Foundation; either version 2 of the License, or (at your option) | ||
12 | * any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/device.h> | ||
16 | #include <linux/hid.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | ||
20 | MODULE_DESCRIPTION("Quanta dual-touch panel"); | ||
21 | MODULE_LICENSE("GPL"); | ||
22 | |||
23 | #include "hid-ids.h" | ||
24 | |||
25 | struct quanta_data { | ||
26 | __u16 x, y; | ||
27 | __u8 id; | ||
28 | bool valid; /* valid finger data, or just placeholder? */ | ||
29 | bool first; /* is this the first finger in this frame? */ | ||
30 | bool activity_now; /* at least one active finger in this frame? */ | ||
31 | bool activity; /* at least one active finger previously? */ | ||
32 | }; | ||
33 | |||
34 | static int quanta_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
35 | struct hid_field *field, struct hid_usage *usage, | ||
36 | unsigned long **bit, int *max) | ||
37 | { | ||
38 | switch (usage->hid & HID_USAGE_PAGE) { | ||
39 | |||
40 | case HID_UP_GENDESK: | ||
41 | switch (usage->hid) { | ||
42 | case HID_GD_X: | ||
43 | hid_map_usage(hi, usage, bit, max, | ||
44 | EV_ABS, ABS_MT_POSITION_X); | ||
45 | /* touchscreen emulation */ | ||
46 | input_set_abs_params(hi->input, ABS_X, | ||
47 | field->logical_minimum, | ||
48 | field->logical_maximum, 0, 0); | ||
49 | return 1; | ||
50 | case HID_GD_Y: | ||
51 | hid_map_usage(hi, usage, bit, max, | ||
52 | EV_ABS, ABS_MT_POSITION_Y); | ||
53 | /* touchscreen emulation */ | ||
54 | input_set_abs_params(hi->input, ABS_Y, | ||
55 | field->logical_minimum, | ||
56 | field->logical_maximum, 0, 0); | ||
57 | return 1; | ||
58 | } | ||
59 | return 0; | ||
60 | |||
61 | case HID_UP_DIGITIZER: | ||
62 | switch (usage->hid) { | ||
63 | case HID_DG_CONFIDENCE: | ||
64 | case HID_DG_TIPSWITCH: | ||
65 | case HID_DG_INPUTMODE: | ||
66 | case HID_DG_DEVICEINDEX: | ||
67 | case HID_DG_CONTACTCOUNT: | ||
68 | case HID_DG_CONTACTMAX: | ||
69 | case HID_DG_TIPPRESSURE: | ||
70 | case HID_DG_WIDTH: | ||
71 | case HID_DG_HEIGHT: | ||
72 | return -1; | ||
73 | case HID_DG_INRANGE: | ||
74 | /* touchscreen emulation */ | ||
75 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | ||
76 | return 1; | ||
77 | case HID_DG_CONTACTID: | ||
78 | hid_map_usage(hi, usage, bit, max, | ||
79 | EV_ABS, ABS_MT_TRACKING_ID); | ||
80 | return 1; | ||
81 | } | ||
82 | return 0; | ||
83 | |||
84 | case 0xff000000: | ||
85 | /* ignore vendor-specific features */ | ||
86 | return -1; | ||
87 | } | ||
88 | |||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | static int quanta_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
93 | struct hid_field *field, struct hid_usage *usage, | ||
94 | unsigned long **bit, int *max) | ||
95 | { | ||
96 | if (usage->type == EV_KEY || usage->type == EV_ABS) | ||
97 | clear_bit(usage->code, *bit); | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * this function is called when a whole finger has been parsed, | ||
104 | * so that it can decide what to send to the input layer. | ||
105 | */ | ||
106 | static void quanta_filter_event(struct quanta_data *td, struct input_dev *input) | ||
107 | { | ||
108 | |||
109 | td->first = !td->first; /* touchscreen emulation */ | ||
110 | |||
111 | if (!td->valid) { | ||
112 | /* | ||
113 | * touchscreen emulation: if no finger in this frame is valid | ||
114 | * and there previously was finger activity, this is a release | ||
115 | */ | ||
116 | if (!td->first && !td->activity_now && td->activity) { | ||
117 | input_event(input, EV_KEY, BTN_TOUCH, 0); | ||
118 | td->activity = false; | ||
119 | } | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); | ||
124 | input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); | ||
125 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); | ||
126 | |||
127 | input_mt_sync(input); | ||
128 | td->valid = false; | ||
129 | |||
130 | /* touchscreen emulation: if first active finger in this frame... */ | ||
131 | if (!td->activity_now) { | ||
132 | /* if there was no previous activity, emit touch event */ | ||
133 | if (!td->activity) { | ||
134 | input_event(input, EV_KEY, BTN_TOUCH, 1); | ||
135 | td->activity = true; | ||
136 | } | ||
137 | td->activity_now = true; | ||
138 | /* and in any case this is our preferred finger */ | ||
139 | input_event(input, EV_ABS, ABS_X, td->x); | ||
140 | input_event(input, EV_ABS, ABS_Y, td->y); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | |||
145 | static int quanta_event(struct hid_device *hid, struct hid_field *field, | ||
146 | struct hid_usage *usage, __s32 value) | ||
147 | { | ||
148 | struct quanta_data *td = hid_get_drvdata(hid); | ||
149 | |||
150 | if (hid->claimed & HID_CLAIMED_INPUT) { | ||
151 | struct input_dev *input = field->hidinput->input; | ||
152 | |||
153 | switch (usage->hid) { | ||
154 | case HID_DG_INRANGE: | ||
155 | td->valid = !!value; | ||
156 | break; | ||
157 | case HID_GD_X: | ||
158 | td->x = value; | ||
159 | break; | ||
160 | case HID_GD_Y: | ||
161 | td->y = value; | ||
162 | quanta_filter_event(td, input); | ||
163 | break; | ||
164 | case HID_DG_CONTACTID: | ||
165 | td->id = value; | ||
166 | break; | ||
167 | case HID_DG_CONTACTCOUNT: | ||
168 | /* touch emulation: this is the last field in a frame */ | ||
169 | td->first = false; | ||
170 | td->activity_now = false; | ||
171 | break; | ||
172 | case HID_DG_CONFIDENCE: | ||
173 | case HID_DG_TIPSWITCH: | ||
174 | /* avoid interference from generic hidinput handling */ | ||
175 | break; | ||
176 | |||
177 | default: | ||
178 | /* fallback to the generic hidinput handling */ | ||
179 | return 0; | ||
180 | } | ||
181 | } | ||
182 | |||
183 | /* we have handled the hidinput part, now remains hiddev */ | ||
184 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | ||
185 | hid->hiddev_hid_event(hid, field, usage, value); | ||
186 | |||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | static int quanta_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
191 | { | ||
192 | int ret; | ||
193 | struct quanta_data *td; | ||
194 | |||
195 | td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL); | ||
196 | if (!td) { | ||
197 | dev_err(&hdev->dev, "cannot allocate Quanta Touch data\n"); | ||
198 | return -ENOMEM; | ||
199 | } | ||
200 | td->valid = false; | ||
201 | td->activity = false; | ||
202 | td->activity_now = false; | ||
203 | td->first = false; | ||
204 | hid_set_drvdata(hdev, td); | ||
205 | |||
206 | ret = hid_parse(hdev); | ||
207 | if (!ret) | ||
208 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
209 | |||
210 | if (ret) | ||
211 | kfree(td); | ||
212 | |||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | static void quanta_remove(struct hid_device *hdev) | ||
217 | { | ||
218 | hid_hw_stop(hdev); | ||
219 | kfree(hid_get_drvdata(hdev)); | ||
220 | hid_set_drvdata(hdev, NULL); | ||
221 | } | ||
222 | |||
223 | static const struct hid_device_id quanta_devices[] = { | ||
224 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | ||
225 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, | ||
226 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | ||
227 | USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, | ||
228 | { } | ||
229 | }; | ||
230 | MODULE_DEVICE_TABLE(hid, quanta_devices); | ||
231 | |||
232 | static const struct hid_usage_id quanta_grabbed_usages[] = { | ||
233 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | ||
234 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | ||
235 | }; | ||
236 | |||
237 | static struct hid_driver quanta_driver = { | ||
238 | .name = "quanta-touch", | ||
239 | .id_table = quanta_devices, | ||
240 | .probe = quanta_probe, | ||
241 | .remove = quanta_remove, | ||
242 | .input_mapping = quanta_input_mapping, | ||
243 | .input_mapped = quanta_input_mapped, | ||
244 | .usage_table = quanta_grabbed_usages, | ||
245 | .event = quanta_event, | ||
246 | }; | ||
247 | |||
248 | static int __init quanta_init(void) | ||
249 | { | ||
250 | return hid_register_driver(&quanta_driver); | ||
251 | } | ||
252 | |||
253 | static void __exit quanta_exit(void) | ||
254 | { | ||
255 | hid_unregister_driver(&quanta_driver); | ||
256 | } | ||
257 | |||
258 | module_init(quanta_init); | ||
259 | module_exit(quanta_exit); | ||
260 | |||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 4e8450228a24..9bf00d77d92b 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -48,7 +48,7 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
48 | * to "operational". Without this, the ps3 controller will not report any | 48 | * to "operational". Without this, the ps3 controller will not report any |
49 | * events. | 49 | * events. |
50 | */ | 50 | */ |
51 | static int sony_set_operational(struct hid_device *hdev) | 51 | static int sony_set_operational_usb(struct hid_device *hdev) |
52 | { | 52 | { |
53 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 53 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
54 | struct usb_device *dev = interface_to_usbdev(intf); | 54 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -73,6 +73,12 @@ static int sony_set_operational(struct hid_device *hdev) | |||
73 | return ret; | 73 | return ret; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int sony_set_operational_bt(struct hid_device *hdev) | ||
77 | { | ||
78 | unsigned char buf[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00 }; | ||
79 | return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); | ||
80 | } | ||
81 | |||
76 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | 82 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) |
77 | { | 83 | { |
78 | int ret; | 84 | int ret; |
@@ -81,7 +87,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
81 | 87 | ||
82 | sc = kzalloc(sizeof(*sc), GFP_KERNEL); | 88 | sc = kzalloc(sizeof(*sc), GFP_KERNEL); |
83 | if (sc == NULL) { | 89 | if (sc == NULL) { |
84 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | 90 | dev_err(&hdev->dev, "can't alloc sony descriptor\n"); |
85 | return -ENOMEM; | 91 | return -ENOMEM; |
86 | } | 92 | } |
87 | 93 | ||
@@ -101,7 +107,17 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
101 | goto err_free; | 107 | goto err_free; |
102 | } | 108 | } |
103 | 109 | ||
104 | ret = sony_set_operational(hdev); | 110 | switch (hdev->bus) { |
111 | case BUS_USB: | ||
112 | ret = sony_set_operational_usb(hdev); | ||
113 | break; | ||
114 | case BUS_BLUETOOTH: | ||
115 | ret = sony_set_operational_bt(hdev); | ||
116 | break; | ||
117 | default: | ||
118 | ret = 0; | ||
119 | } | ||
120 | |||
105 | if (ret < 0) | 121 | if (ret < 0) |
106 | goto err_stop; | 122 | goto err_stop; |
107 | 123 | ||
@@ -121,6 +137,7 @@ static void sony_remove(struct hid_device *hdev) | |||
121 | 137 | ||
122 | static const struct hid_device_id sony_devices[] = { | 138 | static const struct hid_device_id sony_devices[] = { |
123 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 139 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
140 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
124 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), | 141 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), |
125 | .driver_data = VAIO_RDESC_CONSTANT }, | 142 | .driver_data = VAIO_RDESC_CONSTANT }, |
126 | { } | 143 | { } |
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c new file mode 100644 index 000000000000..2e592a06654e --- /dev/null +++ b/drivers/hid/hid-stantum.c | |||
@@ -0,0 +1,283 @@ | |||
1 | /* | ||
2 | * HID driver for Stantum multitouch panels | ||
3 | * | ||
4 | * Copyright (c) 2009 Stephane Chatty <chatty@enac.fr> | ||
5 | * | ||
6 | */ | ||
7 | |||
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 as published by the Free | ||
11 | * Software Foundation; either version 2 of the License, or (at your option) | ||
12 | * any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/device.h> | ||
16 | #include <linux/hid.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); | ||
20 | MODULE_DESCRIPTION("Stantum HID multitouch panels"); | ||
21 | MODULE_LICENSE("GPL"); | ||
22 | |||
23 | #include "hid-ids.h" | ||
24 | |||
25 | struct stantum_data { | ||
26 | __s32 x, y, z, w, h; /* x, y, pressure, width, height */ | ||
27 | __u16 id; /* touch id */ | ||
28 | bool valid; /* valid finger data, or just placeholder? */ | ||
29 | bool first; /* first finger in the HID packet? */ | ||
30 | bool activity; /* at least one active finger so far? */ | ||
31 | }; | ||
32 | |||
33 | static int stantum_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
34 | struct hid_field *field, struct hid_usage *usage, | ||
35 | unsigned long **bit, int *max) | ||
36 | { | ||
37 | switch (usage->hid & HID_USAGE_PAGE) { | ||
38 | |||
39 | case HID_UP_GENDESK: | ||
40 | switch (usage->hid) { | ||
41 | case HID_GD_X: | ||
42 | hid_map_usage(hi, usage, bit, max, | ||
43 | EV_ABS, ABS_MT_POSITION_X); | ||
44 | /* touchscreen emulation */ | ||
45 | input_set_abs_params(hi->input, ABS_X, | ||
46 | field->logical_minimum, | ||
47 | field->logical_maximum, 0, 0); | ||
48 | return 1; | ||
49 | case HID_GD_Y: | ||
50 | hid_map_usage(hi, usage, bit, max, | ||
51 | EV_ABS, ABS_MT_POSITION_Y); | ||
52 | /* touchscreen emulation */ | ||
53 | input_set_abs_params(hi->input, ABS_Y, | ||
54 | field->logical_minimum, | ||
55 | field->logical_maximum, 0, 0); | ||
56 | return 1; | ||
57 | } | ||
58 | return 0; | ||
59 | |||
60 | case HID_UP_DIGITIZER: | ||
61 | switch (usage->hid) { | ||
62 | case HID_DG_INRANGE: | ||
63 | case HID_DG_CONFIDENCE: | ||
64 | case HID_DG_INPUTMODE: | ||
65 | case HID_DG_DEVICEINDEX: | ||
66 | case HID_DG_CONTACTCOUNT: | ||
67 | case HID_DG_CONTACTMAX: | ||
68 | return -1; | ||
69 | |||
70 | case HID_DG_TIPSWITCH: | ||
71 | /* touchscreen emulation */ | ||
72 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | ||
73 | return 1; | ||
74 | |||
75 | case HID_DG_WIDTH: | ||
76 | hid_map_usage(hi, usage, bit, max, | ||
77 | EV_ABS, ABS_MT_TOUCH_MAJOR); | ||
78 | return 1; | ||
79 | case HID_DG_HEIGHT: | ||
80 | hid_map_usage(hi, usage, bit, max, | ||
81 | EV_ABS, ABS_MT_TOUCH_MINOR); | ||
82 | input_set_abs_params(hi->input, ABS_MT_ORIENTATION, | ||
83 | 1, 1, 0, 0); | ||
84 | return 1; | ||
85 | case HID_DG_TIPPRESSURE: | ||
86 | hid_map_usage(hi, usage, bit, max, | ||
87 | EV_ABS, ABS_MT_PRESSURE); | ||
88 | return 1; | ||
89 | |||
90 | case HID_DG_CONTACTID: | ||
91 | hid_map_usage(hi, usage, bit, max, | ||
92 | EV_ABS, ABS_MT_TRACKING_ID); | ||
93 | return 1; | ||
94 | |||
95 | } | ||
96 | return 0; | ||
97 | |||
98 | case 0xff000000: | ||
99 | /* no input-oriented meaning */ | ||
100 | return -1; | ||
101 | } | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static int stantum_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
107 | struct hid_field *field, struct hid_usage *usage, | ||
108 | unsigned long **bit, int *max) | ||
109 | { | ||
110 | if (usage->type == EV_KEY || usage->type == EV_ABS) | ||
111 | clear_bit(usage->code, *bit); | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * this function is called when a whole finger has been parsed, | ||
118 | * so that it can decide what to send to the input layer. | ||
119 | */ | ||
120 | static void stantum_filter_event(struct stantum_data *sd, | ||
121 | struct input_dev *input) | ||
122 | { | ||
123 | bool wide; | ||
124 | |||
125 | if (!sd->valid) { | ||
126 | /* | ||
127 | * touchscreen emulation: if the first finger is not valid and | ||
128 | * there previously was finger activity, this is a release | ||
129 | */ | ||
130 | if (sd->first && sd->activity) { | ||
131 | input_event(input, EV_KEY, BTN_TOUCH, 0); | ||
132 | sd->activity = false; | ||
133 | } | ||
134 | return; | ||
135 | } | ||
136 | |||
137 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, sd->id); | ||
138 | input_event(input, EV_ABS, ABS_MT_POSITION_X, sd->x); | ||
139 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, sd->y); | ||
140 | |||
141 | wide = (sd->w > sd->h); | ||
142 | input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); | ||
143 | input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, wide ? sd->w : sd->h); | ||
144 | input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, wide ? sd->h : sd->w); | ||
145 | |||
146 | input_event(input, EV_ABS, ABS_MT_PRESSURE, sd->z); | ||
147 | |||
148 | input_mt_sync(input); | ||
149 | sd->valid = false; | ||
150 | |||
151 | /* touchscreen emulation */ | ||
152 | if (sd->first) { | ||
153 | if (!sd->activity) { | ||
154 | input_event(input, EV_KEY, BTN_TOUCH, 1); | ||
155 | sd->activity = true; | ||
156 | } | ||
157 | input_event(input, EV_ABS, ABS_X, sd->x); | ||
158 | input_event(input, EV_ABS, ABS_Y, sd->y); | ||
159 | } | ||
160 | sd->first = false; | ||
161 | } | ||
162 | |||
163 | |||
164 | static int stantum_event(struct hid_device *hid, struct hid_field *field, | ||
165 | struct hid_usage *usage, __s32 value) | ||
166 | { | ||
167 | struct stantum_data *sd = hid_get_drvdata(hid); | ||
168 | |||
169 | if (hid->claimed & HID_CLAIMED_INPUT) { | ||
170 | struct input_dev *input = field->hidinput->input; | ||
171 | |||
172 | switch (usage->hid) { | ||
173 | case HID_DG_INRANGE: | ||
174 | /* this is the last field in a finger */ | ||
175 | stantum_filter_event(sd, input); | ||
176 | break; | ||
177 | case HID_DG_WIDTH: | ||
178 | sd->w = value; | ||
179 | break; | ||
180 | case HID_DG_HEIGHT: | ||
181 | sd->h = value; | ||
182 | break; | ||
183 | case HID_GD_X: | ||
184 | sd->x = value; | ||
185 | break; | ||
186 | case HID_GD_Y: | ||
187 | sd->y = value; | ||
188 | break; | ||
189 | case HID_DG_TIPPRESSURE: | ||
190 | sd->z = value; | ||
191 | break; | ||
192 | case HID_DG_CONTACTID: | ||
193 | sd->id = value; | ||
194 | break; | ||
195 | case HID_DG_CONFIDENCE: | ||
196 | sd->valid = !!value; | ||
197 | break; | ||
198 | case 0xff000002: | ||
199 | /* this comes only before the first finger */ | ||
200 | sd->first = true; | ||
201 | break; | ||
202 | |||
203 | default: | ||
204 | /* ignore the others */ | ||
205 | return 1; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /* we have handled the hidinput part, now remains hiddev */ | ||
210 | if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event) | ||
211 | hid->hiddev_hid_event(hid, field, usage, value); | ||
212 | |||
213 | return 1; | ||
214 | } | ||
215 | |||
216 | static int stantum_probe(struct hid_device *hdev, | ||
217 | const struct hid_device_id *id) | ||
218 | { | ||
219 | int ret; | ||
220 | struct stantum_data *sd; | ||
221 | |||
222 | sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL); | ||
223 | if (!sd) { | ||
224 | dev_err(&hdev->dev, "cannot allocate Stantum data\n"); | ||
225 | return -ENOMEM; | ||
226 | } | ||
227 | sd->valid = false; | ||
228 | sd->first = false; | ||
229 | sd->activity = false; | ||
230 | hid_set_drvdata(hdev, sd); | ||
231 | |||
232 | ret = hid_parse(hdev); | ||
233 | if (!ret) | ||
234 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
235 | |||
236 | if (ret) | ||
237 | kfree(sd); | ||
238 | |||
239 | return ret; | ||
240 | } | ||
241 | |||
242 | static void stantum_remove(struct hid_device *hdev) | ||
243 | { | ||
244 | hid_hw_stop(hdev); | ||
245 | kfree(hid_get_drvdata(hdev)); | ||
246 | hid_set_drvdata(hdev, NULL); | ||
247 | } | ||
248 | |||
249 | static const struct hid_device_id stantum_devices[] = { | ||
250 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, | ||
251 | { } | ||
252 | }; | ||
253 | MODULE_DEVICE_TABLE(hid, stantum_devices); | ||
254 | |||
255 | static const struct hid_usage_id stantum_grabbed_usages[] = { | ||
256 | { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID }, | ||
257 | { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1} | ||
258 | }; | ||
259 | |||
260 | static struct hid_driver stantum_driver = { | ||
261 | .name = "stantum", | ||
262 | .id_table = stantum_devices, | ||
263 | .probe = stantum_probe, | ||
264 | .remove = stantum_remove, | ||
265 | .input_mapping = stantum_input_mapping, | ||
266 | .input_mapped = stantum_input_mapped, | ||
267 | .usage_table = stantum_grabbed_usages, | ||
268 | .event = stantum_event, | ||
269 | }; | ||
270 | |||
271 | static int __init stantum_init(void) | ||
272 | { | ||
273 | return hid_register_driver(&stantum_driver); | ||
274 | } | ||
275 | |||
276 | static void __exit stantum_exit(void) | ||
277 | { | ||
278 | hid_unregister_driver(&stantum_driver); | ||
279 | } | ||
280 | |||
281 | module_init(stantum_init); | ||
282 | module_exit(stantum_exit); | ||
283 | |||
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 12dcda529201..8d3b46f5d149 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
@@ -156,7 +156,9 @@ static int wacom_probe(struct hid_device *hdev, | |||
156 | struct hid_input *hidinput; | 156 | struct hid_input *hidinput; |
157 | struct input_dev *input; | 157 | struct input_dev *input; |
158 | struct wacom_data *wdata; | 158 | struct wacom_data *wdata; |
159 | char rep_data[2]; | ||
159 | int ret; | 160 | int ret; |
161 | int limit; | ||
160 | 162 | ||
161 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); | 163 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); |
162 | if (wdata == NULL) { | 164 | if (wdata == NULL) { |
@@ -166,6 +168,7 @@ static int wacom_probe(struct hid_device *hdev, | |||
166 | 168 | ||
167 | hid_set_drvdata(hdev, wdata); | 169 | hid_set_drvdata(hdev, wdata); |
168 | 170 | ||
171 | /* Parse the HID report now */ | ||
169 | ret = hid_parse(hdev); | 172 | ret = hid_parse(hdev); |
170 | if (ret) { | 173 | if (ret) { |
171 | dev_err(&hdev->dev, "parse failed\n"); | 174 | dev_err(&hdev->dev, "parse failed\n"); |
@@ -178,6 +181,31 @@ static int wacom_probe(struct hid_device *hdev, | |||
178 | goto err_free; | 181 | goto err_free; |
179 | } | 182 | } |
180 | 183 | ||
184 | /* | ||
185 | * Note that if the raw queries fail, it's not a hard failure and it | ||
186 | * is safe to continue | ||
187 | */ | ||
188 | |||
189 | /* Set Wacom mode2 */ | ||
190 | rep_data[0] = 0x03; rep_data[1] = 0x00; | ||
191 | limit = 3; | ||
192 | do { | ||
193 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, | ||
194 | HID_FEATURE_REPORT); | ||
195 | } while (ret < 0 && limit-- > 0); | ||
196 | if (ret < 0) | ||
197 | dev_warn(&hdev->dev, "failed to poke device #1, %d\n", ret); | ||
198 | |||
199 | /* 0x06 - high reporting speed, 0x05 - low speed */ | ||
200 | rep_data[0] = 0x06; rep_data[1] = 0x00; | ||
201 | limit = 3; | ||
202 | do { | ||
203 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, | ||
204 | HID_FEATURE_REPORT); | ||
205 | } while (ret < 0 && limit-- > 0); | ||
206 | if (ret < 0) | ||
207 | dev_warn(&hdev->dev, "failed to poke device #2, %d\n", ret); | ||
208 | |||
181 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); | 209 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
182 | input = hidinput->input; | 210 | input = hidinput->input; |
183 | 211 | ||
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index cdd136942bca..d04476700b7b 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -134,7 +134,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
134 | goto out; | 134 | goto out; |
135 | } | 135 | } |
136 | 136 | ||
137 | ret = dev->hid_output_raw_report(dev, buf, count); | 137 | ret = dev->hid_output_raw_report(dev, buf, count, HID_OUTPUT_REPORT); |
138 | out: | 138 | out: |
139 | kfree(buf); | 139 | kfree(buf); |
140 | return ret; | 140 | return ret; |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index e2997a8d5e1b..56d06cd8075b 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2007-2008 Oliver Neukum | 7 | * Copyright (c) 2007-2008 Oliver Neukum |
8 | * Copyright (c) 2006-2009 Jiri Kosina | 8 | * Copyright (c) 2006-2010 Jiri Kosina |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* | 11 | /* |
@@ -316,6 +316,7 @@ static int hid_submit_out(struct hid_device *hid) | |||
316 | err_hid("usb_submit_urb(out) failed"); | 316 | err_hid("usb_submit_urb(out) failed"); |
317 | return -1; | 317 | return -1; |
318 | } | 318 | } |
319 | usbhid->last_out = jiffies; | ||
319 | } else { | 320 | } else { |
320 | /* | 321 | /* |
321 | * queue work to wake up the device. | 322 | * queue work to wake up the device. |
@@ -377,6 +378,7 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
377 | err_hid("usb_submit_urb(ctrl) failed"); | 378 | err_hid("usb_submit_urb(ctrl) failed"); |
378 | return -1; | 379 | return -1; |
379 | } | 380 | } |
381 | usbhid->last_ctrl = jiffies; | ||
380 | } else { | 382 | } else { |
381 | /* | 383 | /* |
382 | * queue work to wake up the device. | 384 | * queue work to wake up the device. |
@@ -512,9 +514,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re | |||
512 | usbhid->out[usbhid->outhead].report = report; | 514 | usbhid->out[usbhid->outhead].report = report; |
513 | usbhid->outhead = head; | 515 | usbhid->outhead = head; |
514 | 516 | ||
515 | if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) | 517 | if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) { |
516 | if (hid_submit_out(hid)) | 518 | if (hid_submit_out(hid)) |
517 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); | 519 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); |
520 | } else { | ||
521 | /* | ||
522 | * the queue is known to run | ||
523 | * but an earlier request may be stuck | ||
524 | * we may need to time out | ||
525 | * no race because this is called under | ||
526 | * spinlock | ||
527 | */ | ||
528 | if (time_after(jiffies, usbhid->last_out + HZ * 5)) | ||
529 | usb_unlink_urb(usbhid->urbout); | ||
530 | } | ||
518 | return; | 531 | return; |
519 | } | 532 | } |
520 | 533 | ||
@@ -535,9 +548,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re | |||
535 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; | 548 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; |
536 | usbhid->ctrlhead = head; | 549 | usbhid->ctrlhead = head; |
537 | 550 | ||
538 | if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) | 551 | if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) { |
539 | if (hid_submit_ctrl(hid)) | 552 | if (hid_submit_ctrl(hid)) |
540 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 553 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); |
554 | } else { | ||
555 | /* | ||
556 | * the queue is known to run | ||
557 | * but an earlier request may be stuck | ||
558 | * we may need to time out | ||
559 | * no race because this is called under | ||
560 | * spinlock | ||
561 | */ | ||
562 | if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) | ||
563 | usb_unlink_urb(usbhid->urbctrl); | ||
564 | } | ||
541 | } | 565 | } |
542 | 566 | ||
543 | void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) | 567 | void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) |
@@ -774,7 +798,8 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) | |||
774 | return 0; | 798 | return 0; |
775 | } | 799 | } |
776 | 800 | ||
777 | static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count) | 801 | static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count, |
802 | unsigned char report_type) | ||
778 | { | 803 | { |
779 | struct usbhid_device *usbhid = hid->driver_data; | 804 | struct usbhid_device *usbhid = hid->driver_data; |
780 | struct usb_device *dev = hid_to_usb_dev(hid); | 805 | struct usb_device *dev = hid_to_usb_dev(hid); |
@@ -785,7 +810,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
785 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 810 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
786 | HID_REQ_SET_REPORT, | 811 | HID_REQ_SET_REPORT, |
787 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 812 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
788 | ((HID_OUTPUT_REPORT + 1) << 8) | *buf, | 813 | ((report_type + 1) << 8) | *buf, |
789 | interface->desc.bInterfaceNumber, buf + 1, count - 1, | 814 | interface->desc.bInterfaceNumber, buf + 1, count - 1, |
790 | USB_CTRL_SET_TIMEOUT); | 815 | USB_CTRL_SET_TIMEOUT); |
791 | 816 | ||
@@ -981,9 +1006,6 @@ static int usbhid_start(struct hid_device *hid) | |||
981 | 1006 | ||
982 | spin_lock_init(&usbhid->lock); | 1007 | spin_lock_init(&usbhid->lock); |
983 | 1008 | ||
984 | usbhid->intf = intf; | ||
985 | usbhid->ifnum = interface->desc.bInterfaceNumber; | ||
986 | |||
987 | usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); | 1009 | usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); |
988 | if (!usbhid->urbctrl) { | 1010 | if (!usbhid->urbctrl) { |
989 | ret = -ENOMEM; | 1011 | ret = -ENOMEM; |
@@ -1154,6 +1176,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * | |||
1154 | 1176 | ||
1155 | hid->driver_data = usbhid; | 1177 | hid->driver_data = usbhid; |
1156 | usbhid->hid = hid; | 1178 | usbhid->hid = hid; |
1179 | usbhid->intf = intf; | ||
1180 | usbhid->ifnum = interface->desc.bInterfaceNumber; | ||
1157 | 1181 | ||
1158 | ret = hid_add_device(hid); | 1182 | ret = hid_add_device(hid); |
1159 | if (ret) { | 1183 | if (ret) { |
@@ -1342,7 +1366,7 @@ static int hid_reset_resume(struct usb_interface *intf) | |||
1342 | 1366 | ||
1343 | #endif /* CONFIG_PM */ | 1367 | #endif /* CONFIG_PM */ |
1344 | 1368 | ||
1345 | static struct usb_device_id hid_usb_ids [] = { | 1369 | static const struct usb_device_id hid_usb_ids[] = { |
1346 | { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, | 1370 | { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, |
1347 | .bInterfaceClass = USB_INTERFACE_CLASS_HID }, | 1371 | .bInterfaceClass = USB_INTERFACE_CLASS_HID }, |
1348 | { } /* Terminating entry */ | 1372 | { } /* Terminating entry */ |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 38773dc2821b..7844280897d1 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -43,8 +43,10 @@ static const struct hid_blacklist { | |||
43 | 43 | ||
44 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, | 44 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, |
45 | 45 | ||
46 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, | ||
46 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 47 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
47 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 48 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
49 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, | ||
48 | 50 | ||
49 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, | 51 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, |
50 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, | 52 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, |
@@ -57,6 +59,7 @@ static const struct hid_blacklist { | |||
57 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, | 59 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, |
58 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 60 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
59 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | ||
60 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
61 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | 64 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | 65 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 08f505ca2e3d..ec20400c7f29 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -80,12 +80,14 @@ struct usbhid_device { | |||
80 | unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */ | 80 | unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */ |
81 | char *ctrlbuf; /* Control buffer */ | 81 | char *ctrlbuf; /* Control buffer */ |
82 | dma_addr_t ctrlbuf_dma; /* Control buffer dma */ | 82 | dma_addr_t ctrlbuf_dma; /* Control buffer dma */ |
83 | unsigned long last_ctrl; /* record of last output for timeouts */ | ||
83 | 84 | ||
84 | struct urb *urbout; /* Output URB */ | 85 | struct urb *urbout; /* Output URB */ |
85 | struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */ | 86 | struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */ |
86 | unsigned char outhead, outtail; /* Output pipe fifo head & tail */ | 87 | unsigned char outhead, outtail; /* Output pipe fifo head & tail */ |
87 | char *outbuf; /* Output buffer */ | 88 | char *outbuf; /* Output buffer */ |
88 | dma_addr_t outbuf_dma; /* Output buffer dma */ | 89 | dma_addr_t outbuf_dma; /* Output buffer dma */ |
90 | unsigned long last_out; /* record of last output for timeouts */ | ||
89 | 91 | ||
90 | spinlock_t lock; /* fifo spinlock */ | 92 | spinlock_t lock; /* fifo spinlock */ |
91 | unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ | 93 | unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ |