diff options
author | Kenneth Bell <[email protected]> | 2023-04-07 17:06:01 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-04-25 11:21:16 +0200 |
commit | af9f19615bb2f79d29a9cfaa1088890fbc154aad (patch) | |
tree | b3b37a225b71bd7556a9d2bf043c1690b9c98901 /main.go | |
parent | 79b63dd041481684ecf3c42c9018283c5cfd8eef (diff) | |
download | tinygo-af9f19615bb2f79d29a9cfaa1088890fbc154aad.tar.gz tinygo-af9f19615bb2f79d29a9cfaa1088890fbc154aad.zip |
all: better errors when multiple mcus share VID/PID
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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, ", ")) } } |