fixed port issues on Linux systems. Now ttySx are ignored
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -15,8 +15,26 @@ WAIT_AFTER_SEND = 0.15 # Wait after sending command, before requesting input (in
|
||||
|
||||
def create_port_connection():
|
||||
prt = None
|
||||
for port, _, _ in sorted(cmd.list_ports.comports()):
|
||||
print()
|
||||
ports = []
|
||||
for port, _,_ in sorted(cmd.list_ports.comports()):
|
||||
ports.append(port)
|
||||
|
||||
#ONLY FOR LINUX!!!
|
||||
have_ttyUSB = False
|
||||
USB_ports = []
|
||||
for port in ports:
|
||||
if "USB" in port:
|
||||
USB_ports.append(port)
|
||||
if len(USB_ports):
|
||||
ports = USB_ports
|
||||
# print("ports:", ports)
|
||||
|
||||
|
||||
# for port, _, _ in sorted(cmd.list_ports.comports()):
|
||||
for port in ports:
|
||||
try:
|
||||
print("PORT:", port)
|
||||
prt = cmd.setup_port_connection(port=port, baudrate=115200, timeout_sec=1)
|
||||
cmd.open_port(prt)
|
||||
reset_port_settings(prt)
|
||||
@ -107,4 +125,4 @@ def print_data(data):
|
||||
"V 5V2: "+shorten(data['MON_5V2'])+"V 7V0: "+shorten(data['MON_7V0'])+"V.")
|
||||
|
||||
def close_connection(prt):
|
||||
cmd.close_port(prt)
|
||||
cmd.close_port(prt)
|
||||
|
||||
Reference in New Issue
Block a user