summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack/usb_serial.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-03-02 23:34:30 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-03-02 23:34:30 +0000
commit0b4299a82fe4245dc939f168d4d14be321979c35 (patch)
tree180df9c9b06155e539eb00b5d0dcdcf1ba22aabd /firmware/usbstack/usb_serial.c
parent8493f5bcf6bd9142f1730e8f3a8126294800826d (diff)
downloadrockbox-0b4299a82fe4245dc939f168d4d14be321979c35.tar.gz
rockbox-0b4299a82fe4245dc939f168d4d14be321979c35.tar.bz2
rockbox-0b4299a82fe4245dc939f168d4d14be321979c35.zip
extra input checking
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16493 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_serial.c')
-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)
{
if(!active)
return;
+ if(length<=0)
+ return;
mutex_lock(&sendlock);
if(buffer_start+buffer_length > BUFFER_SIZE)
{
@@ -132,7 +134,7 @@ void usb_serial_transfer_complete(bool in, int status, int length)
}
busy_sending = false;
- if(buffer_length!=0)
+ if(buffer_length>0)
{
sendout();
}
@@ -153,8 +155,13 @@ bool usb_serial_control_request(struct usb_ctrlrequest* req)
handled = true;
/* we come here too after a bus reset, so reset some data */
+ mutex_lock(&sendlock);
busy_sending = false;
- sendout();
+ if(buffer_length>0)
+ {
+ sendout();
+ }
+ mutex_unlock(&sendlock);
break;
default: