undefined
Sun Jul 14 2024 07:37:01 GMT+0000 (Coordinated Universal Time)
Saved by
@Dewaldt
Packet Size
The maximum packet size is negotiated by the host and device in the Init packet. Devices must support at least 512-byte packets, but packet size has a direct correlation with download speed, so devices are strongly suggested to support at least 1024-byte packets. On a local network with 0.5ms round-trip time this will provide transfer rates of ~2MB/s. Over WiFi it will likely be significantly less.
Query and Initialization packets, which are sent before size negotiation is complete, must always be 512 bytes or less.
Packet Re-Transmission
The host will re-transmit any packet that does not receive a response. The requirement of exactly one device response packet per host packet is how we achieve reliability and in-order delivery of packets.
For simplicity of implementation, there is no windowing of multiple unacknowledged packets in this version of the protocol. The host will continue to send the same packet until a response is received. Windowing functionality may be implemented in future versions if necessary to increase performance.
The first Query packet will only be attempted a small number of times, but subsequent packets will attempt to retransmit for at least 1 minute before giving up. This means a device may safely ignore host UDP packets for up to 1 minute during long operations, e.g. writing to flash.
Continuation Packets
Any packet may set the continuation flag to indicate that the data is incomplete. Large data such as downloading an image may require many continuation packets. The receiver should respond to a continuation packet with an empty packet to acknowledge receipt. See examples below.
Summary
The host starts with a Query packet, then an Initialization packet, after which only Fastboot packets are sent. Fastboot packets may contain data from the host for writes, or from the device for reads, but not both.
Given a next expected sequence number S and a received packet P, the device behavior should be:
if P is a Query packet:
* respond with a Query packet with S in the data field
else if P has sequence == S:
* process P and take any required action
* create a response packet R with the same ID and sequence as P, containing
any response data required.
* transmit R and save it in case of re-transmission
* increment S
else if P has sequence == S - 1:
* re-transmit the saved response packet R from above
else:
* ignore the packet
Save
content_copyCOPY
https://android.googlesource.com/platform/system/core/+/master/fastboot/
Comments