From: "Marek Behún" <marek.behun@nic.cz>
To: "Pali Rohár" <pali@kernel.org>
Cc: Stefan Roese <sr@denx.de>, u-boot@lists.denx.de
Subject: Re: [PATCH] tools: kwboot: Check if baudrate value is supported before sending image
Date: Sun, 6 Mar 2022 14:12:02 +0100 [thread overview]
Message-ID: <20220306141202.28cbe8a3@thinkpad> (raw)
In-Reply-To: <20220306123907.24798-1-pali@kernel.org>
On Sun, 6 Mar 2022 13:39:07 +0100
Pali Rohár <pali@kernel.org> wrote:
> Call kwboot_open_tty() which baudrate value which was specified at the
with
> command line by option -B. This function returns error if baudrate is not
> supported by selected tty device.
>
> Initial baudrate for image transfer is always 115200, so call
> kwboot_tty_change_baudrate() with value 115200 immediately after
> kwboot_open_tty() if baudrate specified by option -B is different than
> 115200.
>
> This help user to see error message about unsupported baudrate value by
> local tty device immediately after starting kwboot.
This makes kwboot fail immediately, informing that baudrate is
unsupported, instead of failing only after the first part of image is
already sent.
>
> Before this change, kwboot sent kwbimage header (at 115200 Bd) and then
> validated that selected baudrate if is supported by tty device. It consumed
> too much time (need to send kwbimage again and again) until some supported
> baudrate by local tty device was guessed.
This last paragraph can be dropped. If you want to keep it, please
change "Before this change" to "Until now"
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> tools/kwboot.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index f975c4a6c6ca..d9498af8fc02 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -2137,12 +2137,24 @@ main(int argc, char **argv)
> if (optind != argc)
> goto usage;
>
> - tty = kwboot_open_tty(ttypath, imgpath ? 115200 : baudrate);
> + tty = kwboot_open_tty(ttypath, baudrate);
> if (tty < 0) {
> perror(ttypath);
> goto out;
> }
>
> + /*
> + * initial baudrate for image transfer is always 115200,
> + * change to different baudrate is done after sending header
*the change to different baudrate is done only after the header is sent
> + */
> + if (imgpath && baudrate != 115200) {
> + rc = kwboot_tty_change_baudrate(tty, 115200);
> + if (rc) {
> + perror(ttypath);
> + goto out;
> + }
> + }
> +
> if (baudrate == 115200)
> /* do not change baudrate during Xmodem to the same value */
> baudrate = 0;
Marek
next prev parent reply other threads:[~2022-03-06 13:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 12:39 [PATCH] tools: kwboot: Check if baudrate value is supported before sending image Pali Rohár
2022-03-06 13:12 ` Marek Behún [this message]
2022-03-06 22:38 ` Tony Dinh
2022-03-07 11:40 ` kwboot - positional tty argument Pali Rohár
2022-03-07 14:39 ` Stefan Roese
2022-03-07 16:45 ` Marek Behún
2022-03-07 17:41 ` Pali Rohár
2022-03-08 6:15 ` Tony Dinh
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=20220306141202.28cbe8a3@thinkpad \
--to=marek.behun@nic.cz \
--cc=pali@kernel.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.