Add barebox remote control

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 10 23:54:06 PDT 2015


There's often the desire to control barebox from scripts on a remote
host. Currently this means matching the console output for something
that looks like a prompt, then sending commands to the shell and parsing
the output again. This is quite error prone and fragile, so here is
another approach:

Back in the eighties RFC916 was posted which describes a reliable packet
based communication over serial lines: The reliable asynchronous transfer
protocol (RATP). This series implements this protocol and uses it to transfer
command messages to barebox and the result back to the host. A sample
invocation of the host tool looks like:

# ./scripts/bbremote --port rfc2217://rl3:4006 run ls
console: '.      '
console: '..     '
console: 'dev    '
console: 'env    '
console: 'mnt    '
console: '\n'
Result: BBPacketCommandReturn(exit_code=0)

This is all in an early stadium, we'll probably do some iterations before
we merge this, but to some extend it's already useful and maybe someone
else is also interested, so we decided to post it now.

Sascha

----------------------------------------------------------------
Jan Luebbe (2):
      include pyserial trunk
      host side for barebox remote control

Sascha Hauer (2):
      Add Reliable Asynchronous Transfer Protocol
      barebox remote control

 .gitignore                                    |    1 +
 common/Kconfig                                |   10 +
 common/Makefile                               |    2 +
 common/console.c                              |   54 +-
 common/hush.c                                 |    5 +
 common/ratp.c                                 |  257 ++++
 common/startup.c                              |    6 +
 crypto/Kconfig                                |    1 +
 include/console.h                             |    3 +
 include/ratp.h                                |   80 ++
 lib/Kconfig                                   |    8 +
 lib/Makefile                                  |    1 +
 lib/ratp.c                                    | 1612 +++++++++++++++++++++++++
 lib/readline.c                                |    3 +
 scripts/bbremote                              |    3 +
 scripts/remote/__init__.py                    |    0
 scripts/remote/main.py                        |   57 +
 scripts/remote/messages.py                    |  182 +++
 scripts/remote/missing.py                     |   28 +
 scripts/remote/ratp.py                        |  747 ++++++++++++
 scripts/serial/__init__.py                    |   79 ++
 scripts/serial/rfc2217.py                     | 1327 ++++++++++++++++++++
 scripts/serial/serialcli.py                   |  284 +++++
 scripts/serial/serialposix.py                 |  730 +++++++++++
 scripts/serial/serialutil.py                  |  572 +++++++++
 scripts/serial/tools/__init__.py              |    0
 scripts/serial/tools/list_ports.py            |  103 ++
 scripts/serial/tools/list_ports_linux.py      |  152 +++
 scripts/serial/urlhandler/__init__.py         |    0
 scripts/serial/urlhandler/protocol_hwgrep.py  |   45 +
 scripts/serial/urlhandler/protocol_loop.py    |  279 +++++
 scripts/serial/urlhandler/protocol_rfc2217.py |   11 +
 scripts/serial/urlhandler/protocol_socket.py  |  291 +++++
 33 files changed, 6931 insertions(+), 2 deletions(-)
 create mode 100644 common/ratp.c
 create mode 100644 include/ratp.h
 create mode 100644 lib/ratp.c
 create mode 100755 scripts/bbremote
 create mode 100644 scripts/remote/__init__.py
 create mode 100644 scripts/remote/main.py
 create mode 100644 scripts/remote/messages.py
 create mode 100644 scripts/remote/missing.py
 create mode 100644 scripts/remote/ratp.py
 create mode 100644 scripts/serial/__init__.py
 create mode 100644 scripts/serial/rfc2217.py
 create mode 100644 scripts/serial/serialcli.py
 create mode 100644 scripts/serial/serialposix.py
 create mode 100644 scripts/serial/serialutil.py
 create mode 100644 scripts/serial/tools/__init__.py
 create mode 100644 scripts/serial/tools/list_ports.py
 create mode 100644 scripts/serial/tools/list_ports_linux.py
 create mode 100644 scripts/serial/urlhandler/__init__.py
 create mode 100644 scripts/serial/urlhandler/protocol_hwgrep.py
 create mode 100644 scripts/serial/urlhandler/protocol_loop.py
 create mode 100644 scripts/serial/urlhandler/protocol_rfc2217.py
 create mode 100644 scripts/serial/urlhandler/protocol_socket.py



More information about the barebox mailing list