uf2conv: add more searchpaths, fix pathcheck#96
Merged
mmoskal merged 1 commit intomicrosoft:masterfrom May 6, 2025
crasbe:more_searchpaths
Merged
uf2conv: add more searchpaths, fix pathcheck#96mmoskal merged 1 commit intomicrosoft:masterfrom crasbe:more_searchpaths
mmoskal merged 1 commit intomicrosoft:masterfrom
crasbe:more_searchpaths
Conversation
Some distributions like Arch Linux still use '/mnt' as the
primary mounting directory.
If the 'uf2conv.py' script was called via sudo, it did not
find any devices because it searched at '/media/root', which
usually is unused.
Therefore the ${SUDO_USER} env-variable is evaluated as a
searchpath, if it exists.
Contributor
Author
|
Some test traces with a Seeedstudio Xiao nRF52840 Sense: |
Contributor
|
sorry for delay! |
Contributor
Author
|
Thank you for merging :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello everyone,
the RIOT OS uses the
uf2conv.pyscript to program devices with the Adafruit nRF52 Bootloader.Today we noticed some quirks:
Some distributions that don't necessarily use an automounter by default (like Arch Linux) don't necessarily use
/mediato mount devices but the more "tradutional" mount point/mnt. Theuf2conv.pyscript currently does not search there.When running
uf2conv.pyas root viasudo, it won't find any devices mounted by the user. This is because currently only the paths with/media/${USER}are checked. However${USER}==rootwhen usingsudo. Therefore this PR adds a check ifSUDO_USERis defined in the environment and adds/media/${SUDO_USER}to the search path.os.path.isdir(rootpath)check is redundant. I guess that that like should've beenos.path.isdir(os.path.join(rootpath, d))to see if the path is valid before adding it to thedrivesvariable.Best Regards,
Chris