diff options
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 449c0a46dbac..958b4eb6369d 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -49,6 +49,7 @@ struct hid_descriptor { | |||
49 | #define USB_REQ_GET_REPORT 0x01 | 49 | #define USB_REQ_GET_REPORT 0x01 |
50 | #define USB_REQ_SET_REPORT 0x09 | 50 | #define USB_REQ_SET_REPORT 0x09 |
51 | #define WAC_HID_FEATURE_REPORT 0x03 | 51 | #define WAC_HID_FEATURE_REPORT 0x03 |
52 | #define WAC_MSG_RETRIES 5 | ||
52 | 53 | ||
53 | static int usb_get_report(struct usb_interface *intf, unsigned char type, | 54 | static int usb_get_report(struct usb_interface *intf, unsigned char type, |
54 | unsigned char id, void *buf, int size) | 55 | unsigned char id, void *buf, int size) |
@@ -165,7 +166,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
165 | report, | 166 | report, |
166 | hid_desc->wDescriptorLength, | 167 | hid_desc->wDescriptorLength, |
167 | 5000); /* 5 secs */ | 168 | 5000); /* 5 secs */ |
168 | } while (result < 0 && limit++ < 5); | 169 | } while (result < 0 && limit++ < WAC_MSG_RETRIES); |
169 | 170 | ||
170 | /* No need to parse the Descriptor. It isn't an error though */ | 171 | /* No need to parse the Descriptor. It isn't an error though */ |
171 | if (result < 0) | 172 | if (result < 0) |
@@ -228,13 +229,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
228 | get_unaligned_le16(&report[i + 3]); | 229 | get_unaligned_le16(&report[i + 3]); |
229 | i += 4; | 230 | i += 4; |
230 | } | 231 | } |
231 | } else if (usage == WCM_DIGITIZER) { | ||
232 | /* max pressure isn't reported | ||
233 | features->pressure_max = (unsigned short) | ||
234 | (report[i+4] << 8 | report[i + 3]); | ||
235 | */ | ||
236 | features->pressure_max = 255; | ||
237 | i += 4; | ||
238 | } | 232 | } |
239 | break; | 233 | break; |
240 | 234 | ||
@@ -290,13 +284,6 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
290 | pen = 1; | 284 | pen = 1; |
291 | i++; | 285 | i++; |
292 | break; | 286 | break; |
293 | |||
294 | case HID_USAGE_UNDEFINED: | ||
295 | if (usage == WCM_DESKTOP && finger) /* capacity */ | ||
296 | features->pressure_max = | ||
297 | get_unaligned_le16(&report[i + 3]); | ||
298 | i += 4; | ||
299 | break; | ||
300 | } | 287 | } |
301 | break; | 288 | break; |
302 | 289 | ||
@@ -319,24 +306,26 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
319 | int limit = 0, report_id = 2; | 306 | int limit = 0, report_id = 2; |
320 | int error = -ENOMEM; | 307 | int error = -ENOMEM; |
321 | 308 | ||
322 | rep_data = kmalloc(2, GFP_KERNEL); | 309 | rep_data = kmalloc(4, GFP_KERNEL); |
323 | if (!rep_data) | 310 | if (!rep_data) |
324 | return error; | 311 | return error; |
325 | 312 | ||
326 | /* ask to report tablet data if it is 2FGT Tablet PC or | 313 | /* ask to report tablet data if it is MT Tablet PC or |
327 | * not a Tablet PC */ | 314 | * not a Tablet PC */ |
328 | if (features->type == TABLETPC2FG) { | 315 | if (features->type == TABLETPC2FG) { |
329 | do { | 316 | do { |
330 | rep_data[0] = 3; | 317 | rep_data[0] = 3; |
331 | rep_data[1] = 4; | 318 | rep_data[1] = 4; |
319 | rep_data[2] = 0; | ||
320 | rep_data[3] = 0; | ||
332 | report_id = 3; | 321 | report_id = 3; |
333 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | 322 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, |
334 | report_id, rep_data, 2); | 323 | report_id, rep_data, 4); |
335 | if (error >= 0) | 324 | if (error >= 0) |
336 | error = usb_get_report(intf, | 325 | error = usb_get_report(intf, |
337 | WAC_HID_FEATURE_REPORT, report_id, | 326 | WAC_HID_FEATURE_REPORT, report_id, |
338 | rep_data, 3); | 327 | rep_data, 4); |
339 | } while ((error < 0 || rep_data[1] != 4) && limit++ < 5); | 328 | } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); |
340 | } else if (features->type != TABLETPC) { | 329 | } else if (features->type != TABLETPC) { |
341 | do { | 330 | do { |
342 | rep_data[0] = 2; | 331 | rep_data[0] = 2; |
@@ -347,7 +336,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
347 | error = usb_get_report(intf, | 336 | error = usb_get_report(intf, |
348 | WAC_HID_FEATURE_REPORT, report_id, | 337 | WAC_HID_FEATURE_REPORT, report_id, |
349 | rep_data, 2); | 338 | rep_data, 2); |
350 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | 339 | } while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES); |
351 | } | 340 | } |
352 | 341 | ||
353 | kfree(rep_data); | 342 | kfree(rep_data); |