Sfoglia il codice sorgente

fix(port/dwc2/usb_hc_dwc2): exit porten loop check when device disconnets

Signed-off-by: sakumisu <1203593632@qq.com>
sakumisu 5 mesi fa
parent
commit
dc7e53d79f
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      port/dwc2/usb_hc_dwc2.c

+ 3 - 0
port/dwc2/usb_hc_dwc2.c

@@ -381,6 +381,9 @@ static int usbh_reset_port(struct usbh_bus *bus, const uint8_t port)
     usb_osal_msleep(10U);
 
     while (!(USB_OTG_HPRT & USB_OTG_HPRT_PENA)) {
+        if (!(USB_OTG_HPRT & USB_OTG_HPRT_PCSTS)) {
+            return -USB_ERR_NOTCONN; /* Port not connected */
+        }
         usb_osal_msleep(10U);
     }
     return 0;