aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Bagwell <chris@cnpbagwell.com>2011-10-27 01:32:52 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-10-27 01:36:06 -0400
commit4134361af6e099e5f477663fed1d49f0cf29eb4f (patch)
tree210cb39d920208495d3f310a08d68454fd1f8e57 /drivers
parentc5981411f60c31f0dff6f0f98d2d3711384badaf (diff)
Input: wacom - read 3rd gen Bamboo Touch HID data
Override invalid pen based pktlen and x/y_max with touch values from HID report. Since active area of pen and touch are same on these devices, set physical x/y size while pen x/y_max and resolution are still valid. Signed-off-by: Chris Bagwell <chris@cnpbagwell.com> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/tablet/wacom_sys.c49
-rw-r--r--drivers/input/tablet/wacom_wac.h1
2 files changed, 48 insertions, 2 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index f35ed7cb10a9..ab498e480f3b 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -28,7 +28,9 @@
28#define HID_USAGE_Y_TILT 0x3e 28#define HID_USAGE_Y_TILT 0x3e
29#define HID_USAGE_FINGER 0x22 29#define HID_USAGE_FINGER 0x22
30#define HID_USAGE_STYLUS 0x20 30#define HID_USAGE_STYLUS 0x20
31#define HID_COLLECTION 0xc0 31#define HID_COLLECTION 0xa1
32#define HID_COLLECTION_LOGICAL 0x02
33#define HID_COLLECTION_END 0xc0
32 34
33enum { 35enum {
34 WCM_UNDEFINED = 0, 36 WCM_UNDEFINED = 0,
@@ -165,6 +167,35 @@ static void wacom_close(struct input_dev *dev)
165 usb_autopm_put_interface(wacom->intf); 167 usb_autopm_put_interface(wacom->intf);
166} 168}
167 169
170static int wacom_parse_logical_collection(unsigned char *report,
171 struct wacom_features *features)
172{
173 int length = 0;
174
175 if (features->type == BAMBOO_PT) {
176
177 /* Logical collection is only used by 3rd gen Bamboo Touch */
178 features->pktlen = WACOM_PKGLEN_BBTOUCH3;
179 features->device_type = BTN_TOOL_DOUBLETAP;
180
181 /*
182 * Stylus and Touch have same active area
183 * so compute physical size based on stylus
184 * data before its overwritten.
185 */
186 features->x_phy =
187 (features->x_max * features->x_resolution) / 100;
188 features->y_phy =
189 (features->y_max * features->y_resolution) / 100;
190
191 features->x_max = features->y_max =
192 get_unaligned_le16(&report[10]);
193
194 length = 11;
195 }
196 return length;
197}
198
168/* 199/*
169 * Interface Descriptor of wacom devices can be incomplete and 200 * Interface Descriptor of wacom devices can be incomplete and
170 * inconsistent so wacom_features table is used to store stylus 201 * inconsistent so wacom_features table is used to store stylus
@@ -193,6 +224,10 @@ static void wacom_close(struct input_dev *dev)
193 * X/Y maximum as well as the physical size of tablet. Since touch 224 * X/Y maximum as well as the physical size of tablet. Since touch
194 * interfaces haven't supported pressure or distance, this is enough 225 * interfaces haven't supported pressure or distance, this is enough
195 * information to override invalid values in the wacom_features table. 226 * information to override invalid values in the wacom_features table.
227 *
228 * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical
229 * Collection. Instead they define a Logical Collection with a single
230 * Logical Maximum for both X and Y.
196 */ 231 */
197static int wacom_parse_hid(struct usb_interface *intf, 232static int wacom_parse_hid(struct usb_interface *intf,
198 struct hid_descriptor *hid_desc, 233 struct hid_descriptor *hid_desc,
@@ -355,10 +390,20 @@ static int wacom_parse_hid(struct usb_interface *intf,
355 } 390 }
356 break; 391 break;
357 392
358 case HID_COLLECTION: 393 case HID_COLLECTION_END:
359 /* reset UsagePage and Finger */ 394 /* reset UsagePage and Finger */
360 finger = usage = 0; 395 finger = usage = 0;
361 break; 396 break;
397
398 case HID_COLLECTION:
399 i++;
400 switch (report[i]) {
401 case HID_COLLECTION_LOGICAL:
402 i += wacom_parse_logical_collection(&report[i],
403 features);
404 break;
405 }
406 break;
362 } 407 }
363 } 408 }
364 409
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 53eb71b68330..af94e6d9d6a9 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -22,6 +22,7 @@
22#define WACOM_PKGLEN_TPC1FG 5 22#define WACOM_PKGLEN_TPC1FG 5
23#define WACOM_PKGLEN_TPC2FG 14 23#define WACOM_PKGLEN_TPC2FG 14
24#define WACOM_PKGLEN_BBTOUCH 20 24#define WACOM_PKGLEN_BBTOUCH 20
25#define WACOM_PKGLEN_BBTOUCH3 64
25 26
26/* device IDs */ 27/* device IDs */
27#define STYLUS_DEVICE_ID 0x02 28#define STYLUS_DEVICE_ID 0x02