Add HWID option for the boards // Issue #632

This commit is contained in:
Valeriy Koval committed 2016-04-25 12:35:21 +03:00
1 parent 7cb21dd981
commit 1872ecff16
9 files changed
+134 -76

No files matched your search

+4 -7
View File
@@ -84,17 +84,14 @@ def AutodetectUploadPort(env):
break
else:
board_build_opts = env.get("BOARD_OPTIONS", {}).get("build", {})
board_hwid = ("%s:%s" % (
board_build_opts.get("vid"),
board_build_opts.get("pid")
)).replace("0x", "")
for item in get_serialports():
if "VID:PID" not in item['hwid']:
continue
env.Replace(UPLOAD_PORT=item['port'])
if board_hwid in item['hwid']:
break
for hwid in board_build_opts.get("hwid"):
board_hwid = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "")
if board_hwid in item['hwid']:
break
if "UPLOAD_PORT" in env:
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']