aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_sys.c
diff options
context:
space:
mode:
authorChris Bagwell <chris@cnpbagwell.com>2012-03-26 02:26:11 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-03-26 02:31:32 -0400
commitd3825d51c3eddb8a3c7d1281f27181aff6db19b8 (patch)
treeb493c50841f11e097ddcf45f462b6da764ba1c64 /drivers/input/tablet/wacom_sys.c
parent3aac0ef10bf5c76ba4262cfd9b044a6c067d5aae (diff)
Input: wacom - wireless monitor framework
The 3rd gen Bamboo Pen & Touch and Intuos5 tablets support an optional wireless module. When its receiver is plugged into USB, it presents 3 interfaces: 0) Monitor 1) Pen and 2) Touch. The exact capabilities of the Pen and Touch interfaces can not be determined until a tablet connection is established and reported over the Monitor interface. This patch detects this wireless receiver and enables interrupt packets to be processed for the Monitor interface. Processing the data in packets will be left to another patch. Since it doesn't make sense to create an input device for the Monitor interface, it is not created. Creation of Pen and Touch input device is also delayed until monitor packets can be processed. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Tested-by: Jason Gerecke <killertofu@gmail.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r--drivers/input/tablet/wacom_sys.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index f6da2f8a9c18..d8cc9ce165ff 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -422,6 +422,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
422 report_id, rep_data, 4, 1); 422 report_id, rep_data, 4, 1);
423 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); 423 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
424 } else if (features->type != TABLETPC && 424 } else if (features->type != TABLETPC &&
425 features->type != WIRELESS &&
425 features->device_type == BTN_TOOL_PEN) { 426 features->device_type == BTN_TOOL_PEN) {
426 do { 427 do {
427 rep_data[0] = 2; 428 rep_data[0] = 2;
@@ -454,6 +455,21 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
454 features->pressure_fuzz = 0; 455 features->pressure_fuzz = 0;
455 features->distance_fuzz = 0; 456 features->distance_fuzz = 0;
456 457
458 /*
459 * The wireless device HID is basic and layout conflicts with
460 * other tablets (monitor and touch interface can look like pen).
461 * Skip the query for this type and modify defaults based on
462 * interface number.
463 */
464 if (features->type == WIRELESS) {
465 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
466 features->device_type = 0;
467 } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
468 features->device_type = BTN_TOOL_DOUBLETAP;
469 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
470 }
471 }
472
457 /* only Tablet PCs and Bamboo P&T need to retrieve the info */ 473 /* only Tablet PCs and Bamboo P&T need to retrieve the info */
458 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && 474 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
459 (features->type != BAMBOO_PT)) 475 (features->type != BAMBOO_PT))
@@ -928,14 +944,22 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
928 if (error) 944 if (error)
929 goto fail4; 945 goto fail4;
930 946
931 error = wacom_register_input(wacom); 947 if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
932 if (error) 948 error = wacom_register_input(wacom);
933 goto fail5; 949 if (error)
950 goto fail5;
951 }
934 952
935 /* Note that if query fails it is not a hard failure */ 953 /* Note that if query fails it is not a hard failure */
936 wacom_query_tablet_data(intf, features); 954 wacom_query_tablet_data(intf, features);
937 955
938 usb_set_intfdata(intf, wacom); 956 usb_set_intfdata(intf, wacom);
957
958 if (features->quirks & WACOM_QUIRK_MONITOR) {
959 if (usb_submit_urb(wacom->irq, GFP_KERNEL))
960 goto fail5;
961 }
962
939 return 0; 963 return 0;
940 964
941 fail5: wacom_destroy_leds(wacom); 965 fail5: wacom_destroy_leds(wacom);
@@ -953,7 +977,8 @@ static void wacom_disconnect(struct usb_interface *intf)
953 usb_set_intfdata(intf, NULL); 977 usb_set_intfdata(intf, NULL);
954 978
955 usb_kill_urb(wacom->irq); 979 usb_kill_urb(wacom->irq);
956 input_unregister_device(wacom->wacom_wac.input); 980 if (wacom->wacom_wac.input)
981 input_unregister_device(wacom->wacom_wac.input);
957 wacom_destroy_leds(wacom); 982 wacom_destroy_leds(wacom);
958 usb_free_urb(wacom->irq); 983 usb_free_urb(wacom->irq);
959 usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, 984 usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX,
@@ -985,7 +1010,8 @@ static int wacom_resume(struct usb_interface *intf)
985 wacom_query_tablet_data(intf, features); 1010 wacom_query_tablet_data(intf, features);
986 wacom_led_control(wacom); 1011 wacom_led_control(wacom);
987 1012
988 if (wacom->open && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) 1013 if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR)
1014 && usb_submit_urb(wacom->irq, GFP_NOIO) < 0)
989 rv = -EIO; 1015 rv = -EIO;
990 1016
991 mutex_unlock(&wacom->lock); 1017 mutex_unlock(&wacom->lock);