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:
@@ -286,10 +286,7 @@ func nativeGetPortsList() ([]string, error) {
|
|||||||
if strings.HasPrefix(f.Name(), "ttyS") {
|
if strings.HasPrefix(f.Name(), "ttyS") {
|
||||||
port, err := nativeOpen(portName, &Mode{})
|
port, err := nativeOpen(portName, &Mode{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
serr, ok := err.(*PortError)
|
|
||||||
if ok && serr.Code() == InvalidSerialPort {
|
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
port.Close()
|
port.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user