diff options
author | Ping Cheng <pinglinux@gmail.com> | 2012-04-30 06:09:17 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-04-30 06:13:46 +0200 |
commit | f393ee2b814e3291c12565000210b3cf10aa5c1d (patch) | |
tree | 1f068efe424750e21929ad324ef2ebe93f85a9d9 /drivers/input/tablet/wacom_sys.c | |
parent | Input: aiptek - adjust error-handling code label (diff) | |
download | linux-f393ee2b814e3291c12565000210b3cf10aa5c1d.tar.xz linux-f393ee2b814e3291c12565000210b3cf10aa5c1d.zip |
Input: wacom - retrieve maximum number of touch points
From the HID usage table when it is supported.
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-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.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 98e9dd692d68..be13223793fb 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -28,6 +28,7 @@ #define HID_USAGE_Y_TILT 0x3e #define HID_USAGE_FINGER 0x22 #define HID_USAGE_STYLUS 0x20 +#define HID_USAGE_CONTACTMAX 0x55 #define HID_COLLECTION 0xa1 #define HID_COLLECTION_LOGICAL 0x02 #define HID_COLLECTION_END 0xc0 @@ -201,6 +202,27 @@ static int wacom_parse_logical_collection(unsigned char *report, return length; } +static void wacom_retrieve_report_data(struct usb_interface *intf, + struct wacom_features *features) +{ + int result = 0; + unsigned char *rep_data; + + rep_data = kmalloc(2, GFP_KERNEL); + if (rep_data) { + + rep_data[0] = 12; + result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, + rep_data[0], &rep_data, 2, + WAC_MSG_RETRIES); + + if (result >= 0 && rep_data[1] > 2) + features->touch_max = rep_data[1]; + + kfree(rep_data); + } +} + /* * Interface Descriptor of wacom devices can be incomplete and * inconsistent so wacom_features table is used to store stylus @@ -377,6 +399,11 @@ static int wacom_parse_hid(struct usb_interface *intf, pen = 1; i++; break; + + case HID_USAGE_CONTACTMAX: + wacom_retrieve_report_data(intf, features); + i++; + break; } break; @@ -1085,7 +1112,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i endpoint = &intf->cur_altsetting->endpoint[0].desc; - /* Retrieve the physical and logical size for OEM devices */ + /* Retrieve the physical and logical size for touch devices */ error = wacom_retrieve_hid_descriptor(intf, features); if (error) goto fail3; |