aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorRon Evans <[email protected]>2023-04-25 15:50:06 +0200
committerRon Evans <[email protected]>2023-04-25 18:18:23 +0200
commit76303f9db4d97834dcd7035ba3cfc88aad8a1316 (patch)
tree7030cd360af69d2a592c27f064c64d114dc6bbf0 /main.go
parent4bf8b618e5f5301f38b4b0e75da77add37eaac55 (diff)
downloadtinygo-76303f9db4d97834dcd7035ba3cfc88aad8a1316.tar.gz
tinygo-76303f9db4d97834dcd7035ba3cfc88aad8a1316.zip
Revert "all: better errors when multiple mcus share VID/PID"
This reverts commit af9f19615bb2f79d29a9cfaa1088890fbc154aad.
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 3d44526fa..3b3b1a301 100644
--- a/main.go
+++ b/main.go
@@ -1143,12 +1143,12 @@ func getDefaultPort(portFlag string, usbInterfaces []string) (port string, err e
}
if len(portCandidates) == 0 {
- if len(ports) == 1 {
+ if len(usbInterfaces) > 0 {
+ return "", errors.New("unable to search for a default USB device - use -port flag, available ports are " + strings.Join(ports, ", "))
+ } else if len(ports) == 1 {
return ports[0], nil
- } else if len(ports) > 1 {
- return "", errors.New("multiple serial ports available - use -port flag, available ports are " + strings.Join(ports, ", "))
} else {
- return "", errors.New("unable to search for a default USB device - use -port flag, available ports are " + strings.Join(ports, ", "))
+ return "", errors.New("multiple serial ports available - use -port flag, available ports are " + strings.Join(ports, ", "))
}
}