From: Sascha Hauer <s.hauer@pengutronix.de>
To: Peter Korsgaard <peter@korsgaard.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/4] barebox remote control
Date: Mon, 15 Jun 2015 06:51:39 +0200 [thread overview]
Message-ID: <20150615045139.GI6325@pengutronix.de> (raw)
In-Reply-To: <87fv5xi56n.fsf@dell.be.48ers.dk>
Hi Peter,
On Fri, Jun 12, 2015 at 12:36:48PM +0200, Peter Korsgaard wrote:
> >>>>> "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:
>
> Hi,
>
> > This adds the ability to control barebox over serial lines. The regular
> > console is designed for human input and is unsuitable for controlling
> > barebox from scripts since characters can be lost on both ends, the data
> > stream contains escape sequences and the prompt cannot be easily matched
> > upon.
> > This approach is based on the RATP protocol. RATP packages start with a
> > binary 0x01 which does not occur in normal console data. Whenever a
> > 0x01 character is detected in the console barebox goes into RATP mode.
> > The RATP packets contain a simple structure with a command/respone
> > type and data for that type. Currently defined types are:
>
>
> > +int barebox_ratp(struct console_device *cdev)
> > +{
> > + void *buf = xmalloc(512);
> > + int ret;
> > + size_t len;
> > + struct ratp_ctx *ctx;
> > + struct ratp *ratp;
> > +
> > + ctx = xzalloc(sizeof(*ctx));
> > + ratp = &ctx->ratp;
> > +
> > + ratp->send = ratp_send;
> > + ratp->recv = ratp_recv;
> > + ctx->cdev = cdev;
> > +
> > + ret = ratp_establish(ratp, false, 0);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = ratp_console_register(ctx);
> > + if (ret)
> > + return ret;
>
> You're leaking ctx and buf here (and buf below as well).
Thanks, will fix.
>
> > +
> > + while (1) {
> > + ret = ratp_poll(ratp);
> > + if (ret == -EINTR)
> > + goto out;
> > + if (ratp_closed(ratp))
> > + goto out;
> > +
> > + len = 512;
> > + ret = ratp_recv_data(ratp, buf, &len);
> > + if (ret == -EAGAIN)
> > + continue;
> > +
> > + if (ret < 0)
> > + goto out;
> > +
> > + ret = ratp_bb_dispatch(ctx, buf, len);
> > + if (ret)
> > + break;
> > + }
> > +out:
> > +
> > + console_unregister(&ctx->ratp_console);
> > +
> > + free(ctx);
> > +
> > + return ret;
> > +}
>
>
> > +++ b/crypto/Kconfig
> > @@ -2,6 +2,7 @@ config CRC32
> > bool
>
> > config CRC16
> > + default y
>
> Why?
This is not necessary, it's a leftover from development.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-06-15 4:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 6:54 Add " Sascha Hauer
2015-06-11 6:54 ` [PATCH 1/4] Add Reliable Asynchronous Transfer Protocol Sascha Hauer
2015-06-12 12:05 ` Peter Korsgaard
2015-06-15 5:12 ` Sascha Hauer
2015-06-15 7:19 ` Peter Korsgaard
2015-06-17 5:45 ` Sascha Hauer
2015-06-11 6:54 ` [PATCH 2/4] barebox remote control Sascha Hauer
2015-06-12 10:36 ` Peter Korsgaard
2015-06-15 4:51 ` Sascha Hauer [this message]
2015-06-11 6:54 ` [PATCH 3/4] include pyserial trunk Sascha Hauer
2015-06-11 15:48 ` Uwe Kleine-König
2015-06-11 6:54 ` [PATCH 4/4] host side for barebox remote control Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150615045139.GI6325@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=peter@korsgaard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox