aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/usbotg.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-08-29 23:23:58 -0400
committerKevin O'Connor <kevin@koconnor.net>2019-08-30 12:15:45 -0400
commit917fd51057da6f3afd2260990012b6566156c61e (patch)
tree73c0ba0732e74fb0b75c0eb74b851aa1759391bd /src/stm32/usbotg.c
parent5e3acff8c734ec4413ba12e021089dc6fea1f53e (diff)
downloadkutter-917fd51057da6f3afd2260990012b6566156c61e.tar.gz
kutter-917fd51057da6f3afd2260990012b6566156c61e.tar.xz
kutter-917fd51057da6f3afd2260990012b6566156c61e.zip
stm32: Discard usbotg tx data until usb is ready
If the usb interface is not ready, just discard messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/usbotg.c')
-rw-r--r--src/stm32/usbotg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stm32/usbotg.c b/src/stm32/usbotg.c
index 99837a09..e1c880fb 100644
--- a/src/stm32/usbotg.c
+++ b/src/stm32/usbotg.c
@@ -160,8 +160,8 @@ usb_send_bulk_in(void *data, uint_fast8_t len)
{
uint32_t ctl = EPIN(USB_CDC_EP_BULK_IN)->DIEPCTL;
if (!(ctl & USB_OTG_DIEPCTL_USBAEP))
- // Controller not enabled
- return -2;
+ // Controller not enabled - discard data
+ return len;
if (ctl & USB_OTG_DIEPCTL_EPENA) {
// Wait for space to transmit
OTGD->DIEPEMPMSK |= (1 << USB_CDC_EP_BULK_IN);