1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

87 Commits

Author SHA1 Message Date
Hugues Larrive
4f3cb128ae dist/tools/pyterm: ipv6 address support for tcp_serial option 2021-08-12 22:19:04 +02:00
Martine Lenders
271d1ae3a2
pyterm: read space after prompt into prompt
Currently, when the prompt is read in `pyterm` the space after it is
ignored for the prompt and the output command just adds its own prompt.
This leads to the next output always having a leading space, see e.g.
this output from `tests/shell` using `RIOT_TERMINAL=pyterm`:

```
make: Entering directory '/home/mlenders/Repositories/RIOT-OS/RIOT2/tests/shell'
/home/mlenders/Repositories/RIOT-OS/RIOT2/dist/tools/pyterm/pyterm -p "/dev/ttyUSB1" -b "500000"
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2021-02-09 14:47:15,071 # Connect to serial port /dev/ttyUSB1
Welcome to pyterm!
Type '/exit' to exit.
bufsize
2021-02-09 14:47:19,712 # bufsize
2021-02-09 14:47:19,712 # 128
> bufsize
2021-02-09 14:47:21,535 #  bufsize
2021-02-09 14:47:21,536 # 128
>
```

While this isn't necessarily a problem in most cases, it becomes a
problem when the prompt is expected and the output of a command is
empty. In that case, the space is added to the empty output, making it
" ", so the prompt output command is never triggered and the prompt is
added to the next command in the log output. To demonstrate I added a
command `empty` to `tests/shell` that just does nothing and deactivated
the command echoing using `CFLAGS=-DCONFIG_SHELL_NO_ECHO=1`:

```
empty
> empty
empty
bufsize
2021-02-09 14:54:33,753 #  > > 128
>
```

This fixes that problem by also reading the assumed space (we already
assume the prompt, so I don't see no harm in that) and if it is not a
space to skip the reading of the next char in the next iteration of the
reader loop.
2021-02-09 17:17:25 +01:00
Martine Lenders
40da80085e
pyterm: move char reading and reconnect to their own private functions 2021-02-09 16:51:52 +01:00
Benjamin Valentin
830bd34662 pyterm: use Python3 in setup.py 2020-07-08 14:57:14 +02:00
Martine Lenders
1aeae204c3
pyterm: return errno on OSError 2020-03-11 14:55:05 +01:00
Martine Lenders
7a9010fefa
pyterm: try to reconnect on SerialException during connect
This is what the user would do anyway.
2020-03-11 14:55:04 +01:00
benpicco
8a99824e66
Merge pull request #11095 from benpicco/pyterm_sleep
pyterm: add /sleep function
2020-01-15 18:25:29 +01:00
Francisco Molina
2e8968fa17 dist/tools/pyterm/pyterm: fix PEP8 F841, unused variable 2019-11-22 11:47:49 +01:00
Francisco Molina
2202b71f99 flake8: fix PEP8 overidentation E127 2019-11-21 10:11:56 +01:00
Benjamin Valentin
6a08a78d77 dist/tools/pyterm: drop loglevel from putput
The loglevel on pyterm is always INFO.
Drop it to remove clutter from the output.
2019-09-27 15:16:06 +02:00
abd1cd51b7
Merge pull request #12120 from cladmi/pr/pyterm/configurable_repeat_command_on_empty_line
pyterm: configuring repeating command on empty line
2019-09-10 09:41:05 +02:00
9ea3b2e04f
dist/tools/pyterm: fix handling of reset ANSI escape code 2019-09-09 20:27:16 +02:00
Gaëtan Harter
0fc38c58e8
pyterm: configuring repeating command on empty line
Allow configuring that it sends an empty newline when it receives a newline.
2019-08-29 15:15:57 +02:00
Benjamin Valentin
e12f1f2ff8 pyterm: add /sleep function
The init_cmd feature is quite handy for automated pyterm runs but there
is no delay between the commands that are executed.

This adds a /sleep function that can be added between init_cmd commands
to prevent them from overflowing the RX buffer on the target.
2019-04-11 00:09:58 +02:00
Gaëtan Harter
f89bf055b4
pyterm: use python3 by default
Python3 has been the default in our scripts for some time now, but pyterm still
requested python which uses python2 on ubuntu stable.

This pushes toward only needing to install `python3` python
dependencies.
2019-02-11 17:09:13 +01:00
98413e43af tools/pyterm: catch serial.Exception when port is busy
This can happen when opening a terminal right after flashing a board that has just been plugged
2018-11-27 17:30:45 +01:00
75dba75fbb dist/tools/pyterm: handle ctrl+d nicely 2018-09-03 17:34:23 +02:00
Semjon Kerner
a01eb37b6f dist/tools/pyterm: change deprecated warn to warning 2018-08-23 12:23:59 +02:00
Leandro Lanzieri
28b832ad1f dist/tools: Add option to set the value of RTS and DTR pins in pyterm 2018-08-22 11:13:45 +02:00
Leandro Lanzieri
9b0dd23ebf dist/tools: Add option to invert DTR and RTS logic values in pyterm 2018-08-22 09:00:06 +02:00
eaee364a1b dist/tools/pyterm: fix flakes8 issues 2018-01-05 15:21:03 +01:00
c20948df09 dist/tools/pyterm: remove duplicate method in PubProtocol
probably a copy paste from
http://twistedmatrix.com/documents/13.0.0/core/howto/servers.html#auto1
'numProtocols' is not used anywhere else so we keep the second version
of the 'connectionLost' function.
2018-01-05 15:18:51 +01:00
Lucas Jenss
33002325d5 tools/pyterm: Notify user if wrong serial package is installed
When installing the `serial` package (in contrast to `pyserial`)
the pyterm script will print a cryptic error message and fail.
This is because both packages, though unrelated, expose a `serial`
package (whereas pyserial should expose `pyserial`).

This change catches the error and might save some precious lifetime
of unsuspecting RIOT users, such as myself.
2017-11-28 20:00:37 +01:00
b109b9ff99 dist/tools/pyterm: exit without traceback on keyboard interrupt 2017-11-27 13:19:48 +01:00
Oleg Hahm
3fb2984d2a tools: pyterm: display received prompt immediately 2017-01-18 19:54:10 +01:00
Antonio Galea
2fa4ad3833 reconnecting a USB-serial dongle under Linux might give permission errors until udev scripts complete 2017-01-15 16:59:36 +01:00
Oleg Hahm
3a779b92fa tools: pyterm: specify format prefix via argument 2017-01-10 18:55:49 +01:00
Oleg Hahm
486ca73308 tools: pyterm: properly handle custom output fmt 2017-01-10 11:44:24 +01:00
Oleg Hahm
00942927a2 pyterm: log to stdout per default 2016-11-17 16:59:36 +01:00
Oleg Hahm
0331029990 pyterm: fix logging directory
The default logging directory should be ${HOME}/${HOST}/run-name/
2016-03-20 21:20:59 +01:00
0d9f14c848 make pyterm nicely fails if no port is available 2015-11-20 17:50:40 +01:00
Oleg Hahm
3b8aa9b476 pyterm: fix problems with German umlauts as input 2015-10-27 15:27:04 +01:00
Ludwig Ortmann
ec9d5ea271 Merge pull request #3043 from OlegHahm/pyterm-newline
Pyterm newline
2015-05-26 08:56:37 +02:00
Janos Kutscherauer
6c620f273d Added improved handling of CR/LF in PYTERM.
The default behaviour only appreciates the LF character (unix style).
The pyterm switch -nl/--newline can be used to specify the newline combination of CR/NL.
Possible values are CR, NL, CRNL and NLCR. Default is NL.
2015-05-25 13:38:14 +02:00
Joakim Gebart
f9059ea08d dist/tools/pyterm/testbeds: whitespace fixes 2015-05-09 09:00:36 +02:00
Joakim Gebart
a1d40524f1 dist/tools/pyterm/pytermcontroller: whitespace fixes 2015-05-09 08:59:43 +02:00
Oleg Hahm
30b166c177 pyterm: make mostly pep8 compliant 2014-11-07 01:02:55 +01:00
Oleg Hahm
cbe49912be pyterm: enable TCP connection to remote host 2014-11-05 22:42:36 +01:00
Oleg Hahm
9b4d22aaa0 pyterm: make pin toggling optional
For the MSB-A2 the DTR and RTS pins have to be pulled down over the
serial interface in the beginning. (This is required because the Linux
usbserial driver pulls them up when initializing the device which set
the node into reset mode.) Since this is not necessary on most other
platforms and might even cause problems, it's better to make this an
optional behavior of pyterm.
2014-09-24 17:05:36 +02:00
Philipp Rosenkranz
2a67363be3 dist: pyterm control server (incl. support for multiple testbeds) 2014-09-19 14:42:15 +02:00
Hinnerk van Bruinehsen
1b5836571b pyterm: fix exit behavior if twisted is not available 2014-08-16 00:49:43 +02:00
Oleg Hahm
dce96763b5 pyterm: adds timer function
/timer <interval> <command> now allows to schedule arbitrary commands to
be send to the node after the specified interval (in seconds).
2014-08-13 11:46:36 -04:00
Martine Lenders
5fa5c568ff pyterm: Use only printf-style String Formatting
Needed for backwards compatibility to python 2.6. Refers to
46c38230eb (commitcomment-7363298)
2014-08-13 00:16:41 +02:00
Oleg Hahm
cb85a901f2 pyterm: renamed pyterm.py to pyterm 2014-08-01 17:09:45 +02:00
Oleg Hahm
af24a947f6 pyterm: make Guido happy 2014-08-01 17:09:45 +02:00
Oleg Hahm
73f6a0c518 pyterm: split connect and set_baudrate
Apparently, opening and setting the baudrate at the same time creates
problem for certain platforms (Arduino-Due).
2014-08-01 17:09:45 +02:00
Oleg Hahm
af5291b7d7 pyterm: handle TCP connection errors 2014-08-01 17:09:45 +02:00
Oleg Hahm
8b9c54efae pyterm: make formatting string configurable 2014-08-01 17:09:45 +02:00
Oleg Hahm
a0f43ba736 pyterm: outsource serial connect to a separate function 2014-08-01 17:09:45 +02:00
Oleg Hahm
8c84df391e pyterm: added license 2014-08-01 17:09:45 +02:00