[PATCH v2 03/16] ratp: send missing RST in behavior C2

2017-06-21 Thread Aleksander Morgado
The reference says: If SYN was set we assume that the other end crashed and has attempted to open a new connection. We respond by sending a legal reset:

[PATCH v2 04/16] ratp: add missing RST flag in behavior G

2017-06-21 Thread Aleksander Morgado
The reference says: If the ACK flag was set then send:

[PATCH v2 00/16] RATP logic fixes and improvements

2017-06-21 Thread Aleksander Morgado
but the cat stdout messages via RATP go byte by byte...). After that, the additional read operations above offset 1024 end up timing out. I believe I'm going to have to work with RATFS in the near future, so I'll likely spend some time looking at those issues soon anyway. Aleksander Morgado (16):

[PATCH v2 06/16] ratp: fix data presence check

2017-06-21 Thread Aleksander Morgado
. This commit fixed a segfault in barebox when an unexpected SYN packet was sent in the middle of a connection; barebox thought the packet had data because the "data length" in the SYN packet was different than 0. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/

[PATCH v2 05/16] ratp: completely ignore RST flagged packets in behavior G

2017-06-21 Thread Aleksander Morgado
one had RST set. This commit fixes an infinite loop of messages sent and received between both ends during the connection close procedure, found when testing barebox against a third party ratp implementation. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 3

[PATCH v2 07/16] ratp: fix single byte sending flagged with SO

2017-06-21 Thread Aleksander Morgado
ommand specific header). Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index c946bea1a..846f8130c 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -384,6 +384,7 @

[PATCH v2 01/16] ratp: add missing transition to SYN-RECEIVED in behavior B

2017-06-21 Thread Aleksander Morgado
The reference says: If the SYN flag was set but the ACK was not set then the other end of the connection has executed an active open also. Acknowledge the SYN, choose your MDL, and send:

[PATCH v2 10/16] ratp: fix sending ACKs without data

2017-06-21 Thread Aleksander Morgado
All ACKs without data must be built in the same way from the input message:

[PATCH v2 11/16] ratp: consolidate ratp_sn_expected() and ratp_an_expected()

2017-06-21 Thread Aleksander Morgado
This is no code change in ratp_sn_expected(), it's just rewritten in the same way as ratp_an_expected(), which follows the RFC916 approach. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ra

[PATCH v2 08/16] ratp: remove bogus data checks in behavior C2

2017-06-21 Thread Aleksander Morgado
one. These two fixes are a cleanup to follow the protocol correctly. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 8 +--- scripts/remote/ratp.py | 16 +--- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/ratp.c

[PATCH v2 02/16] ratp: avoid unnecessary variable initializations

2017-06-21 Thread Aleksander Morgado
This is just a cleanup; the variables are completely initialized later on so the initial values are totally discarded anyway. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ratp.c

[PATCH v2 15/16] ratp: consolidate setting the next AN or SN flags

2017-06-21 Thread Aleksander Morgado
is desired, and also hide the computation of the actual flag value within the macro, so the previous example would now look like: ratp_set_next_an(ratp_sn(hdr)); Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 30 -- 1 file chang

[PATCH v2 14/16] ratp: don't ignore data that may arrive in behaviour H1

2017-06-21 Thread Aleksander Morgado
letely established, but it allows third party ratp implementations to do that. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 8 +++- scripts/remote/ratp.py | 14 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/

[PATCH v2 16/16] ratp: user close may happen in SYN-RECEIVED state

2017-06-21 Thread Aleksander Morgado
close. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 2 +- scripts/remote/ratp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index 46a82c69a..e7fbf640a 100644 --- a/lib/ratp.c +++ b/lib/

[PATCH v2 09/16] ratp: remove FIXME comment: FIN always requires ACK

2017-06-21 Thread Aleksander Morgado
Section 3.4 in the RFC916 shows a packet flow for the connection close where the initial packet sent by the endpoint starting the close has just the FIN flag set, without an ACK: -->

[PATCH v2 12/16] ratp: prefer using ratp_send_ack() in behaviour I1

2017-06-21 Thread Aleksander Morgado
Instead of manually constructing an ACK, use the ratp_send_ack() method, which already does that properly. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c

[PATCH v2 13/16] ratp: send initial data in behaviour B if any pending

2017-06-21 Thread Aleksander Morgado
And also, use ratp_send_ack() instead of manually constructing an ACK if no data is pending to be sent. The current barebox implementation doesn't allow any queueing of data until the connection is established, so this is probably not a case that would get run anyway. Signed-off-by: Aleksander

[PATCH] Documentation: remote-control: fix typo

2017-05-30 Thread Aleksander Morgado
Correctly reference `--port` instead of `--baudrate` when explaining how to specify the port. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- Documentation/user/remote-control.rst | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentatio

[PATCH 0/2] Enabling support for the FIFO based console in sandbox

2017-05-31 Thread Aleksander Morgado
think? Aleksander Morgado (2): sandbox: fix registering multiple consoles sandbox: --stdin and --stdout allow max one bidirectional console arch/sandbox/board/console.c | 5 ++- arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +- arch/sandbox/os/common.c

[PATCH 2/2] sandbox: --stdin and --stdout allow max one bidirectional console

2017-05-31 Thread Aleksander Morgado
tivated (CONFIG_CONSOLE_ACTIVATE_ALL=n), the default stdin/stdout console will be preferred instead of the new FIFO/file based, which would need to be activated explicitly later on. e.g.: barebox@barebox sandbox:/ cs1.active=ioe Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- ar

[PATCH 1/2] sandbox: fix registering multiple consoles

2017-05-31 Thread Aleksander Morgado
so that a new unique device id is given to each newly registered console device. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- arch/sandbox/board/console.c | 5 ++--- arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +- arch/sandbox/os/common.c

[PATCH] sandbox: new --stdinout option to enable a bidirectional console

2017-06-02 Thread Aleksander Morgado
In addition to allowing read-only and write-only consoles with --stdin and --stdout, we now allow bidirectional read/write consoles with FIFO files. This is e.g. to allow doing RATP over the FIFO based consoles. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- arch/sand

[PATCH] ratp: avoid using already freed memory

2017-06-02 Thread Aleksander Morgado
If ratp_establish() fails we would be accessing the ratp_internal struct after having disposed it. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index d59

RFC: barebox RATP C library?

2017-06-05 Thread Aleksander Morgado
Hey, I've been playing a bit with the possibility of having a C library to talk RATP with barebox, totally equivalent to what bbremote does in python, but as a general C lib with a stable API that may be integrated in other C/C++ applications. >From my POV I see two options to try: a) build a

Re: [PATCH] Documentation: remote-control: fix typo

2017-06-01 Thread Aleksander Morgado
On Thu, Jun 1, 2017 at 2:31 PM, Sascha Hauer <s.ha...@pengutronix.de> wrote: >> >> Correctly reference `--port` instead of `--baudrate` when explaining >> >> how to specify the port. >> >> >> >> Signed-off-by: Aleksander Morgado <alek

Re: [PATCH] Documentation: remote-control: fix typo

2017-06-01 Thread Aleksander Morgado
On Thu, Jun 1, 2017 at 9:30 AM, Sascha Hauer <s.ha...@pengutronix.de> wrote: > On Tue, May 30, 2017 at 11:46:34PM +0200, Aleksander Morgado wrote: >> Correctly reference `--port` instead of `--baudrate` when explaining >> how to specify the port. >> >>

Re: [PATCH] sandbox: new --stdinout option to enable a bidirectional console

2017-06-06 Thread Aleksander Morgado
the FIFO based consoles. >> >> Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> >> --- >> arch/sandbox/os/common.c | 53 >> ++-- >> 1 file changed, 42 insertions(+), 11 deletions(-) > > Appli

[PATCH] ratp: only allow bidirectional consoles

2017-06-06 Thread Aleksander Morgado
=active@entry=false, timeout_ms=timeout_ms@entry=100) at lib/ratp.c:1645 #6 0x0040b888 in barebox_ratp (cdev=cdev@entry=0x77212bd0) at common/ratp.c:470 #7 0x004046c3 in getc_raw () at common/console.c:416 ... Signed-off-by: Aleksander Morgado <alek

[PATCH 06/16] ratp: fix data presence check

2017-06-15 Thread Aleksander Morgado
ve data. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 4 ++-- scripts/remote/ratp.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index d3c252047..c946bea1a 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -1

[PATCH 03/16] ratp: send missing RST in behavior C2

2017-06-15 Thread Aleksander Morgado
The reference says: If SYN was set we assume that the other end crashed and has attempted to open a new connection. We respond by sending a legal reset:

[PATCH 05/16] ratp: completely ignore RST flagged packets in behavior G

2017-06-15 Thread Aleksander Morgado
one had RST set. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ratp.c b/lib/ratp.c index 43b8b04dc..d3c252047 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -1033,6 +1033,9 @@ static int ratp_behaviour_g(

[PATCH 04/16] ratp: add missing RST flag in behavior G

2017-06-15 Thread Aleksander Morgado
The reference says: If the ACK flag was set then send:

[PATCH 00/16] RATP logic fixes and improvements

2017-06-15 Thread Aleksander Morgado
Hey Sascha, I went through the RFC916 and ended up preparing a set of fixes and improvements for the RATP logic in barebox. Let me know what you think. Cheers! Aleksander Morgado (16): ratp: add missing transition to SYN-RECEIVED in behavior B ratp: avoid unnecessary variable

libratp, libratp-barebox and ratp-barebox-cli

2017-06-15 Thread Aleksander Morgado
Hey, For anyone interested, I ended up preparing a pair of C libraries and a CLI tool that allow controlling barebox remotely using RATP, in the same way as bbremote does it. The libraries would allow easy integration on C applications that may want to remotely control barebox. Repositories:

[PATCH 16/16] ratp: user close may happen in SYN-RECEIVED state

2017-06-15 Thread Aleksander Morgado
The reference says: 5.2.3. SYN-RECEIVED ... Departures - A CLOSE request is made by the user. Create a packet with FIN set. Send it and go to the FIN-WAIT state. Add this missing step. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/

[PATCH 14/16] ratp: don't ignore data that may arrive in behaviour H1

2017-06-15 Thread Aleksander Morgado
and execute procedure I1 to process any data which might be in this packet. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 8 +++- scripts/remote/ratp.py | 14 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/

[PATCH 15/16] ratp: consolidate setting the next AN or SN flags

2017-06-15 Thread Aleksander Morgado
is desired, and also hide the computation of the actual flag value within the macro, so the previous example would now look like: ratp_set_next_an(ratp_sn(hdr)); Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 30 -- 1 file chang

[PATCH 10/16] ratp: fix sending ACKs without data

2017-06-15 Thread Aleksander Morgado
All ACKs without data must be built in the same way from the input message:

[PATCH 08/16] ratp: remove bogus data checks in behavior C2

2017-06-15 Thread Aleksander Morgado
one. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 8 +--- scripts/remote/ratp.py | 16 +--- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index 846f8130c..321721ab7 100644 --- a/lib/ratp.c

[PATCH 11/16] ratp: consolidate ratp_sn_expected() and ratp_an_expected()

2017-06-15 Thread Aleksander Morgado
This is no code change in ratp_sn_expected(), it's just rewritten in the same way as ratp_an_expected(), which follows the RFC916 approach. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ra

[PATCH 01/16] ratp: add missing transition to SYN-RECEIVED in behavior B

2017-06-15 Thread Aleksander Morgado
The reference says: If the SYN flag was set but the ACK was not set then the other end of the connection has executed an active open also. Acknowledge the SYN, choose your MDL, and send:

[PATCH 02/16] ratp: avoid unnecessary variable initializations

2017-06-15 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c index 0d384aa4e..e9536499e 100644 --- a/lib/ratp.c +++ b/lib/ratp.c @@ -382,7 +382,7 @@ static int ratp_send_ack(

[PATCH 07/16] ratp: fix single byte sending flagged with SO

2017-06-15 Thread Aleksander Morgado
When a single data byte is sent, it is flagged as SO and the actual data goes in the length byte within the header. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ratp.c b/lib/

[PATCH 09/16] ratp: remove FIXME comment: FIN always requires ACK

2017-06-15 Thread Aleksander Morgado
Section 3.4 in the RFC916 shows a packet flow for the connection close where the initial packet sent by the endpoint starting the close has just the FIN flag set, without an ACK: -->

[PATCH 12/16] ratp: prefer using ratp_send_ack() in behaviour I1

2017-06-15 Thread Aleksander Morgado
Instead of manually constructing an ACK, use the ratp_send_ack() method, which already does that properly. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- lib/ratp.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/ratp.c b/lib/ratp.c

Re: [PATCH 00/16] RATP logic fixes and improvements

2017-06-19 Thread Aleksander Morgado
Hey, On 19/06/17 08:46, Sascha Hauer wrote: >> I went through the RFC916 and ended up preparing a set of fixes and >> improvements for the RATP logic in barebox. >> Let me know what you think. > As far as I can say the patches look good. It's quite a while since I > last looked at the RATP code,

[PATCH] console_countdown: ignore errors in getchar()

2017-09-20 Thread Aleksander Morgado
interfering with the countdown and menu just when switching one of the consoles to RATP mode. As a hint, this is what the standard console was printing due to this issue when the RATP console was activated: Hit m for menu or any other key to stop autoboot: [: missing `]' Signed-off-by: Aleksander

[PATCH] ratp: move barebox-specific command to ratp_bb.h

2018-01-28 Thread Aleksander Morgado
The ratp_run_command() is really an implementation detail of the barebox ratp 'command' operation support. Move it to the barebox specific header and rename it with the correct prefix. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c | 2 +- include/

[PATCH] ratp: remove unused list pointer from ratp_bb_pkt

2018-01-28 Thread Aleksander Morgado
This struct type is used in the RATP FS implementation, but was never used as a list element anywhere. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- include/ratp_bb.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/ratp_bb.h b/include/ratp_bb.h index 70f

[PATCH 06/10] ratp: implement generic command support

2018-02-02 Thread Aleksander Morgado
). Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- arch/arm/lib32/barebox.lds.S | 4 + arch/arm/lib64/barebox.lds.S | 4 + arch/blackfin/boards/ipe337/barebox.lds.S | 5 +- arch/mips/lib/barebox.lds.S | 4 + arch/nios2/cpu/barebox

[RFC PATCH 00/10] ratp: new generic RATP command support

2018-02-02 Thread Aleksander Morgado
how many other RATP API users are around except for bbremote (ported along with the changes) and the libratp-barebox I'm writing. Aleksander Morgado (10): ratp: define message type flags ratp: port command operation to req/rsp/ind format ratp: port ping operation to req/rsp format ratp

[PATCH 10/10] ratp: new md and mw commands

2018-02-02 Thread Aleksander Morgado
u': 0x0107 (+5 bytes) 00:00:00:00:00 Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- commands/md.c | 209 ++ commands/mw.c | 150 ++- include/ratp_bb.h | 2 + 3 files changed, 3

[PATCH 09/10] ratp: new reset command

2018-02-02 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- commands/reset.c | 48 +--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/commands/reset.c b/commands/reset.c index 6eac53262..7971b9f2f 100644 --- a/commands/r

[PATCH 02/10] ratp: port command operation to req/rsp/ind format

2018-02-02 Thread Aleksander Morgado
using the request, response and indication packet flags, and making them part of the same 'console' packet type. In this specific message type, indications may be sent in both directions. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c

[PATCH 03/10] ratp: port ping operation to req/rsp format

2018-02-02 Thread Aleksander Morgado
. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c| 12 ++-- scripts/remote/controller.py | 14 +++--- scripts/remote/messages.py | 18 ++ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/common/ra

[PATCH 01/10] ratp: define message type flags

2018-02-02 Thread Aleksander Morgado
. * Indications: messages generated by one RATP endpoint for which there is no need to generate an explicit response message. These message types are identified by new command flags. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c | 4 scripts/

[PATCH 04/10] ratp: port getenv operation to req/rsp format

2018-02-02 Thread Aleksander Morgado
using the request and response packet flags, and making them part of the same 'getenv' packet type. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c| 10 ++ scripts/remote/controller.py | 13 - scripts/remote/messages.py

[PATCH 05/10] ratp: port filesystem operation to req/rsp format

2018-02-02 Thread Aleksander Morgado
operation. We now consolidate this process using the request and response packet flags, and making them part of the same 'fs' packet type. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c| 9 ++--- scripts/remote/controller.p

[PATCH 08/10] ratp: implement getenv as a standard ratp command

2018-02-02 Thread Aleksander Morgado
Also, use xstrndup() instead of the custom xmemdup_add_zero() as we're working with strings anyway. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- commands/Makefile | 1 + commands/ratp-getenv.c | 50 ++ common/

[PATCH 07/10] ratp: implement ping as a standard ratp command

2018-02-02 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- commands/Makefile| 1 + commands/ratp-ping.c | 38 ++ common/ratp.c| 27 --- 3 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 co

[PATCH] ratp: rename global context variable

2018-01-28 Thread Aleksander Morgado
The 'ratp_command_ctx' seems to specify that this variable is only used to process command operations, but it really is used in every async operation (e.g. also in FS), so just rename it to a more generic name for clarity. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> ---

[PATCH] bbremote: rename command subparser variables

2018-01-28 Thread Aleksander Morgado
Don't reuse unrelated subparser variables for new command subparsers, make each subparser have its own variable. Just for consistency really, not a bugfix. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- scripts/remote/main.py | 14 +++--- 1 file changed, 7 inse

[PATCH] ratp: remove unused context fields

2018-01-29 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/common/ratp.c b/common/ratp.c index 6db4df870..80863f81f 100644 --- a/common/ratp.c +++ b/common/ratp.c @@ -54,14 +54,8 @@ struct ratp_bb_command_

[PATCH] of: base: fix segfault in of_get_machine_compatible()

2018-01-28 Thread Aleksander Morgado
() (gdb) fr 1 #1 0x5556fd91 in of_get_machine_compatible () at drivers/of/base.c:2380 2380 p = strchr(name, ','); Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- drivers/of/base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/of/

Re: [PATCH 07/10] ratp: implement ping as a standard ratp command

2018-02-06 Thread Aleksander Morgado
On Tue, Feb 6, 2018 at 10:33 AM, Sascha Hauer <s.ha...@pengutronix.de> wrote: > On Fri, Feb 02, 2018 at 12:14:39PM +0100, Aleksander Morgado wrote: >> Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> >> --- >> commands/Makefile|

Re: [RFC PATCH 00/10] ratp: new generic RATP command support

2018-02-06 Thread Aleksander Morgado
>> >> The first patches (1-5) break the current RATP API, by introducing >> the concept of requests, responses and indications: >> * Requests sent to one endpoint are expected to be replied with >>a response by the peer endpoint. >> * Indications are messages sent from one endpoint to

Re: [PATCH 06/10] ratp: implement generic command support

2018-02-06 Thread Aleksander Morgado
>> + >> +#define BAREBOX_RATP_CMD_START(_name) >> \ >> +extern const struct ratp_command __barebox_cmd_##_name; >> \ > > You shouldn't use the same name as the existing barebox commands, > otherwise there

[RFC PATCH v2 7/8] ratp: new md and mw commands

2018-02-08 Thread Aleksander Morgado
u': 0x0107 (+5 bytes) 00:00:00:00:00 Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 2 + common/ratp/md.c | 202 +++ common/ratp/mw.c | 173 +++ inclu

[RFC PATCH v2 5/8] ratp: implement getenv as a standard ratp command

2018-02-08 Thread Aleksander Morgado
Also, use xstrndup() instead of the custom xmemdup_add_zero() as we're working with strings anyway. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/getenv.c | 51 +++ common/ratp/

[RFC PATCH v2 4/8] ratp: implement ping as a standard ratp command

2018-02-08 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/ping.c | 40 common/ratp/ratp.c | 24 3 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 commo

[RFC PATCH v2 2/8] ratp: moved logic to its own subdirectory

2018-02-08 Thread Aleksander Morgado
We are going to add new RATP command implementations in separate files within this subdirectory. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/Kconfig | 13 + common/Makefile | 4 ++-- common/ratp/Kconfig | 14 ++

[RFC PATCH v2 1/8] ratp: implement generic command support

2018-02-08 Thread Aleksander Morgado
introduced are unique). Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- arch/arm/lib32/barebox.lds.S | 4 ++ arch/arm/lib64/barebox.lds.S | 4 ++ arch/blackfin/boards/ipe337/barebox.lds.S | 5 +- arch/mips/lib/barebox.lds.S | 4 ++

[RFC PATCH v2 6/8] ratp: use xstrndup() instead of a custom xmemdup_add_zero()

2018-02-08 Thread Aleksander Morgado
The console operations done via RATP expect strings, so just use xstrndup() instead of defining a custom method. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/ratp.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/commo

[RFC PATCH v2 8/8] ratp: new reset command

2018-02-08 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/reset.c | 55 include/ratp_bb.h| 1 + 3 files changed, 57 insertions(+) create mode 100644 common/ratp/reset.c diff --git a/

[RFC PATCH v2 0/8] ratp: new generic RATP command support

2018-02-08 Thread Aleksander Morgado
branch) in https://github.com/aleksander0m/libratp-barebox Aleksander Morgado (8): ratp: implement generic command support ratp: moved logic to its own subdirectory ratp: allow building without full console support ratp: implement ping as a standard ratp command ratp: implement getenv

[RFC PATCH v2 3/8] ratp: allow building without full console support

2018-02-08 Thread Aleksander Morgado
-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/Makefile| 1 - common/ratp/ratp.c | 7 +-- fs/Kconfig | 2 +- lib/Kconfig| 2 +- lib/readline.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/Makefile b/common/Makefile

[PATCH v3 7/9] ratp: new md and mw commands

2018-02-24 Thread Aleksander Morgado
bytes written $ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5 00 Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 2 + common/ratp/md.c | 202 +++ common/rat

[PATCH v3 8/9] ratp: new reset command

2018-02-24 Thread Aleksander Morgado
E.g.: $ ./bbremote -v --port /dev/ttyUSB2 reset Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/reset.c | 55 include/ratp_bb.h| 1 + scripts/

[PATCH v3 5/9] ratp: implement getenv as a standard ratp command

2018-02-24 Thread Aleksander Morgado
Also, use xstrndup() instead of the custom xmemdup_add_zero() as we're working with strings anyway. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/getenv.c | 51 +++ common/ratp/

[PATCH v3 6/9] ratp: use xstrndup() instead of a custom xmemdup_add_zero()

2018-02-24 Thread Aleksander Morgado
The console operations done via RATP expect strings, so just use xstrndup() instead of defining a custom method. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/ratp.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/commo

[PATCH v3 3/9] ratp: allow building without full console support

2018-02-24 Thread Aleksander Morgado
-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/Makefile| 1 - common/ratp/ratp.c | 7 +-- fs/Kconfig | 2 +- lib/Kconfig| 2 +- lib/readline.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/Makefile b/common/Makefile

[PATCH v3 9/9] docs: add reference to libratp-barebox in the remote-control docs

2018-02-24 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- Documentation/user/remote-control.rst | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Documentation/user/remote-control.rst b/Documentation/user/remote-control.rst index 217251429..c8b7442f1 100644 --- a/Documen

[PATCH v3 2/9] ratp: moved logic to its own subdirectory

2018-02-24 Thread Aleksander Morgado
We are going to add new RATP command implementations in separate files within this subdirectory. Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/Kconfig | 13 + common/Makefile | 4 ++-- common/ratp/Kconfig | 14 ++

[PATCH v3 4/9] ratp: implement ping as a standard ratp command

2018-02-24 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- common/ratp/Makefile | 1 + common/ratp/ping.c | 40 common/ratp/ratp.c | 24 3 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 commo

[PATCH v3 0/9] ratp: new generic RATP command support

2018-02-24 Thread Aleksander Morgado
-barebox-cli tools. Aleksander Morgado (9): ratp: implement generic command support ratp: moved logic to its own subdirectory ratp: allow building without full console support ratp: implement ping as a standard ratp command ratp: implement getenv as a standard ratp command ratp: use

[PATCH v3 1/9] ratp: implement generic command support

2018-02-24 Thread Aleksander Morgado
introduced are unique). Signed-off-by: Aleksander Morgado <aleksan...@aleksander.es> --- arch/arm/lib32/barebox.lds.S | 4 ++ arch/arm/lib64/barebox.lds.S | 4 ++ arch/blackfin/boards/ipe337/barebox.lds.S | 5 +- arch/mips/lib/barebox.lds.S | 4 ++

Re: [RFC PATCH v2 7/8] ratp: new md and mw commands

2018-02-21 Thread Aleksander Morgado
>> read and write memory files without needing to do custom string >> parsing on the data returned by the console 'md' and 'mw' operations. >> >> The request and response messages used for these new operations are >> structured in the same way: >> >> * An initial fixed-sized section includes the

Re: Cannot set GPIOs in barebox

2018-07-30 Thread Aleksander Morgado
Hey, > > This topic could be ignored. GPIO set/get value functions from > barebox are working fine BUT gpioinfo function has some bug it reports > unchanged status for gpios value. > Not that I got into much detail, but when I saw that same issue (I have some WIP patches to manage GPIOs via

[PATCH] bbremote: add missing 'md' packet handler

2018-08-21 Thread Aleksander Morgado
Signed-off-by: Aleksander Morgado --- scripts/remote/controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/remote/controller.py b/scripts/remote/controller.py index 2ed834613..1a8390904 100644 --- a/scripts/remote/controller.py +++ b/scripts/remote/controller.py @@ -46,6

[PATCH 2/2] i2c_read: implement support for master receive mode

2018-08-21 Thread Aleksander Morgado
If no start register is explicitly given, receive data in master receive mode. Signed-off-by: Aleksander Morgado --- commands/i2c.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/commands/i2c.c b/commands/i2c.c index 57dc092c2..2f7f820d4 100644

[PATCH 2/4] bbremote: implement i2c read/write support

2018-08-21 Thread Aleksander Morgado
i2c-write 0x00 0x68 0x06A0 0x01 "8f30" 4 bytes written $ ./scripts/bbremote --port /dev/ttyUSB2 i2c-read 0x00 0x68 0x06A0 0x01 4 8f300000 Signed-off-by: Aleksander Morgado --- scripts/remote/controller.py | 24 ++ scripts/remote/main.py | 37

[PATCH 3/4] ratp: implement support for GPIO commands

2018-08-21 Thread Aleksander Morgado
Introduce three new RATP commands that allow getting and setting GPIO values as well as configuring the direction of the GPIO pins. Signed-off-by: Aleksander Morgado --- common/ratp/Makefile | 1 + common/ratp/gpio.c | 148 +++ include/ratp_bb.h

[PATCH 1/2] i2c_write: document master send mode

2018-08-21 Thread Aleksander Morgado
When no explicit start register is given, the i2c message is emitted in master send mode. Signed-off-by: Aleksander Morgado --- commands/i2c.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/commands/i2c.c b/commands/i2c.c index f0d16af0c..57dc092c2 100644

i2c master send/receive mode

2018-08-21 Thread Aleksander Morgado
The i2c master send support was already implemented in the i2c_write command, but it was not properly documented. The first patch in the series addresses that. In the second patch, the i2c master receive mode is implemented in the i2c_read command. [PATCH 1/2] i2c_write: document master send

[PATCH 1/4] ratp: implement i2c read/write support

2018-08-21 Thread Aleksander Morgado
in the message flags field. If this flag is unset, the start register address is assumed 8-bit long. If the message includes the I2C_FLAG_MASTER_MODE flag, the start register field is ignored and a i2c master send/receive operation is performed. Signed-off-by: Aleksander Morgado --- common/ratp

RATP i2c and GPIO support

2018-08-21 Thread Aleksander Morgado
This patch series implements support for i2c and GPIO operations via RATP. [PATCH 1/4] ratp: implement i2c read/write support [PATCH 2/4] bbremote: implement i2c read/write support [PATCH 3/4] ratp: implement support for GPIO commands [PATCH 4/4] bbremote: implement support for GPIO

[PATCH 4/4] bbremote: implement support for GPIO operations

2018-08-21 Thread Aleksander Morgado
1 0 $ ./scripts/bbremote --port /dev/ttyUSB2 gpio-set-value 200 1 Signed-off-by: Aleksander Morgado --- scripts/remote/controller.py | 36 ++ scripts/remote/main.py | 37 ++ scripts/remote/messages.py | 93 3 files changed

Re: [PATCH 1/4] ratp: implement i2c read/write support

2018-08-23 Thread Aleksander Morgado
>> +struct ratp_bb_i2c_read_request { >> + struct ratp_bb header; >> + uint16_t buffer_offset; >> + uint8_t bus; >> + uint8_t addr; > > I wonder how we see the RATP support. If it's for adhoc debugging then > bus/addr is fine. The caller should have no expectations that the bus >

[PATCH] ratp: fix sending data that won't fit in a single RATP packet

2018-08-30 Thread Aleksander Morgado
We need to advance the input buffer used to create messages when the data doesn't fit in a single RATP packet. Signed-off-by: Aleksander Morgado --- include/ratp.h | 2 +- lib/ratp.c | 6 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/ratp.h b/include/ratp.h

[PATCH v2 7/7] ratp: fix incorrect whitespaces in method calls

2018-09-12 Thread Aleksander Morgado
This is a simple coding style fix to avoid the whitespace before the open-parenthesis in method calls. Signed-off-by: Aleksander Morgado --- common/ratp/getenv.c | 12 ++-- common/ratp/md.c | 8 common/ratp/mw.c | 6 +++--- common/ratp/reset.c | 4 ++-- 4 files

  1   2   >