eric6/MicroPython/MicroPythonDevices.py

changeset 7588
881eebfefd34
parent 7549
fcfbb9e94471
child 7592
f79dc58bdf62
diff -r 635f4f018e76 -r 881eebfefd34 eric6/MicroPython/MicroPythonDevices.py
--- a/eric6/MicroPython/MicroPythonDevices.py	Fri May 08 18:11:09 2020 +0200
+++ b/eric6/MicroPython/MicroPythonDevices.py	Sat May 09 11:47:40 2020 +0200
@@ -93,16 +93,20 @@
     """
     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 and PID for unknown devices
+    @rtype tuple of (list of tuples of (str, str, str), list of tuples of
+        (str, 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 +115,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: {0:04x}".format(vid),
+                                       "PID: {0:04x}".format(pid)))
+                logging.debug("Unknown device: (0x%04x:0x%04x)", vid, pid)
     
-    return foundDevices
+    return foundDevices, unknownDevices
 
 
 def getDeviceIcon(boardName, iconFormat=True):

eric ide

mercurial