2026-04-03 13:25:31 +09:00
|
|
|
package picotool
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os/exec"
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-05 21:48:47 +09:00
|
|
|
func Load(uf2Path string, serial string) error {
|
|
|
|
|
cmd := exec.Command("picotool", "load", uf2Path, "--ser", serial)
|
2026-04-03 13:25:31 +09:00
|
|
|
out, err := cmd.CombinedOutput()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("picotool load: %w\n%s", err, out)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-05 21:48:47 +09:00
|
|
|
func Reboot(serial string) error {
|
|
|
|
|
cmd := exec.Command("picotool", "reboot", "--ser", serial)
|
2026-04-03 13:25:31 +09:00
|
|
|
out, err := cmd.CombinedOutput()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("picotool reboot: %w\n%s", err, out)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|