eric6/MicroPython/MicroPythonDevices.py

changeset 7592
f79dc58bdf62
parent 7588
881eebfefd34
child 7597
9dac5ef0126d
equal deleted inserted replaced
7591:16730b2c480c 7592:f79dc58bdf62
93 """ 93 """
94 Function to check the serial ports for supported MicroPython devices. 94 Function to check the serial ports for supported MicroPython devices.
95 95
96 @return tuple containing a list of tuples with the board type, a 96 @return tuple containing a list of tuples with the board type, a
97 description and the serial port it is connected at for known device 97 description and the serial port it is connected at for known device
98 types and a list of tuples with VID and PID for unknown devices 98 types and a list of tuples with VID, PID and description for unknown
99 devices
99 @rtype tuple of (list of tuples of (str, str, str), list of tuples of 100 @rtype tuple of (list of tuples of (str, str, str), list of tuples of
100 (str, str) 101 (int, int, str)
101 """ 102 """
102 from PyQt5.QtSerialPort import QSerialPortInfo 103 from PyQt5.QtSerialPort import QSerialPortInfo
103 104
104 foundDevices = [] 105 foundDevices = []
105 unknownDevices = [] 106 unknownDevices = []
116 (board, SupportedBoards[board]["description"], 117 (board, SupportedBoards[board]["description"],
117 port.portName())) 118 port.portName()))
118 supported = True 119 supported = True
119 if not supported: 120 if not supported:
120 if vid and pid: 121 if vid and pid:
121 unknownDevices.append(("VID: {0:04x}".format(vid), 122 unknownDevices.append((vid, pid, port.description()))
122 "PID: {0:04x}".format(pid))) 123 logging.debug("Unknown device: (0x%04x:0x%04x %s)",
123 logging.debug("Unknown device: (0x%04x:0x%04x)", vid, pid) 124 vid, pid, port.description())
124 125
125 return foundDevices, unknownDevices 126 return foundDevices, unknownDevices
126 127
127 128
128 def getDeviceIcon(boardName, iconFormat=True): 129 def getDeviceIcon(boardName, iconFormat=True):

eric ide

mercurial