Merge pull request #135 from cmaglie/skip-enumerating-unaccessible-serial-port

Skip enumerating ports that are not accessible for any reason
This commit is contained in:
Cristian Maglie
2022-02-18 12:41:35 +01:00
committed by GitHub

View File

@@ -286,10 +286,7 @@ func nativeGetPortsList() ([]string, error) {
if strings.HasPrefix(f.Name(), "ttyS") {
port, err := nativeOpen(portName, &Mode{})
if err != nil {
serr, ok := err.(*PortError)
if ok && serr.Code() == InvalidSerialPort {
continue
}
} else {
port.Close()
}