🚧 Display vid/uid on USB ports

This commit is contained in:
Gina Häußge committed 2021-02-19 17:41:26 +01:00
1 parent 566e214ee4
commit c0232c1551
3 files changed
+13 -2

No files matched your search

+2
View File
@@ -2,12 +2,14 @@
* firmware info propagation & FirmwareCheck
* auto connect on start
* any chance to match by vid/pid (#4023)
* save and connect
* keep connection settings after disconnect, currently they revert to default
* Settings API for transport/protocol settings
* UI for connection profiles
* UI for transport/protocol settings
* SerialTransport:
* Auto detection (relies on protocol, which makes this somewhat tricky)
* RepRapProtocol:
TBC
+1 -1
View File
@@ -231,7 +231,7 @@ class Protocol(ListenerAware, TransportListener, ProtocolErrorStatsListener):
return []
def __init__(self, *args, **kwargs):
super(Protocol, self).__init__()
super().__init__()
self._logger = logging.getLogger(__name__)
self._connection_logger = logging.getLogger("CONNECTION")
@@ -131,9 +131,18 @@ class SerialTransport(Transport):
def get_available_serial_ports(cls):
from serial.tools.list_ports import comports
def port_title(port):
if port.vid and port.pid:
# usb
return "{desc} [{vid:04x}:{pid:04x}]".format(
desc=port.description, vid=port.vid, pid=port.pid
)
else:
return port.description
port_values = [Value(None, title="Auto detect")] + sorted(
[
Value(port.device, title=port.description)
Value(port.device, title=port_title(port))
for port in comports()
if port.device not in cls.ignored_ports
],