aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r--drivers/input/tablet/wacom_sys.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 449c0a46dbac..d27c9d91630b 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
53static int usb_get_report(struct usb_interface *intf, unsigned char type, 54static 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)
@@ -319,24 +320,26 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
319 int limit = 0, report_id = 2; 320 int limit = 0, report_id = 2;
320 int error = -ENOMEM; 321 int error = -ENOMEM;
321 322
322 rep_data = kmalloc(2, GFP_KERNEL); 323 rep_data = kmalloc(4, GFP_KERNEL);
323 if (!rep_data) 324 if (!rep_data)
324 return error; 325 return error;
325 326
326 /* ask to report tablet data if it is 2FGT Tablet PC or 327 /* ask to report tablet data if it is MT Tablet PC or
327 * not a Tablet PC */ 328 * not a Tablet PC */
328 if (features->type == TABLETPC2FG) { 329 if (features->type == TABLETPC2FG) {
329 do { 330 do {
330 rep_data[0] = 3; 331 rep_data[0] = 3;
331 rep_data[1] = 4; 332 rep_data[1] = 4;
333 rep_data[2] = 0;
334 rep_data[3] = 0;
332 report_id = 3; 335 report_id = 3;
333 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, 336 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
334 report_id, rep_data, 2); 337 report_id, rep_data, 4);
335 if (error >= 0) 338 if (error >= 0)
336 error = usb_get_report(intf, 339 error = usb_get_report(intf,
337 WAC_HID_FEATURE_REPORT, report_id, 340 WAC_HID_FEATURE_REPORT, report_id,
338 rep_data, 3); 341 rep_data, 4);
339 } while ((error < 0 || rep_data[1] != 4) && limit++ < 5); 342 } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
340 } else if (features->type != TABLETPC) { 343 } else if (features->type != TABLETPC) {
341 do { 344 do {
342 rep_data[0] = 2; 345 rep_data[0] = 2;
@@ -347,7 +350,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
347 error = usb_get_report(intf, 350 error = usb_get_report(intf,
348 WAC_HID_FEATURE_REPORT, report_id, 351 WAC_HID_FEATURE_REPORT, report_id,
349 rep_data, 2); 352 rep_data, 2);
350 } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); 353 } while ((error < 0 || rep_data[1] != 2) && limit++ < WAC_MSG_RETRIES);
351 } 354 }
352 355
353 kfree(rep_data); 356 kfree(rep_data);