diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-10-22 08:47:18 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-10-22 08:47:18 -0400 |
commit | b4d8e4736c94e78fd846dca0c95a3a0710582584 (patch) | |
tree | 30128466329024f1a30819502e642217d8a9198d /drivers | |
parent | a73a63701f8f23e70674b3c5e367a0a726c18468 (diff) |
HID: fix hidbus/appletouch device binding regression
The appletouch mouse devices are grabbed by the hid bus and not
released even if apple driver says ENODEV (as expected) -- these
are composite USB devices, for which we only ignore the mouse
interface. This is currently not handled by hidbus code properly.
Move the ignoring one level upper to forbid the hid layer to grab the
device.
Reported-by: Justin Mattock <justinmattock@gmail.com>
Reported-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/hid-apple.c | 63 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 38 |
2 files changed, 60 insertions, 41 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fd7f896b34f7..c6ab4ba60c52 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -312,13 +312,6 @@ static int apple_probe(struct hid_device *hdev, | |||
312 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | 312 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
313 | int ret; | 313 | int ret; |
314 | 314 | ||
315 | /* return something else or move to hid layer? device will reside | ||
316 | allocated */ | ||
317 | if (id->bus == BUS_USB && (quirks & APPLE_IGNORE_MOUSE) && | ||
318 | to_usb_interface(hdev->dev.parent)->cur_altsetting-> | ||
319 | desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) | ||
320 | return -ENODEV; | ||
321 | |||
322 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); | 315 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); |
323 | if (asc == NULL) { | 316 | if (asc == NULL) { |
324 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | 317 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); |
@@ -367,38 +360,32 @@ static const struct hid_device_id apple_devices[] = { | |||
367 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, | 360 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, |
368 | 361 | ||
369 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), | 362 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), |
370 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 363 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
371 | APPLE_IGNORE_MOUSE }, | ||
372 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), | 364 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), |
373 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 365 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
374 | APPLE_IGNORE_MOUSE }, | ||
375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), | 366 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), |
376 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 367 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
377 | APPLE_IGNORE_MOUSE }, | ||
378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), | 368 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), |
379 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 369 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
380 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 370 | APPLE_ISO_KEYBOARD }, |
381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), | 371 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), |
382 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 372 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
383 | APPLE_IGNORE_MOUSE }, | ||
384 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), | 373 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), |
385 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 374 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
386 | APPLE_IGNORE_MOUSE }, | ||
387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), | 375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), |
388 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 376 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
389 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 377 | APPLE_ISO_KEYBOARD }, |
390 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), | 378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), |
391 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 379 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
392 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 380 | APPLE_RDESC_JIS }, |
393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), | 381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), |
394 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 382 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
395 | APPLE_IGNORE_MOUSE }, | ||
396 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), | 383 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), |
397 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 384 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
398 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 385 | APPLE_ISO_KEYBOARD }, |
399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), | 386 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), |
400 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 387 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
401 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS}, | 388 | APPLE_RDESC_JIS }, |
402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), | 389 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), |
403 | .driver_data = APPLE_HAS_FN }, | 390 | .driver_data = APPLE_HAS_FN }, |
404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), | 391 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), |
@@ -406,14 +393,12 @@ static const struct hid_device_id apple_devices[] = { | |||
406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), | 393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), |
407 | .driver_data = APPLE_HAS_FN }, | 394 | .driver_data = APPLE_HAS_FN }, |
408 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), | 395 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), |
409 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 396 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
410 | APPLE_IGNORE_MOUSE }, | ||
411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), | 397 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), |
412 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 398 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
413 | APPLE_IGNORE_MOUSE }, | ||
414 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), | 399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), |
415 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 400 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
416 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 401 | APPLE_RDESC_JIS }, |
417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | 402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), |
418 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 403 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), | 404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), |
@@ -422,25 +407,21 @@ static const struct hid_device_id apple_devices[] = { | |||
422 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), | 407 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), |
423 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 408 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), | 409 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), |
425 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | 410 | .driver_data = APPLE_HAS_FN }, |
426 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), | 411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), |
427 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | 412 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
428 | APPLE_IGNORE_MOUSE }, | ||
429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), | 413 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), |
430 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 414 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
431 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), | 415 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), |
432 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | 416 | .driver_data = APPLE_HAS_FN }, |
433 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), | 417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), |
434 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | 418 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
435 | APPLE_IGNORE_MOUSE }, | ||
436 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), | 419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), |
437 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 420 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
438 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), | 421 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), |
439 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 422 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
440 | APPLE_IGNORE_MOUSE }, | ||
441 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), | 423 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), |
442 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 424 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
443 | APPLE_IGNORE_MOUSE }, | ||
444 | 425 | ||
445 | /* Apple wireless Mighty Mouse */ | 426 | /* Apple wireless Mighty Mouse */ |
446 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), | 427 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index ec5f470ff86a..339b90135d37 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1541,6 +1541,40 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1541 | { } | 1541 | { } |
1542 | }; | 1542 | }; |
1543 | 1543 | ||
1544 | /** | ||
1545 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer | ||
1546 | * | ||
1547 | * There are composite devices for which we want to ignore only a certain | ||
1548 | * interface. This is a list of devices for which only the mouse interface will | ||
1549 | * be ignored. This allows a dedicated driver to take care of the interface. | ||
1550 | */ | ||
1551 | static const struct hid_device_id hid_mouse_ignore_list[] = { | ||
1552 | /* appletouch driver */ | ||
1553 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | ||
1554 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | ||
1555 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | ||
1556 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, | ||
1557 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, | ||
1558 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, | ||
1559 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, | ||
1560 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, | ||
1561 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, | ||
1562 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, | ||
1563 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, | ||
1564 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | ||
1565 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | ||
1566 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | ||
1567 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, | ||
1568 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, | ||
1569 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, | ||
1570 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, | ||
1571 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, | ||
1572 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, | ||
1573 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | ||
1574 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | ||
1575 | { } | ||
1576 | }; | ||
1577 | |||
1544 | static bool hid_ignore(struct hid_device *hdev) | 1578 | static bool hid_ignore(struct hid_device *hdev) |
1545 | { | 1579 | { |
1546 | switch (hdev->vendor) { | 1580 | switch (hdev->vendor) { |
@@ -1557,6 +1591,10 @@ static bool hid_ignore(struct hid_device *hdev) | |||
1557 | break; | 1591 | break; |
1558 | } | 1592 | } |
1559 | 1593 | ||
1594 | if (hdev->type == HID_TYPE_USBMOUSE && | ||
1595 | hid_match_id(hdev, hid_mouse_ignore_list)) | ||
1596 | return true; | ||
1597 | |||
1560 | return !!hid_match_id(hdev, hid_ignore_list); | 1598 | return !!hid_match_id(hdev, hid_ignore_list); |
1561 | } | 1599 | } |
1562 | 1600 | ||