mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Automatically detect upload port using VID:PID board settings // Resolve #231
This commit is contained in:
@ -4,6 +4,8 @@ Release History
|
||||
2.1.1 (2015-??-??)
|
||||
------------------
|
||||
|
||||
* Automatically detect upload port using VID:PID board settings
|
||||
(`issue #231 <https://github.com/platformio/platformio/issues/231>`_)
|
||||
* Improved detection of build changes
|
||||
* Avoided ``LibInstallDependencyError`` when more then 1 library is found
|
||||
(`issue #229 <https://github.com/platformio/platformio/issues/229>`_)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (2, 1, "1.dev3")
|
||||
VERSION = (2, 1, "1.dev4")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -69,18 +69,25 @@ def AutodetectUploadPort(env):
|
||||
if (not item['name'] or
|
||||
not any([l in item['name'].lower() for l in msdlabels])):
|
||||
continue
|
||||
print "Auto-detected UPLOAD_PORT/DISK: %s" % item['disk']
|
||||
env.Replace(UPLOAD_PORT=item['disk'])
|
||||
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
|
||||
print "Auto-detected UPLOAD_PORT: %s" % item['port']
|
||||
env.Replace(UPLOAD_PORT=item['port'])
|
||||
break
|
||||
if board_hwid in item['hwid']:
|
||||
break
|
||||
|
||||
if "UPLOAD_PORT" not in env:
|
||||
if "UPLOAD_PORT" in env:
|
||||
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']
|
||||
else:
|
||||
Exit("Error: Please specify `upload_port` for environment or use "
|
||||
"global `--upload-port` option.\n"
|
||||
"For the some development platforms it can be USB flash drive\n")
|
||||
|
Reference in New Issue
Block a user