summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/drivers/usb/usbdevice/core/core.c14
-rw-r--r--components/drivers/usb/usbhost/core/hub.c2
2 files changed, 15 insertions, 1 deletions
diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c
index 4a4f370f16..1900673976 100644
--- a/components/drivers/usb/usbdevice/core/core.c
+++ b/components/drivers/usb/usbdevice/core/core.c
@@ -36,6 +36,7 @@ static rt_list_t device_list;
static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_size_t size);
static rt_size_t rt_usbd_ep_read_prepare(udevice_t device, uep_t ep, void *buffer, rt_size_t size);
static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep);
+rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep);
/**
* This function will handle get_device_descriptor bRequest.
@@ -1864,6 +1865,19 @@ static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep)
return -RT_ERROR;
}
+rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep)
+{
+ RT_ASSERT(device != RT_NULL);
+ RT_ASSERT(device->dcd != RT_NULL);
+ RT_ASSERT(device->dcd->ep_pool != RT_NULL);
+ RT_ASSERT(ep != RT_NULL);
+ RT_ASSERT(ep->ep_desc != RT_NULL);
+
+ ep->id->status = ID_UNASSIGNED;
+
+ return RT_EOK;
+}
+
rt_err_t rt_usbd_ep0_setup_handler(udcd_t dcd, struct urequest* setup)
{
struct udev_msg msg;
diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c
index 1f1c986350..29b465d1b7 100644
--- a/components/drivers/usb/usbhost/core/hub.c
+++ b/components/drivers/usb/usbhost/core/hub.c
@@ -413,7 +413,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i + 1, pstatus));
/* check port status change */
- if ((pstatus & PORT_CCSC))
+ if (pstatus & PORT_CCSC)
{
/* clear port status change feature */
rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_CONNECTION);