Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automatic upload port selection for LPC1768 on Darwin and Linux #24599

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Marlin/src/HAL/LPC1768/upload_extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def before_upload(source, target, env):
for drive in drives:
try:
fpath = mpath / drive
files = [ x for x in fpath.iterdir() if x.is_file() ]
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
except:
continue
else:
if target_filename in files:
if target_filename in filenames:
upload_disk = mpath / drive
target_file_found = True
break
Expand All @@ -104,21 +104,21 @@ def before_upload(source, target, env):
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
dpath = Path('/Volumes') # human readable names
drives = [ x for x in dpath.iterdir() ]
drives = [ x for x in dpath.iterdir() if x.is_dir() ]
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = dpath / target_drive
for drive in drives:
try:
fpath = dpath / drive # will get an error if the drive is protected
files = [ x for x in fpath.iterdir() ]
fpath = dpath / drive # will get an error if the drive is protected
filenames = [ x.name for x in fpath.iterdir() if x.is_file() ]
except:
continue
else:
if target_filename in files:
if not target_file_found:
upload_disk = dpath / drive
if target_filename in filenames:
upload_disk = dpath / drive
target_file_found = True
break

#
# Set upload_port to drive if found
Expand Down