From d5b0c945520d68d24b5af7598e9b4ead9b3d288e Mon Sep 17 00:00:00 2001 From: weety Date: Sun, 6 Apr 2014 21:02:23 +0800 Subject: [PATCH] [USB]fix rt_usbd_set_config() BUG which set the USB device to configuration state before enumerating the device. --- components/drivers/usb/usbdevice/core/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c index 14deb316aa..dadd81352b 100644 --- a/components/drivers/usb/usbdevice/core/core.c +++ b/components/drivers/usb/usbdevice/core/core.c @@ -372,6 +372,7 @@ static rt_err_t _set_config(struct udevice* device, ureq_t setup) /* set current configuration */ rt_usbd_set_config(device, setup->value); + dcd_set_config(device->dcd, setup->value); cfg = device->curr_cfg; for (i=cfg->func_list.next; i!=&cfg->func_list; i=i->next) @@ -1598,8 +1599,6 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value) /* set as current configuration */ device->curr_cfg = cfg; - - dcd_set_config(device->dcd, value); return RT_TRUE; }