USB 1.1, 5.5.3, page 37: "The Data stage [...] is complete when the endpoint
[...] Has transferred exactly the amount of data specified [.]"
---
 softusb-input/main.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/softusb-input/main.c b/softusb-input/main.c
index a0fc231..05fd759 100644
--- a/softusb-input/main.c
+++ b/softusb-input/main.c
@@ -362,8 +362,8 @@ static int control_transfer(unsigned char addr, struct 
setup_packet *p,
                        if(chunklen < ep0_size)
                                break;
                }
-       } else if(maxlen != 0) {
-               while(1) {
+       } else
+               while(transferred != maxlen) {
                        rxlen = usb_in(addr, expected_data, usb_buffer,
                            ep0_size+3);
                        if(!rxlen)
@@ -382,7 +382,6 @@ static int control_transfer(unsigned char addr, struct 
setup_packet *p,
                        if(chunklen < ep0_size)
                                break;
                }
-       }
 
        /* send IN/OUT token in the opposite direction to end transfer */
 retry:
-- 
1.7.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to