Skip to content

Commit

Permalink
Merge pull request #36 from TerryGuo/find_mbed_hid_devices
Browse files Browse the repository at this point in the history
A better way to find and save mbed hid devices
  • Loading branch information
emilmont committed Aug 16, 2013
2 parents 089441f + a02cee9 commit 3b0618e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions workspace_tools/debugger/pyOCD/interface/pywinusb_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ def getAllConnectedInterface(vid, pid):
"""
all_devices = hid.find_all_hid_devices()

# keep devices with good vid/pid
# find devices with good vid/pid
all_mbed_devices = []
for d in all_devices:
if (d.vendor_id != vid) or (d.product_id != pid):
all_devices.remove(d)
if (d.vendor_id == vid) and (d.product_id == pid):
all_mbed_devices.append(d)

if not all_devices:
if not all_mbed_devices:
logging.debug("No Mbed device connected")
return

boards = []
for dev in all_devices:
for dev in all_mbed_devices:
try:
dev.open()
report = dev.find_output_reports()
Expand Down

0 comments on commit 3b0618e

Please sign in to comment.