[U-Boot] question about "drivers/usb/gadget/f_fastboot.c"
Steve Rae
srae at broadcom.com
Wed Jan 27 20:49:13 CET 2016
Please explain the following logic in "drivers/usb/gadget/f_fastboot.c":
422) static unsigned int rx_bytes_expected(unsigned int maxpacket)
423) {
424) int rx_remain = download_size - download_bytes;
425) int rem = 0;
426) if (rx_remain < 0)
427) return 0;
428) if (rx_remain > EP_BUFFER_SIZE)
429) return EP_BUFFER_SIZE;
430) if (rx_remain < maxpacket) {
431) rx_remain = maxpacket;
432) } else if (rx_remain % maxpacket != 0) {
433) rem = rx_remain % maxpacket;
434) rx_remain = rx_remain + (maxpacket - rem);
435) }
436) return rx_remain;
437) }
In my case,
- rx_remain is 616
- maxpacket is 512
therefore, it hits line 434, where rx_remain is adjusted to 1024
But then the fastboot download phase just sits and waits forever,
because the host can only send 616 bytes, and we are waiting for 1024 bytes!
I don't understand why we are expecting MORE bytes than the host can
send during the download phase.... And I don't understand the need to
align to a multiple of "maxpacket" during the download phase....
BTW, if I delete lines 430 through 435, then it works properly!
Thanks, Steve
More information about the U-Boot
mailing list