[U-Boot] Anyone else having issues with "fastboot flash" - because of this change?

Steve Rae steve.rae at broadcom.com
Fri Mar 11 01:11:21 CET 2016


On Thu, Mar 10, 2016 at 3:46 PM, Steve Rae <srae at broadcom.com> wrote:
> ... updated the subject line, was:
> Re: [U-Boot][PATCH v3 1/3] fastboot: OUT transaction length must be aligned
> to wMaxPacketSize
>
>


>>> -static unsigned int rx_bytes_expected(void)
>>> +static unsigned int rx_bytes_expected(unsigned int maxpacket)
>>>   {
>>>         int rx_remain = download_size - download_bytes;
>>> +       int rem = 0;
>>>         if (rx_remain < 0)
>>>                 return 0;
>>>         if (rx_remain > EP_BUFFER_SIZE)
>>>                 return EP_BUFFER_SIZE;
>>> +       if (rx_remain < maxpacket) {
>>> +               rx_remain = maxpacket;
>>> +       } else if (rx_remain % maxpacket != 0) {
>>> +               rem = rx_remain % maxpacket;
>>> +               rx_remain = rx_remain + (maxpacket - rem);
>>> +       }
>
>
> Is anyone else having problems with this code???
> I need to remove these six (newly added) lines in order to get my boards to
> work -- otherwise, they just "hang" druing the download phase of "fastboot
> flash"....
>
> Thanks in advance, Steve
>


MORE INFO:

I added some logs to see what is happening:

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index f87aae7..824430f 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -427,12 +427,17 @@ static unsigned int rx_bytes_expected(unsigned
int maxpacket)
                return 0;
        if (rx_remain > EP_BUFFER_SIZE)
                return EP_BUFFER_SIZE;
+#if 1
        if (rx_remain < maxpacket) {
+               printf("\nVALIDATE: %s: %d (%d) %d\n", __func__,
rx_remain, maxpacket, maxpacket);
                rx_remain = maxpacket;
        } else if (rx_remain % maxpacket != 0) {
                rem = rx_remain % maxpacket;
+               printf("\nVALIDATE: %s: %d (%d) %d %d\n", __func__,
rx_remain, maxpacket, rem, rx_remain + (maxpacket - rem));
                rx_remain = rx_remain + (maxpacket - rem);
        }
+#endif
+       printf("\nVALIDATE: using %d\n", rx_remain);
        return rx_remain;
 }

RESULTS:

In the case that fails, (#if 1), it reports:
VALIDATE: rx_bytes_expected: 812 (512) 300 1024
VALIDATE: using 1024

In the case that works (#if 0), it reports:
VALIDATE: using 812

To me, it looks like there is only 812 bytes more to be downloaded,
but this code modifies that value to expect 1024 bytes;
and I guess it hangs after the 812 have been received (while waiting
for the rest of the 1024)....

Please advise!


More information about the U-Boot mailing list