From 220eaa0272a96275a46f81bb347124e3a4daa6f8 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 4 Jun 2010 19:03:51 -0400 Subject: NEEDS REVIEW: fix for first usb write bug aj wrote this and had comments saying fix this wouldn't work, but it seems to... --- libmaple/usb/usb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libmaple') diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index b7d2d93..0474cad 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -379,6 +379,11 @@ void usbWaitReset(void) { will block at every 64 byte packet */ int16 usbSendBytes(uint8* sendBuf, uint16 len) { + + if (reset_state == NDTR_NRTS) { + return -1; /* indicates to caller to stop trying, were not connected */ + } + /* Block for any pending writes */ while (countTx) ; @@ -388,9 +393,6 @@ int16 usbSendBytes(uint8* sendBuf, uint16 len) { /* } */ /* }/\* wait for pipe to be clear *\/ */ - if (reset_state == NDTR_NRTS) { - return -1; /* indicates to caller to stop trying, were not connected */ - } /* ideally we should wait here, but it gets stuck for some reason. countTx wont decrement when -- cgit v1.2.3