Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157036
b: refs/heads/master
c: 3b7307c
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov committed Aug 21, 2009
1 parent c32af58 commit 1ef1c2f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68947b8f9a36f7f7f54ca95e0c6e169bb603e803
refs/heads/master: 3b7307c2d66dd575ef24b88898b4bc4bddb254f4
43 changes: 29 additions & 14 deletions trunk/drivers/input/tablet/wacom_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,32 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
return result;
}

static int wacom_query_tablet_data(struct usb_interface *intf)
{
unsigned char *rep_data;
int limit = 0;
int error;

rep_data = kmalloc(2, GFP_KERNEL);
if (!rep_data)
return -ENOMEM;

do {
rep_data[0] = 2;
rep_data[1] = 2;
error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
2, rep_data, 2);
if (error >= 0)
error = usb_get_report(intf,
WAC_HID_FEATURE_REPORT, 2,
rep_data, 2);
} while ((error < 0 || rep_data[1] != 2) && limit++ < 5);

kfree(rep_data);

return error < 0 ? error : 0;
}

static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev(intf);
Expand All @@ -398,7 +424,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
struct wacom_features *features;
struct input_dev *input_dev;
int error = -ENOMEM;
char rep_data[2], limit = 0;
struct hid_descriptor *hid_desc;

wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
Expand Down Expand Up @@ -489,20 +514,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i

/*
* Ask the tablet to report tablet data if it is not a Tablet PC.
* Repeat until it succeeds
* Note that if query fails it is not a hard failure.
*/
if (wacom_wac->features->type != TABLETPC) {
do {
rep_data[0] = 2;
rep_data[1] = 2;
error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
2, rep_data, 2);
if (error >= 0)
error = usb_get_report(intf,
WAC_HID_FEATURE_REPORT, 2,
rep_data, 2);
} while ((error < 0 || rep_data[1] != 2) && limit++ < 5);
}
if (wacom_wac->features->type != TABLETPC)
wacom_query_tablet_data(intf);

usb_set_intfdata(intf, wacom);
return 0;
Expand Down

0 comments on commit 1ef1c2f

Please sign in to comment.