We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d672b3 commit 9d04335Copy full SHA for 9d04335
can/interfaces/serial/serial_can.py
@@ -21,6 +21,11 @@
21
)
22
serial = None
23
24
+try:
25
+ from serial.tools import list_ports
26
+except ImportError:
27
+ list_ports = None
28
+
29
30
class SerialBus(BusABC):
31
"""
@@ -162,3 +167,15 @@ def fileno(self):
162
167
return self.ser.fileno()
163
168
# Return an invalid file descriptor on Windows
164
169
return -1
170
171
+ @staticmethod
172
+ def _detect_available_configs():
173
+ channels = []
174
+ serial_ports = []
175
176
+ if list_ports:
177
+ serial_ports = list_ports.comports()
178
179
+ for port in serial_ports:
180
+ channels.append({"interface": "serial", "channel": port.device})
181
+ return channels
0 commit comments