pyboard.py: Default to the last available serial port on the system #14336
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.
A small addition to the pyboard.py upload tool. This makes it default to the last serial port available on the system instead of
/dev/ttyACM0
.My main reason for adding this is that port numbers on windows are not very predictable, and looking up the port each time is quite annoying.
The reason for picking the last port in the list, is that physical RS232 ports (even if they are rare) are first in the list before USB ports. So the last thing in the list is the thing you most recently plugged in. So very likely your target.
End result of this change is that not specifying a port on Windows works. And not specifying a port on Linux will act slightly different if you have multiple boards connected.