aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-06-17 13:37:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-06-17 13:37:01 -0400
commitd9cbf022bb75497fa2ecd7ae166fc92b000ad46e (patch)
treeb7a5c446893448f87ddb8a330b4499ca4c0a0538
parent0835619348b097404f4f85bc5195c6e23a2f8de4 (diff)
parentc3a4924565e2eecf2539871abd123d35be6d76d5 (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: Revert "HID: magicmouse: ignore 'ivalid report id' while switching modes" HID: hid-multitouch: fix broken eGalax HID: MAINTAINERS: Update USB HID/HIDBP DRIVERS pattern HID: hid-multitouch: add support for Chunghwa multi-touch panel HID: hiddev: fix use after free in hiddev_release HID: add quirk for HyperPen 10000U HID: hiddev: fix potential use-after-free
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/hid/Kconfig1
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-magicmouse.c10
-rw-r--r--drivers/hid/hid-multitouch.c62
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hid/usbhid/hiddev.c8
8 files changed, 59 insertions, 30 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 6c59eb90fdf4..502f2dd761eb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6463,7 +6463,7 @@ M: Jiri Kosina <jkosina@suse.cz>
6463L: linux-usb@vger.kernel.org 6463L: linux-usb@vger.kernel.org
6464T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git 6464T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
6465S: Maintained 6465S: Maintained
6466F: Documentation/usb/hiddev.txt 6466F: Documentation/hid/hiddev.txt
6467F: drivers/hid/usbhid/ 6467F: drivers/hid/usbhid/
6468 6468
6469USB ISP116X DRIVER 6469USB ISP116X DRIVER
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 67d2a7585934..36ca465c00ce 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -305,6 +305,7 @@ config HID_MULTITOUCH
305 - 3M PCT touch screens 305 - 3M PCT touch screens
306 - ActionStar dual touch panels 306 - ActionStar dual touch panels
307 - Cando dual touch panels 307 - Cando dual touch panels
308 - Chunghwa panels
308 - CVTouch panels 309 - CVTouch panels
309 - Cypress TrueTouch panels 310 - Cypress TrueTouch panels
310 - Elo TouchSystems IntelliTouch Plus panels 311 - Elo TouchSystems IntelliTouch Plus panels
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c957c4b4fe70..f7440e8ce3e7 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1359,6 +1359,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1359 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, 1359 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1360 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1360 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1361 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, 1361 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
1362 { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
1362 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 1363 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
1363 { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, 1364 { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) },
1364 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1365 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 0b374a6d6db0..aecb5a4b8d6d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -173,6 +173,9 @@
173#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d 173#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d
174#define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 174#define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
175 175
176#define USB_VENDOR_ID_CHUNGHWAT 0x2247
177#define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001
178
176#define USB_VENDOR_ID_CIDC 0x1677 179#define USB_VENDOR_ID_CIDC 0x1677
177 180
178#define USB_VENDOR_ID_CMEDIA 0x0d8c 181#define USB_VENDOR_ID_CMEDIA 0x0d8c
@@ -622,6 +625,7 @@
622#define USB_VENDOR_ID_UCLOGIC 0x5543 625#define USB_VENDOR_ID_UCLOGIC 0x5543
623#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 626#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042
624#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 627#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001
628#define USB_DEVICE_ID_UCLOGIC_TABLET_TWA60 0x0064
625#define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 629#define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003
626#define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 630#define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004
627#define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 631#define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index a5eda4c8127a..0ec91c18a421 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -501,17 +501,9 @@ static int magicmouse_probe(struct hid_device *hdev,
501 } 501 }
502 report->size = 6; 502 report->size = 6;
503 503
504 /*
505 * The device reponds with 'invalid report id' when feature
506 * report switching it into multitouch mode is sent to it.
507 *
508 * This results in -EIO from the _raw low-level transport callback,
509 * but there seems to be no other way of switching the mode.
510 * Thus the super-ugly hacky success check below.
511 */
512 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), 504 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
513 HID_FEATURE_REPORT); 505 HID_FEATURE_REPORT);
514 if (ret != -EIO) { 506 if (ret != sizeof(feature)) {
515 hid_err(hdev, "unable to request touch data (%d)\n", ret); 507 hid_err(hdev, "unable to request touch data (%d)\n", ret);
516 goto err_stop_hw; 508 goto err_stop_hw;
517 } 509 }
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index ecd4d2db9e80..0b2dcd0ee591 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -64,6 +64,7 @@ struct mt_device {
64 struct mt_class *mtclass; /* our mt device class */ 64 struct mt_class *mtclass; /* our mt device class */
65 unsigned last_field_index; /* last field index of the report */ 65 unsigned last_field_index; /* last field index of the report */
66 unsigned last_slot_field; /* the last field of a slot */ 66 unsigned last_slot_field; /* the last field of a slot */
67 int last_mt_collection; /* last known mt-related collection */
67 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ 68 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
68 __u8 num_received; /* how many contacts we received */ 69 __u8 num_received; /* how many contacts we received */
69 __u8 num_expected; /* expected last contact index */ 70 __u8 num_expected; /* expected last contact index */
@@ -225,8 +226,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
225 cls->sn_move); 226 cls->sn_move);
226 /* touchscreen emulation */ 227 /* touchscreen emulation */
227 set_abs(hi->input, ABS_X, field, cls->sn_move); 228 set_abs(hi->input, ABS_X, field, cls->sn_move);
228 td->last_slot_field = usage->hid; 229 if (td->last_mt_collection == usage->collection_index) {
229 td->last_field_index = field->index; 230 td->last_slot_field = usage->hid;
231 td->last_field_index = field->index;
232 }
230 return 1; 233 return 1;
231 case HID_GD_Y: 234 case HID_GD_Y:
232 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) 235 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
@@ -237,8 +240,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
237 cls->sn_move); 240 cls->sn_move);
238 /* touchscreen emulation */ 241 /* touchscreen emulation */
239 set_abs(hi->input, ABS_Y, field, cls->sn_move); 242 set_abs(hi->input, ABS_Y, field, cls->sn_move);
240 td->last_slot_field = usage->hid; 243 if (td->last_mt_collection == usage->collection_index) {
241 td->last_field_index = field->index; 244 td->last_slot_field = usage->hid;
245 td->last_field_index = field->index;
246 }
242 return 1; 247 return 1;
243 } 248 }
244 return 0; 249 return 0;
@@ -246,31 +251,40 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
246 case HID_UP_DIGITIZER: 251 case HID_UP_DIGITIZER:
247 switch (usage->hid) { 252 switch (usage->hid) {
248 case HID_DG_INRANGE: 253 case HID_DG_INRANGE:
249 td->last_slot_field = usage->hid; 254 if (td->last_mt_collection == usage->collection_index) {
250 td->last_field_index = field->index; 255 td->last_slot_field = usage->hid;
256 td->last_field_index = field->index;
257 }
251 return 1; 258 return 1;
252 case HID_DG_CONFIDENCE: 259 case HID_DG_CONFIDENCE:
253 td->last_slot_field = usage->hid; 260 if (td->last_mt_collection == usage->collection_index) {
254 td->last_field_index = field->index; 261 td->last_slot_field = usage->hid;
262 td->last_field_index = field->index;
263 }
255 return 1; 264 return 1;
256 case HID_DG_TIPSWITCH: 265 case HID_DG_TIPSWITCH:
257 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); 266 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
258 input_set_capability(hi->input, EV_KEY, BTN_TOUCH); 267 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
259 td->last_slot_field = usage->hid; 268 if (td->last_mt_collection == usage->collection_index) {
260 td->last_field_index = field->index; 269 td->last_slot_field = usage->hid;
270 td->last_field_index = field->index;
271 }
261 return 1; 272 return 1;
262 case HID_DG_CONTACTID: 273 case HID_DG_CONTACTID:
263 input_mt_init_slots(hi->input, td->maxcontacts); 274 input_mt_init_slots(hi->input, td->maxcontacts);
264 td->last_slot_field = usage->hid; 275 td->last_slot_field = usage->hid;
265 td->last_field_index = field->index; 276 td->last_field_index = field->index;
277 td->last_mt_collection = usage->collection_index;
266 return 1; 278 return 1;
267 case HID_DG_WIDTH: 279 case HID_DG_WIDTH:
268 hid_map_usage(hi, usage, bit, max, 280 hid_map_usage(hi, usage, bit, max,
269 EV_ABS, ABS_MT_TOUCH_MAJOR); 281 EV_ABS, ABS_MT_TOUCH_MAJOR);
270 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, 282 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
271 cls->sn_width); 283 cls->sn_width);
272 td->last_slot_field = usage->hid; 284 if (td->last_mt_collection == usage->collection_index) {
273 td->last_field_index = field->index; 285 td->last_slot_field = usage->hid;
286 td->last_field_index = field->index;
287 }
274 return 1; 288 return 1;
275 case HID_DG_HEIGHT: 289 case HID_DG_HEIGHT:
276 hid_map_usage(hi, usage, bit, max, 290 hid_map_usage(hi, usage, bit, max,
@@ -279,8 +293,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
279 cls->sn_height); 293 cls->sn_height);
280 input_set_abs_params(hi->input, 294 input_set_abs_params(hi->input,
281 ABS_MT_ORIENTATION, 0, 1, 0, 0); 295 ABS_MT_ORIENTATION, 0, 1, 0, 0);
282 td->last_slot_field = usage->hid; 296 if (td->last_mt_collection == usage->collection_index) {
283 td->last_field_index = field->index; 297 td->last_slot_field = usage->hid;
298 td->last_field_index = field->index;
299 }
284 return 1; 300 return 1;
285 case HID_DG_TIPPRESSURE: 301 case HID_DG_TIPPRESSURE:
286 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) 302 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
@@ -292,16 +308,20 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
292 /* touchscreen emulation */ 308 /* touchscreen emulation */
293 set_abs(hi->input, ABS_PRESSURE, field, 309 set_abs(hi->input, ABS_PRESSURE, field,
294 cls->sn_pressure); 310 cls->sn_pressure);
295 td->last_slot_field = usage->hid; 311 if (td->last_mt_collection == usage->collection_index) {
296 td->last_field_index = field->index; 312 td->last_slot_field = usage->hid;
313 td->last_field_index = field->index;
314 }
297 return 1; 315 return 1;
298 case HID_DG_CONTACTCOUNT: 316 case HID_DG_CONTACTCOUNT:
299 td->last_field_index = field->index; 317 if (td->last_mt_collection == usage->collection_index)
318 td->last_field_index = field->index;
300 return 1; 319 return 1;
301 case HID_DG_CONTACTMAX: 320 case HID_DG_CONTACTMAX:
302 /* we don't set td->last_slot_field as contactcount and 321 /* we don't set td->last_slot_field as contactcount and
303 * contact max are global to the report */ 322 * contact max are global to the report */
304 td->last_field_index = field->index; 323 if (td->last_mt_collection == usage->collection_index)
324 td->last_field_index = field->index;
305 return -1; 325 return -1;
306 } 326 }
307 /* let hid-input decide for the others */ 327 /* let hid-input decide for the others */
@@ -516,6 +536,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
516 } 536 }
517 td->mtclass = mtclass; 537 td->mtclass = mtclass;
518 td->inputmode = -1; 538 td->inputmode = -1;
539 td->last_mt_collection = -1;
519 hid_set_drvdata(hdev, td); 540 hid_set_drvdata(hdev, td);
520 541
521 ret = hid_parse(hdev); 542 ret = hid_parse(hdev);
@@ -593,6 +614,11 @@ static const struct hid_device_id mt_devices[] = {
593 HID_USB_DEVICE(USB_VENDOR_ID_CANDO, 614 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
594 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, 615 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
595 616
617 /* Chunghwa Telecom touch panels */
618 { .driver_data = MT_CLS_DEFAULT,
619 HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
620 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
621
596 /* CVTouch panels */ 622 /* CVTouch panels */
597 { .driver_data = MT_CLS_DEFAULT, 623 { .driver_data = MT_CLS_DEFAULT,
598 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, 624 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 0e30b140edca..621959d5cc42 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -74,6 +74,7 @@ static const struct hid_blacklist {
74 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, 74 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
75 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, 75 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT },
76 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, 76 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT },
77 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT },
77 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, 78 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT },
78 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, 79 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT },
79 { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, 80 { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT },
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index ff3c644888b1..7c1188b53c3e 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
248 usbhid_close(list->hiddev->hid); 248 usbhid_close(list->hiddev->hid);
249 usbhid_put_power(list->hiddev->hid); 249 usbhid_put_power(list->hiddev->hid);
250 } else { 250 } else {
251 mutex_unlock(&list->hiddev->existancelock);
251 kfree(list->hiddev); 252 kfree(list->hiddev);
253 kfree(list);
254 return 0;
252 } 255 }
253 } 256 }
254 257
255 kfree(list);
256 mutex_unlock(&list->hiddev->existancelock); 258 mutex_unlock(&list->hiddev->existancelock);
259 kfree(list);
257 260
258 return 0; 261 return 0;
259} 262}
@@ -923,10 +926,11 @@ void hiddev_disconnect(struct hid_device *hid)
923 usb_deregister_dev(usbhid->intf, &hiddev_class); 926 usb_deregister_dev(usbhid->intf, &hiddev_class);
924 927
925 if (hiddev->open) { 928 if (hiddev->open) {
929 mutex_unlock(&hiddev->existancelock);
926 usbhid_close(hiddev->hid); 930 usbhid_close(hiddev->hid);
927 wake_up_interruptible(&hiddev->wait); 931 wake_up_interruptible(&hiddev->wait);
928 } else { 932 } else {
933 mutex_unlock(&hiddev->existancelock);
929 kfree(hiddev); 934 kfree(hiddev);
930 } 935 }
931 mutex_unlock(&hiddev->existancelock);
932} 936}