File tree Expand file tree Collapse file tree
python3/src/splib3/interface Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,17 +13,17 @@ def getDevicePort(entry, method="manufacturer"):
1313 ports = []
1414 comports = serial .tools .list_ports .comports ()
1515
16- if comports is None :
16+ if comports is None or len ( comports ) == 0 :
1717 Sofa .msg_error ("stlib3.interface.serialport" ,
1818 "Serial ports check failed, list of ports is empty." )
1919 return
2020
2121 if method == "manufacturer" :
22- ports = [p for p in comports if entry in p .manufacturer ]
22+ ports = [p for p in comports if p . manufacturer is not None and entry in p .manufacturer ]
2323 if method == "description" :
24- ports = [p for p in comports if entry in p .description ]
24+ ports = [p for p in comports if p . description is not None and entry in p .description ]
2525 if method == "serial_number" :
26- ports = [p for p in comports if entry in p .serial_number ]
26+ ports = [p for p in comports if p . serial_number is not None and entry in p .serial_number ]
2727
2828 if not ports :
2929 Sofa .msg_error ("stlib3.interface.serialport" ,
You can’t perform that action at this time.
0 commit comments