diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2010-03-25 13:50:26 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2010-03-25 13:50:26 +0000 |
commit | ad55f78a0795e3741cafd9f06f438922279befd2 (patch) | |
tree | e17fbc490a844d88530bc2b9b711c7663e4a0730 /firmware/usbstack/usb_hid.c | |
parent | 1dd216ba066ffcb433e09dfd5c5df3edadb4b578 (diff) | |
download | rockbox-ad55f78a0795e3741cafd9f06f438922279befd2.tar.gz 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/usbstack/usb_hid.c')
-rw-r--r-- | firmware/usbstack/usb_hid.c | 14 |
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; | |||
180 | static int cur_buf_send; | 180 | static int cur_buf_send; |
181 | 181 | ||
182 | static bool active = false; | 182 | static bool active = false; |
183 | static bool currently_sending = false; | ||
183 | static int ep_in; | 184 | static int ep_in; |
184 | static int usb_interface; | 185 | static int usb_interface; |
185 | 186 | ||
@@ -595,6 +596,7 @@ void usb_hid_init_connection(void) | |||
595 | logf("hid: init connection"); | 596 | logf("hid: init connection"); |
596 | 597 | ||
597 | active = true; | 598 | active = true; |
599 | currently_sending = false; | ||
598 | } | 600 | } |
599 | 601 | ||
600 | /* called by usb_core_init() */ | 602 | /* called by usb_core_init() */ |
@@ -611,12 +613,14 @@ void usb_hid_init(void) | |||
611 | cur_buf_send = 0; | 613 | cur_buf_send = 0; |
612 | 614 | ||
613 | active = true; | 615 | active = true; |
616 | currently_sending = false; | ||
614 | } | 617 | } |
615 | 618 | ||
616 | void usb_hid_disconnect(void) | 619 | void usb_hid_disconnect(void) |
617 | { | 620 | { |
618 | logf("hid: disconnect"); | 621 | logf("hid: disconnect"); |
619 | active = false; | 622 | active = false; |
623 | currently_sending = false; | ||
620 | } | 624 | } |
621 | 625 | ||
622 | /* called by usb_core_transfer_complete() */ | 626 | /* called by usb_core_transfer_complete() */ |
@@ -627,6 +631,7 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length) | |||
627 | (void)status; | 631 | (void)status; |
628 | (void)length; | 632 | (void)length; |
629 | 633 | ||
634 | logf("HID: transfer complete: %d %d %d %d",ep,dir,status,length); | ||
630 | switch (dir) | 635 | switch (dir) |
631 | { | 636 | { |
632 | case USB_DIR_OUT: | 637 | case USB_DIR_OUT: |
@@ -638,6 +643,7 @@ void usb_hid_transfer_complete(int ep, int dir, int status, int length) | |||
638 | 643 | ||
639 | send_buffer_len[cur_buf_send] = 0; | 644 | send_buffer_len[cur_buf_send] = 0; |
640 | HID_BUF_INC(cur_buf_send); | 645 | HID_BUF_INC(cur_buf_send); |
646 | currently_sending = false; | ||
641 | usb_hid_try_send_drv(); | 647 | usb_hid_try_send_drv(); |
642 | break; | 648 | break; |
643 | } | 649 | } |
@@ -787,7 +793,15 @@ static void usb_hid_try_send_drv(void) | |||
787 | if (!length) | 793 | if (!length) |
788 | return; | 794 | return; |
789 | 795 | ||
796 | if (currently_sending) | ||
797 | { | ||
798 | logf("HID: Already sending"); | ||
799 | return; | ||
800 | } | ||
801 | |||
802 | logf("HID: Sending %d bytes",length); | ||
790 | rc = usb_drv_send_nonblocking(ep_in, send_buffer[cur_buf_send], length); | 803 | rc = usb_drv_send_nonblocking(ep_in, send_buffer[cur_buf_send], length); |
804 | currently_sending = true; | ||
791 | if (rc) | 805 | if (rc) |
792 | { | 806 | { |
793 | send_buffer_len[cur_buf_send] = 0; | 807 | send_buffer_len[cur_buf_send] = 0; |