Revert "all: better errors when multiple mcus share VID/PID"

This reverts commit af9f19615b.
Этот коммит содержится в:
Ron Evans 2023-04-25 15:50:06 +02:00
родитель 4bf8b618e5
коммит 76303f9db4

10
main.go
Просмотреть файл

@ -1143,12 +1143,12 @@ func getDefaultPort(portFlag string, usbInterfaces []string) (port string, err e
}
if len(portCandidates) == 0 {
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 {
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 {
return "", errors.New("multiple serial ports available - use -port flag, available ports are " + strings.Join(ports, ", "))
}
}