diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2008-03-02 23:34:30 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2008-03-02 23:34:30 +0000 |
commit | 0b4299a82fe4245dc939f168d4d14be321979c35 (patch) | |
tree | 180df9c9b06155e539eb00b5d0dcdcf1ba22aabd | |
parent | 8493f5bcf6bd9142f1730e8f3a8126294800826d (diff) | |
download | rockbox-0b4299a82fe4245dc939f168d4d14be321979c35.tar.gz rockbox-0b4299a82fe4245dc939f168d4d14be321979c35.zip |
extra input checking
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16493 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/usbstack/usb_serial.c | 11 |
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: |