aboutsummaryrefslogtreecommitdiff
path: root/libmaple
diff options
context:
space:
mode:
authorManuel Odendahl <wesen@ruinwesen.com>2012-11-08 20:51:00 +0100
committerManuel Odendahl <wesen@ruinwesen.com>2012-11-08 20:53:32 +0100
commit8e14e7ff7752d90e8d15fef417a3dc49bb0af886 (patch)
tree01f678e20cda673932e2438e42e3b3f8911956e7 /libmaple
parent50448497f867d618351aaa9a19521a26a54bba02 (diff)
usb_cdcacm.c: reenable the endpoint if an empty bulk transfer was received.
It is possible to receive empty bulk transfers. This would lead to the endpoint never being reenabled as this was handled by the read routine. This caused the USB to hang. Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/usb/stm32f1/usb_cdcacm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libmaple/usb/stm32f1/usb_cdcacm.c b/libmaple/usb/stm32f1/usb_cdcacm.c
index fc70e39..addab3c 100644
--- a/libmaple/usb/stm32f1/usb_cdcacm.c
+++ b/libmaple/usb/stm32f1/usb_cdcacm.c
@@ -535,6 +535,13 @@ static void vcomDataRxCb(void) {
usb_copy_from_pma((uint8*)vcomBufferRx, n_unread_bytes,
USB_CDCACM_RX_ADDR);
+
+ if (n_unread_bytes == 0) {
+ usb_set_ep_rx_count(USB_CDCACM_RX_ENDP, USB_CDCACM_RX_EPSIZE);
+ usb_set_ep_rx_stat(USB_CDCACM_RX_ENDP, USB_EP_STAT_RX_VALID);
+ rx_offset = 0;
+ }
+
if (rx_hook) {
rx_hook(USB_CDCACM_HOOK_RX, 0);
}