aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorsago35 <[email protected]>2020-05-07 12:44:49 +0900
committerRon Evans <[email protected]>2020-06-03 15:26:03 +0200
commit72064e12db1fda5f8ce348d112207f92100dd2f0 (patch)
tree7cc054f7304f2b7bac1c45793b81b80158422b7e
parent3c31a3110f7b91e738154e27198576951aa9290e (diff)
downloadtinygo-72064e12db1fda5f8ce348d112207f92100dd2f0.tar.gz
tinygo-72064e12db1fda5f8ce348d112207f92100dd2f0.zip
WIP flash: fix touchSerialPortAt1200bps on windows
-rw-r--r--main.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.go b/main.go
index 54a9c542b..f77c5612b 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