[riot-notifications] [RIOT-OS/RIOT] pyterm: Add device timeout (#12270)
notifications at github.com
Wed Sep 18 10:58:23 CEST 2019
### Contribution description
When pyterm is used on boards that use CDC-ACM stdio (ie. provide their own USB device), that device is not available immediately after flashing, and a `make flash term` is likely to fail.
This adds a --device-timeout option to pyterm that will repeat pyterm's device opening step until the timeout is exceeded (in which case it will fail as it had before), or the device can be opened.
Boards that use such a configuration will want to set PYTERMFLAGS += --device-timeout=5 or another suitable value depending on the board's expected time to go from bootloader to operational.
### Testing procedure
On a board that uses the the stdio_cdc_acm module, set PYTERMFLAGS=--device-timeout=5 and `make flash term` and see that the terminal opens after a few seconds rather than failing with a "device not found" message.
On other boards the test can be emulated by running `make term` with the serial connection unplugged, plugging it in a second after the command has started.
### Issues/PRs references
The issue will become more widespread when #11085 is available and boards like the nrf52840-dongle (#12189) become more easily usable with RIOT.
This solves the problem only for pyterm. Worse yet, it may still be racy if the bootloader used is occupying the same file name as the serial target. (That is the case on my board, but the race always went well, presumably because the USB reset caused by the flashing tool is immediate).
An alternative solution would be to have a `term-ready` target that `term` would always depend on, and boards could set a `TERM_READY_TOOL` (defaulting to `true`?) that would be active in that stage. A simple tool that does not handle the racing case could be shipped as a shell script. The variable would also provide an entry point for a more sophisticated solution that can tell boot loaders apart from real terminal ttys.
I could implement that as well (come to think of it writing this last line I'm leaning more and more towards that rather than this PR), but would need some guidance in the complex Makefile ecosystem.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* pyterm: Add a --device-timeout option
-- File Changes --
M dist/tools/pyterm/pyterm (33)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications