summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2010-03-25 13:50:26 +0000
committerAmaury Pouly <pamaury@rockbox.org>2010-03-25 13:50:26 +0000
commitad55f78a0795e3741cafd9f06f438922279befd2 (patch)
treee17fbc490a844d88530bc2b9b711c7663e4a0730 /firmware
parent1dd216ba066ffcb433e09dfd5c5df3edadb4b578 (diff)
downloadrockbox-ad55f78a0795e3741cafd9f06f438922279befd2.tar.gz
rockbox-ad55f78a0795e3741cafd9f06f438922279befd2.tar.bz2
rockbox-ad55f78a0795e3741cafd9f06f438922279befd2.zip
Commit a HID fix by gevaerts that prevent the HID driver to call usb_drv_send_nonblocking while the previous transfer has not finished because the current stack doesn't support transfer queueing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25329 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/usbstack/usb_hid.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_hid.c b/firmware/usbstack/usb_hid.c
index 4c76ff6db6..213f97180e 100644
--- a/firmware/usbstack/usb_hid.c
+++ b/firmware/usbstack/usb_hid.c
@@ -180,6 +180,7 @@ static int cur_buf_prepare;
static int cur_buf_send;
static bool active = false;
+static bool currently_sending = false;
static int ep_in;
static int usb_interface;
@@ -595,6 +596,7 @@ void usb_hid_init_connection(void)
logf("hid: init connection");
active = true;
+ currently_sending = false;
}
/* called by usb_core_init() */
@@ -611,12 +613,14 @@ void usb_hid_init(void)
cur_buf_send = 0;
active = true;
+ currently_sending = false;
}
void usb_hid_disconnect(void)
{
logf("hid: disconnect");
active = false;
+ currently_sending = false;
}
/* called by usb_core_transfer_complete() */
@@ -627,6 +631,7 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length)
(void)status;
(void)length;
+ logf("HID: transfer complete: %d %d %d %d",ep,dir,status,length);
switch (dir)
{
case USB_DIR_OUT:
@@ -638,6 +643,7 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length)
send_buffer_len[cur_buf_send] = 0;
HID_BUF_INC(cur_buf_send);
+ currently_sending = false;
usb_hid_try_send_drv();
break;
}
@@ -787,7 +793,15 @@ static void usb_hid_try_send_drv(void)
if (!length)
return;
+ if (currently_sending)
+ {
+ logf("HID: Already sending");
+ return;
+ }
+
+ logf("HID: Sending %d bytes",length);
rc = usb_drv_send_nonblocking(ep_in, send_buffer[cur_buf_send], length);
+ currently_sending = true;
if (rc)
{
send_buffer_len[cur_buf_send] = 0;