all: better errors when multiple mcus share VID/PID

Этот коммит содержится в:
Kenneth Bell 2023-04-07 17:06:01 +01:00 коммит произвёл Ron Evans
родитель 79b63dd041
коммит af9f19615b

Просмотреть файл

@ -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, ", "))
}
}