diff --git a/dronecan_gui_tool/setup_window.py b/dronecan_gui_tool/setup_window.py index 5a3f1c1..c86dbe2 100644 --- a/dronecan_gui_tool/setup_window.py +++ b/dronecan_gui_tool/setup_window.py @@ -30,7 +30,7 @@ RUNNING_ON_LINUX = 'linux' in sys.platform.lower() - +MACOS_SERIAL_PORTS_FILTER = ['/dev/tty.debug-console', '/dev/tty.wlan-debug', '/dev/tty.Bluetooth-Incoming-Port'] logger = getLogger(__name__) @@ -100,7 +100,8 @@ def list_ifaces(): for port in QtSerialPort.QSerialPortInfo.availablePorts(): if sys.platform == 'darwin': if 'tty' in port.systemLocation(): - out[port.systemLocation()] = port.systemLocation() + if port.systemLocation() not in MACOS_SERIAL_PORTS_FILTER: + out[port.systemLocation()] = port.systemLocation() else: sys_name = port.systemLocation() sys_alpha = re.sub(r'[^a-zA-Z0-9]', '', sys_name) @@ -114,10 +115,11 @@ def list_ifaces(): out[x] = x try: - from can import detect_available_configs - for interface in detect_available_configs(): - if interface['interface'] == "pcan": - out[interface['channel']] = interface['channel'] + if sys.platform != 'darwin': + from can import detect_available_configs + for interface in detect_available_configs(): + if interface['interface'] == "pcan": + out[interface['channel']] = interface['channel'] except Exception as ex: logger.warning('Could not load can interfaces: %s', ex, exc_info=True)