aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorKenneth Bell <[email protected]>2023-04-07 17:06:01 +0100
committerRon Evans <[email protected]>2023-04-25 11:21:16 +0200
commitaf9f19615bb2f79d29a9cfaa1088890fbc154aad (patch)
treeb3b37a225b71bd7556a9d2bf043c1690b9c98901 /main.go
parent79b63dd041481684ecf3c42c9018283c5cfd8eef (diff)
downloadtinygo-af9f19615bb2f79d29a9cfaa1088890fbc154aad.tar.gz
tinygo-af9f19615bb2f79d29a9cfaa1088890fbc154aad.zip
all: better errors when multiple mcus share VID/PID
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 3b3b1a301..3d44526fa 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(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 {
+ if len(ports) == 1 {
return ports[0], nil
- } else {
+ } 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, ", "))
}
}