diff options
author | bnewbold <bnewbold@robocracy.org> | 2010-06-07 14:29:00 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2010-06-07 14:46:25 -0400 |
commit | 1a9b0c0790b18673fa8d94c5d3d1fd1c416ec717 (patch) | |
tree | 5deb933405eecab97185baf23adacc4a9618504a /libmaple | |
parent | 717060ef8c018c95b5764163180e0fa61c0fb010 (diff) | |
download | librambutan-1a9b0c0790b18673fa8d94c5d3d1fd1c416ec717.tar.gz librambutan-1a9b0c0790b18673fa8d94c5d3d1fd1c416ec717.zip |
another fix for USB unheard print issue
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/usb/usb.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index 0474cad..0549f3c 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -380,28 +380,19 @@ void usbWaitReset(void) { */ int16 usbSendBytes(uint8* sendBuf, uint16 len) { - if (reset_state == NDTR_NRTS) { + if (reset_state != START || bDeviceState != CONFIGURED) { return -1; /* indicates to caller to stop trying, were not connected */ } - /* Block for any pending writes */ - while (countTx) - ; -/* while (countTx != 0) { */ -/* if (reset_state == NDTR_NRTS) { */ -/* return 0; */ -/* } */ -/* }/\* wait for pipe to be clear *\/ */ - - - /* ideally we should wait here, but it gets stuck - for some reason. countTx wont decrement when - theres no host side port reading the data, this is - known, but even if we add the check for NDTR_NRTS it - still gets stuck...*/ - if (countTx != 0) { - return 0; /* indicated to caller to keep trying, were just busy */ + /* This may be the correct behavior but it's undocumented + if (countTx >= VCOM_TX_EPSIZE) { + return 0; // indicates to caller that the buffer is full } + */ + + /* Block for any pending writes */ + while (countTx) + ; uint16 sent = len; |