* [U-Boot] question about "drivers/usb/gadget/f_fastboot.c"
@ 2016-01-27 19:49 Steve Rae
0 siblings, 0 replies; only message in thread
From: Steve Rae @ 2016-01-27 19:49 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-01-27 19:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 19:49 [U-Boot] question about "drivers/usb/gadget/f_fastboot.c" Steve Rae
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox