From 76303f9db4d97834dcd7035ba3cfc88aad8a1316 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Tue, 25 Apr 2023 15:50:06 +0200 Subject: Revert "all: better errors when multiple mcus share VID/PID" This reverts commit af9f19615bb2f79d29a9cfaa1088890fbc154aad. --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'main.go') 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, ", ")) } } -- cgit v1.2.3