From 2da47106e7e560315193bffc44d0412b3f294f0f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 18 Sep 2024 14:20:50 +1000 Subject: [PATCH] nicer serial selection on windows --- dronecan_gui_tool/setup_window.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dronecan_gui_tool/setup_window.py b/dronecan_gui_tool/setup_window.py index e8a3ca3..735f03a 100644 --- a/dronecan_gui_tool/setup_window.py +++ b/dronecan_gui_tool/setup_window.py @@ -20,6 +20,7 @@ from logging import getLogger from collections import OrderedDict from itertools import count +import re STANDARD_BAUD_RATES = 9600, 115200, 460800, 921600, 1000000, 3000000 @@ -101,7 +102,11 @@ def list_ifaces(): if 'tty' in port.systemLocation(): out[port.systemLocation()] = port.systemLocation() else: - out[port.description()] = port.systemLocation() + sys_name = port.systemLocation() + sys_alpha = re.sub(r'[^a-zA-Z0-9]', '', sys_name) + description = port.description() + # show the COM port in parentheses to make it clearer which port it is + out["%s (%s)" % (description, sys_alpha)] = sys_name mifaces = _mavcan_interfaces() mifaces += ["mcast:0", "mcast:1"]