eric6/MicroPython/MicroPythonDevices.py

changeset 8222
5994b80b8760
parent 8218
7c09585bd960
child 8259
2bbec88047dd
equal deleted inserted replaced
8221:0572a215bd2f 8222:5994b80b8760
208 if not port.isValid(): 208 if not port.isValid():
209 # no device detected at port 209 # no device detected at port
210 continue 210 continue
211 211
212 for board in SupportedBoards: 212 for board in SupportedBoards:
213 if ((vid, pid) in SupportedBoards[board]["ids"] or 213 if (
214 (vid, None) in SupportedBoards[board]["ids"]): 214 (vid, pid) in SupportedBoards[board]["ids"] or
215 if board in ("bbc_microbit", "calliope"): 215 (vid, None) in SupportedBoards[board]["ids"]
216 ):
217 if (
218 board in ("bbc_microbit", "calliope") and
219 (port.description().strip() !=
220 SupportedBoards[board]["port_description"])
221 ):
216 # both boards have the same VID and PID 222 # both boards have the same VID and PID
217 # try to differentiate based on port description 223 # try to differentiate based on port description
218 if ( 224 continue
219 port.description().strip() !=
220 SupportedBoards[board]["port_description"]
221 ):
222 continue
223 foundDevices.append(( 225 foundDevices.append((
224 board, 226 board,
225 port.description(), 227 port.description(),
226 SupportedBoards[board]["description"], 228 SupportedBoards[board]["description"],
227 port.portName(), 229 port.portName(),
228 vid, 230 vid,
229 pid, 231 pid,
230 )) 232 ))
231 supported = True 233 supported = True
232 if not supported: 234 if not supported and (vid, pid) in manualDevices:
233 # check the locally added ones next 235 # check the locally added ones next
234 if (vid, pid) in manualDevices: 236 board = manualDevices[(vid, pid)]["type"]
235 board = manualDevices[(vid, pid)]["type"] 237 foundDevices.append((
236 foundDevices.append(( 238 board,
237 board, 239 port.description(),
238 port.description(), 240 SupportedBoards[board]["description"],
239 SupportedBoards[board]["description"], 241 port.portName(),
240 port.portName(), 242 vid,
241 vid, 243 pid,
242 pid, 244 ))
243 )) 245 supported = True
244 supported = True
245 if not supported: 246 if not supported:
246 if vid and pid: 247 if vid and pid:
247 if (vid, pid) not in IgnoredBoards: 248 if (vid, pid) not in IgnoredBoards:
248 unknownDevices.append((vid, pid, port.description())) 249 unknownDevices.append((vid, pid, port.description()))
249 logging.debug("Unknown device: (0x%04x:0x%04x %s)", 250 logging.debug("Unknown device: (0x%04x:0x%04x %s)",

eric ide

mercurial