aboutsummaryrefslogtreecommitdiffstats
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
commite55a83611d77d5a01c871b6be78b76eccc8d140b (patch)
tree01f678e20cda673932e2438e42e3b3f8911956e7 /libmaple
parent8919d01f52e02901940502e956cd5a88994072b0 (diff)
downloadlibrambutan-e55a83611d77d5a01c871b6be78b76eccc8d140b.tar.gz
librambutan-e55a83611d77d5a01c871b6be78b76eccc8d140b.zip
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);
}