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

dist/tools/pyterm: set exclusive access on port #19921

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Sep 13, 2023

Contribution description

A common source of error is that a user connects to a serial port that has already been opened in another terminal.
This may lead to garbled output or no output at all.

To avoid this, claim exclusive access on the serial port so we get a proper error instead of corrupted output.

Testing procedure

Connect to a serial port

$ ./dist/tools/pyterm/pyterm
2023-09-13 12:07:44,770 # Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.

Now try to open the same port again in a different terminal

$ ./dist/tools/pyterm/pyterm
2023-09-13 12:08:07,907 # Connect to serial port /dev/ttyUSB0
2023-09-13 12:08:07,908 # Could not exclusively lock port /dev/ttyUSB0: [Errno 11] Resource temporarily unavailable
2023-09-13 12:08:07,908 # Trying to reconnect to /dev/ttyUSB0 in 10 sec
2023-09-13 12:08:17,909 # Could not exclusively lock port /dev/ttyUSB0: [Errno 11] Resource temporarily unavailable

Issues/PRs references

A common source of error is that a user connects to a serial port that
has already been opened in another terminal.
This may lead to garbled output or no output at all.

To avoid this, claim exclusive access on the serial port so we get a
proper error instead of corrupted output.
@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Sep 13, 2023
@benpicco benpicco added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs labels Sep 13, 2023
@benpicco benpicco requested review from OlegHahm and maribu September 13, 2023 10:11
@riot-ci
Copy link

riot-ci commented Sep 13, 2023

Murdock results

✔️ PASSED

dad593a dist/tools/pyterm: set exclusive access on port

Success Failures Total Runtime
1 0 1 01m:20s

Artifacts

@benpicco
Copy link
Contributor Author

bors merge

@bors
Copy link
Contributor

bors bot commented Sep 13, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit e153047 into RIOT-OS:master Sep 13, 2023
29 checks passed
@benpicco benpicco deleted the pyterm-lock branch September 13, 2023 11:46
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.10 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants