Add msgpack wire protocol with halfsiphash checksums

This commit is contained in:
Ian Gulliver
2026-04-03 16:59:11 +09:00
parent b076cce34a
commit db6f005bef
33 changed files with 5928 additions and 3 deletions

View File

@@ -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)
}