diff options
| author | sakumisu <[email protected]> | 2025-07-24 21:03:22 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-07-24 21:03:22 +0800 |
| commit | dc7e53d79f75b38cbfbd3a0e58448eff04d260e2 (patch) | |
| tree | 6a7b6aa85dc0a67271ffcfd23fcf1ff783f9cb0b | |
| parent | d3a5aae7afa967ccc1d5e8ed6e84fb12ade946b6 (diff) | |
fix(port/dwc2/usb_hc_dwc2): exit porten loop check when device disconnets
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | port/dwc2/usb_hc_dwc2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index abe8ac8f..b28ad954 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/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; |
