From 72064e12db1fda5f8ce348d112207f92100dd2f0 Mon Sep 17 00:00:00 2001 From: sago35 Date: Thu, 7 May 2020 12:44:49 +0900 Subject: [PATCH] WIP flash: fix touchSerialPortAt1200bps on windows --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 54a9c542..f77c5612 100644 --- a/main.go +++ b/main.go @@ -479,6 +479,13 @@ func touchSerialPortAt1200bps(port string) (err error) { // Open port p, e := serial.Open(port, &serial.Mode{BaudRate: 1200}) if e != nil { + if runtime.GOOS == `windows` { + se, ok := e.(*serial.PortError) + if ok && se.Code() == serial.InvalidSerialPort { + // InvalidSerialPort error occurs when transitioning to boot + return nil + } + } time.Sleep(1 * time.Second) err = e continue