From ea763cad8d5ee095361da75bed945af5ab858449 Mon Sep 17 00:00:00 2001 From: Hyx Date: Fri, 1 Aug 2025 12:47:43 +0800 Subject: [PATCH] usb-device: Raise RuntimeError when DCD error occurs. So the behavior matches the comment. Signed-off-by: Hyx --- micropython/usb/usb-device/manifest.py | 2 +- micropython/usb/usb-device/usb/device/core.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/micropython/usb/usb-device/manifest.py b/micropython/usb/usb-device/manifest.py index 025e6754..fa0d8a3f 100644 --- a/micropython/usb/usb-device/manifest.py +++ b/micropython/usb/usb-device/manifest.py @@ -1,2 +1,2 @@ -metadata(version="0.2.0") +metadata(version="0.2.1") package("usb") diff --git a/micropython/usb/usb-device/usb/device/core.py b/micropython/usb/usb-device/usb/device/core.py index 7be09ee4..b0d91d8f 100644 --- a/micropython/usb/usb-device/usb/device/core.py +++ b/micropython/usb/usb-device/usb/device/core.py @@ -600,7 +600,8 @@ class Interface: # function has returned to the caller. if not self._open: raise RuntimeError("Not open") - _dev._submit_xfer(ep_addr, data, done_cb) + if not _dev._submit_xfer(ep_addr, data, done_cb): + raise RuntimeError("DCD error") def stall(self, ep_addr, *args): # Set or get the endpoint STALL state.