Add msgpack wire protocol with halfsiphash checksums
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/theater/picomap/lib/picoserial"
|
||||
"github.com/theater/picomap/lib/picotool"
|
||||
"github.com/theater/picomap/lib/wire"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -40,9 +41,23 @@ func run(buildDir string) error {
|
||||
}
|
||||
if dev != "" {
|
||||
fmt.Printf("Sending 'b' to %s to enter BOOTSEL mode...\n", dev)
|
||||
if err := picoserial.SendByte(dev, 'b'); err != nil {
|
||||
resp, err := picoserial.SendByteAndRead(dev, 'b', 2*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(resp) > 0 {
|
||||
msg, err := wire.DecodeMessage(resp)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "warning: failed to decode response: %v\n", err)
|
||||
} else {
|
||||
switch msg.(type) {
|
||||
case *wire.RebootingBootsel:
|
||||
fmt.Println("Device confirmed reboot into BOOTSEL mode.")
|
||||
default:
|
||||
fmt.Printf("Unexpected response type: %T\n", msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user