summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/usbstack/usb_serial.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/usbstack/usb_serial.c b/firmware/usbstack/usb_serial.c
index c57c74e8ab..8c86932a31 100644
--- a/firmware/usbstack/usb_serial.c
+++ b/firmware/usbstack/usb_serial.c
@@ -77,6 +77,8 @@ void usb_serial_send(unsigned char *data,int length)
77{ 77{
78 if(!active) 78 if(!active)
79 return; 79 return;
80 if(length<=0)
81 return;
80 mutex_lock(&sendlock); 82 mutex_lock(&sendlock);
81 if(buffer_start+buffer_length > BUFFER_SIZE) 83 if(buffer_start+buffer_length > BUFFER_SIZE)
82 { 84 {
@@ -132,7 +134,7 @@ void usb_serial_transfer_complete(bool in, int status, int length)
132 } 134 }
133 busy_sending = false; 135 busy_sending = false;
134 136
135 if(buffer_length!=0) 137 if(buffer_length>0)
136 { 138 {
137 sendout(); 139 sendout();
138 } 140 }
@@ -153,8 +155,13 @@ bool usb_serial_control_request(struct usb_ctrlrequest* req)
153 handled = true; 155 handled = true;
154 156
155 /* we come here too after a bus reset, so reset some data */ 157 /* we come here too after a bus reset, so reset some data */
158 mutex_lock(&sendlock);
156 busy_sending = false; 159 busy_sending = false;
157 sendout(); 160 if(buffer_length>0)
161 {
162 sendout();
163 }
164 mutex_unlock(&sendlock);
158 break; 165 break;
159 166
160 default: 167 default: