Bidirectional msgpack wire protocol with unpack support
This commit is contained in:
@@ -40,8 +40,12 @@ func run(buildDir string) error {
|
||||
return err
|
||||
}
|
||||
if dev != "" {
|
||||
fmt.Printf("Sending 'b' to %s to enter BOOTSEL mode...\n", dev)
|
||||
resp, err := picoserial.SendByteAndRead(dev, 'b', 2*time.Second)
|
||||
fmt.Printf("Sending bootsel request to %s...\n", dev)
|
||||
req, err := wire.EncodeMessage(&wire.RequestBOOTSEL{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("encoding request: %w", err)
|
||||
}
|
||||
resp, err := picoserial.SendAndReceive(dev, req, 2*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -51,7 +55,7 @@ func run(buildDir string) error {
|
||||
fmt.Fprintf(os.Stderr, "warning: failed to decode response: %v\n", err)
|
||||
} else {
|
||||
switch msg.(type) {
|
||||
case *wire.RebootingBootsel:
|
||||
case *wire.ResponseBOOTSEL:
|
||||
fmt.Println("Device confirmed reboot into BOOTSEL mode.")
|
||||
default:
|
||||
fmt.Printf("Unexpected response type: %T\n", msg)
|
||||
|
||||
Reference in New Issue
Block a user