JustPretender / fastboot

A simple library that implements Android Fastboot protocol.
MIT License
7 stars 5 forks source link

Add a full session example #9

Open XVilka opened 3 months ago

XVilka commented 3 months ago

Currently, only individual commands have examples. I wonder if it will be easier to understand for newcomers with a more complicated example of the "common session". The fastboot specification document from Google has this example, I think it would be a good target for doing so:

Example Session
---------------
Host:    "getvar:version"        request version variable
Client:  "OKAY0.4"               return version "0.4"
Host:    "getvar:nonexistant"    request some undefined variable
Client:  "OKAY"                  return value ""
Host:    "download:00001234"     request to send 0x1234 bytes of data
Client:  "DATA00001234"          ready to accept data
Host:    < 0x1234 bytes >        send data
Client:  "OKAY"                  success
Host:    "flash:bootloader"      request to flash the data to the bootloader
Client:  "INFOerasing flash"     indicate status / progress
         "INFOwriting flash"
         "OKAY"                  indicate success
Host:    "powerdown"             send a command
Client:  "FAILunknown command"   indicate failure
orangecms commented 1 month ago

I'll just add a full CLI, similar to what other Rust libraries do. It's quite trivial and should be good enough as a reference for using the crate as a pure library.