1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Amaury Pouly 2010-03-25 13:50:26 +00:00
parent 1dd216ba06
commit ad55f78a07

View file

@ -180,6 +180,7 @@ static int cur_buf_prepare;
static int cur_buf_send; static int cur_buf_send;
static bool active = false; static bool active = false;
static bool currently_sending = false;
static int ep_in; static int ep_in;
static int usb_interface; static int usb_interface;
@ -595,6 +596,7 @@ void usb_hid_init_connection(void)
logf("hid: init connection"); logf("hid: init connection");
active = true; active = true;
currently_sending = false;
} }
/* called by usb_core_init() */ /* called by usb_core_init() */
@ -611,12 +613,14 @@ void usb_hid_init(void)
cur_buf_send = 0; cur_buf_send = 0;
active = true; active = true;
currently_sending = false;
} }
void usb_hid_disconnect(void) void usb_hid_disconnect(void)
{ {
logf("hid: disconnect"); logf("hid: disconnect");
active = false; active = false;
currently_sending = false;
} }
/* called by usb_core_transfer_complete() */ /* 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)status;
(void)length; (void)length;
logf("HID: transfer complete: %d %d %d %d",ep,dir,status,length);
switch (dir) switch (dir)
{ {
case USB_DIR_OUT: 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; send_buffer_len[cur_buf_send] = 0;
HID_BUF_INC(cur_buf_send); HID_BUF_INC(cur_buf_send);
currently_sending = false;
usb_hid_try_send_drv(); usb_hid_try_send_drv();
break; break;
} }
@ -787,7 +793,15 @@ static void usb_hid_try_send_drv(void)
if (!length) if (!length)
return; 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); rc = usb_drv_send_nonblocking(ep_in, send_buffer[cur_buf_send], length);
currently_sending = true;
if (rc) if (rc)
{ {
send_buffer_len[cur_buf_send] = 0; send_buffer_len[cur_buf_send] = 0;