summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorDengguiling <[email protected]>2022-07-07 16:10:43 +0800
committerGitHub <[email protected]>2022-07-07 16:10:43 +0800
commitaa2d2c63f6d70a1bcd4503d3770e0552892f7ba7 (patch)
treef1866ab75dec3c86c650938f5dedeccec06b3fbe /components
parenta305edd4db9b1c7d1706fb717bcd9923775afed4 (diff)
[compoenets][driver][usb] fix usbhost hid issues. (#6116)
* [compoenets][driver][usb] fix usbhost hid issues. 1.Set idle function should receive an empty package. 2.Fix uinst_t reference error in hid enable function.
Diffstat (limited to 'components')
-rw-r--r--components/drivers/usb/usbhost/class/hid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/components/drivers/usb/usbhost/class/hid.c b/components/drivers/usb/usbhost/class/hid.c
index eaf413a2a6..665f8e3790 100644
--- a/components/drivers/usb/usbhost/class/hid.c
+++ b/components/drivers/usb/usbhost/class/hid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2021, RT-Thread Development Team
+ * Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -47,9 +47,10 @@ rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id)
setup.wValue = (duration << 8 )| report_id;
if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8)
- return RT_EOK;
- else
- return -RT_FALSE;
+ if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, RT_NULL, 0, timeout) == 0)
+ return RT_EOK;
+
+ return -RT_FALSE;
}
/**
@@ -341,7 +342,7 @@ static rt_err_t rt_usbh_hid_enable(void* arg)
if(!(ep_desc->bEndpointAddress & USB_DIR_IN)) continue;
ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &hid->pipe_in,
- intf, ep_desc);
+ intf->device, ep_desc);
if(ret != RT_EOK) return ret;
}