eric6/MicroPython/MicroPythonDevices.py

branch
maintenance
changeset 7607
dd1054be15aa
parent 7597
9dac5ef0126d
child 7780
41420f82c0ac
diff -r 707442ffadc3 -r dd1054be15aa eric6/MicroPython/MicroPythonDevices.py
--- a/eric6/MicroPython/MicroPythonDevices.py	Sat May 02 14:04:18 2020 +0200
+++ b/eric6/MicroPython/MicroPythonDevices.py	Sun May 31 17:26:14 2020 +0200
@@ -43,7 +43,7 @@
             (0x1209, 0x2017),       # Mini SAM M4
             (0x1209, 0x7102),       # Mini SAM M0
         ],
-        "description": "CircuitPython Boards",
+        "description": "CircuitPython Board",
         "icon": "circuitPythonDevice",
     },
     
@@ -93,16 +93,21 @@
     """
     Function to check the serial ports for supported MicroPython devices.
     
-    @return set of tuples with the board type, a description and the serial
-        port it is connected at
-    @rtype set of tuples of (str, str, str)
+    @return tuple containing a list of tuples with the board type, a
+        description and the serial port it is connected at for known device
+        types and a list of tuples with VID, PID and description for unknown
+        devices
+    @rtype tuple of (list of tuples of (str, str, str), list of tuples of
+        (int, int, str)
     """
     from PyQt5.QtSerialPort import QSerialPortInfo
     
     foundDevices = []
+    unknownDevices = []
     
     availablePorts = QSerialPortInfo.availablePorts()
     for port in availablePorts:
+        supported = False
         vid = port.vendorIdentifier()
         pid = port.productIdentifier()
         for board in SupportedBoards:
@@ -111,10 +116,14 @@
                 foundDevices.append(
                     (board, SupportedBoards[board]["description"],
                      port.portName()))
-        else:
-            logging.debug("Unknown device: (0x%04x:0x%04x)", vid, pid)
+                supported = True
+        if not supported:
+            if vid and pid:
+                unknownDevices.append((vid, pid, port.description()))
+                logging.debug("Unknown device: (0x%04x:0x%04x %s)",
+                              vid, pid, port.description())
     
-    return foundDevices
+    return foundDevices, unknownDevices
 
 
 def getDeviceIcon(boardName, iconFormat=True):

eric ide

mercurial