Commit 854561b0 authored by Vojtech Pavlik's avatar Vojtech Pavlik Committed by Dmitry Torokhov

Input: Make hid-core issue a SET_IDLE request before GET_REPORT, like

       Windows does. This should make life easier for devices that were
       tested with Windows only.
Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 86084712
...@@ -1233,6 +1233,13 @@ int hid_wait_io(struct hid_device *hid) ...@@ -1233,6 +1233,13 @@ int hid_wait_io(struct hid_device *hid)
return 0; return 0;
} }
static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle)
{
usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, (idle << 8) | report,
ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT);
}
static int hid_get_class_descriptor(struct usb_device *dev, int ifnum, static int hid_get_class_descriptor(struct usb_device *dev, int ifnum,
unsigned char type, void *buf, int size) unsigned char type, void *buf, int size)
{ {
...@@ -1301,10 +1308,6 @@ void hid_init_reports(struct hid_device *hid) ...@@ -1301,10 +1308,6 @@ void hid_init_reports(struct hid_device *hid)
if (err) if (err)
warn("timeout initializing reports\n"); warn("timeout initializing reports\n");
usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
hid->ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT);
} }
#define USB_VENDOR_ID_WACOM 0x056a #define USB_VENDOR_ID_WACOM 0x056a
...@@ -1572,6 +1575,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) ...@@ -1572,6 +1575,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
return NULL; return NULL;
} }
hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);
if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) {
dbg("reading report descriptor failed"); dbg("reading report descriptor failed");
kfree(rdesc); kfree(rdesc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment