I am trying to understand how does blhost execute the flash process. I ran this command to flash the build file to the device
./blhost -p /dev/ttyUSB0,xxxxx -- write-memory 0xxxxxxx buildFile.bin
I then use wireshark to intercept usb0's traffic, I found that blhost cut the big .bin file into several segments, and send these segments one by one to flash the device.
At here, the blhost sends out two 320 bytes segments, followed with a 70 bytes segments each time. In the first 8 bytes of the first 320 bytes segment, it has the same hex data (5a a5 00 02).
My questions:
1. Why does blhost cut the data into 2 * 320 bytes of data + 1 * 70 bytes of data, then repeat?
2. Why the first 8 bytes are the same? What does this 8 bytes mean?
3. How does blhost knows that every segment is received correctly?
4. Where can I get blhost source code?