From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94878C433EF for ; Sun, 6 Mar 2022 22:39:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 43AEE83B7D; Sun, 6 Mar 2022 23:39:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ovtTpLSi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 549C783A8A; Sun, 6 Mar 2022 23:39:13 +0100 (CET) Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4A3B783B7D for ; Sun, 6 Mar 2022 23:39:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mibodhi@gmail.com Received: by mail-yb1-xb2e.google.com with SMTP id u61so27537006ybi.11 for ; Sun, 06 Mar 2022 14:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rotI0/TdE0MAm5Bn+6rlHL7ihJcR2w8Vs3Voh+bAsg0=; b=ovtTpLSix19ydipfrSsOi9dH11qXgt5KxaXsTdFu/YaSfG8+PqZ7R5AFBWI3RIQUJF /8JXHMe2+S6MsY6fV3O8+lnu1EzelLsiWfqDjKita5joWXkBx++b0qrolkpgXVan6sRM 7hf1RrbDSFtLEQ0+EZ7BlmctgsPmVV3YE56EXIpTUiFKQBB3DFk3LCZqhJY4hL79dBEc vBvLhA5Nw9gIwnldVVZ7W3LsDZlCSABD3jqBtLGMBXrD6jRo65E07uYMA+bete6t4uIf pNnb5d9JZDRKFNDd22XhTQsQOGRAzwxEtFqjAq0/Mp3bLS3iDP+JNzFcG/ba0K9506tD AQew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=rotI0/TdE0MAm5Bn+6rlHL7ihJcR2w8Vs3Voh+bAsg0=; b=Juq0xlIQdB65sc3Erby8B5OL3sX/X5Sw719gbuC2y0e/s5lL9ioZPQ6GU28VV8nExY QoYYnjbbHbRp2KXgkirn2o/QYM+0S9KAb27n75FX58qfIJWgOlDgqJqccbLBfXUM31WA o0VhIMiBRXoHykbX2lywbivKIAr0zbYtHhdLP3FF6wQJMt4H+u8qliqzg5ahlMAeIAa4 pPX/ce5IKT5MYfF8vKiM8sty/FugRpuaOzyJCy6RXwKQFOIkr4DJjcXZXs0jo4TQ2Prg cUM9E1yvxc51QFcNqSEki3DNHD9JAWb/INnxWFcJEggibMYJxbxDuwCQqf7uP7Jt/oIa P2eQ== X-Gm-Message-State: AOAM530XrZofvws7iEUNvzaB0CoG3QHJ7kJI0S8W1+rUcky7YDC4uav+ MlMILPjg2uh7ZiCqhGhMM21iuGIbunHjV7oW8z9Y5lCB X-Google-Smtp-Source: ABdhPJzUYJWfwjNhaNEbuVg6R1Xkz8hKoQWP0zzEUzUJZoqsJpBqQHWWhGx3zli6uHdB6MDj7HpkiE8hh2eNUQS/IjU= X-Received: by 2002:a25:8146:0:b0:629:2cb0:88ad with SMTP id j6-20020a258146000000b006292cb088admr3408656ybm.217.1646606347982; Sun, 06 Mar 2022 14:39:07 -0800 (PST) MIME-Version: 1.0 References: <20220306123907.24798-1-pali@kernel.org> In-Reply-To: <20220306123907.24798-1-pali@kernel.org> From: Tony Dinh Date: Sun, 6 Mar 2022 14:38:57 -0800 Message-ID: Subject: Re: [PATCH] tools: kwboot: Check if baudrate value is supported before sending image To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: Stefan Roese , =?UTF-8?B?TWFyZWsgQmVow7pu?= , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Pali, I have an observation, which is not related to this patch. But about the kwboot options changes in general, I hope it is OK to mention it here. Before the changes you've made to solve the problem with the -b option, I can do this: kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.kwb But now, the -b option can not be used after the tty device name. All options must appear before the tty device. Is this the actual intention? it did break some of my existing aliases/scripts (It is not a big deal to retrofit them). Just want to make sure I understand the reason to make the tty device a positional argument for kwboot. Thanks, Tony On Sun, Mar 6, 2022 at 4:39 AM Pali Roh=C3=A1r wrote: > > Call kwboot_open_tty() which baudrate value which was specified at the > 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. > > Before this change, kwboot sent kwbimage header (at 115200 Bd) and then > validated that selected baudrate if is supported by tty device. It consum= ed > too much time (need to send kwbimage again and again) until some supporte= d > baudrate by local tty device was guessed. > > Signed-off-by: Pali Roh=C3=A1r > --- > 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 !=3D argc) > goto usage; > > - tty =3D kwboot_open_tty(ttypath, imgpath ? 115200 : baudrate); > + tty =3D 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 > + */ > + if (imgpath && baudrate !=3D 115200) { > + rc =3D kwboot_tty_change_baudrate(tty, 115200); > + if (rc) { > + perror(ttypath); > + goto out; > + } > + } > + > if (baudrate =3D=3D 115200) > /* do not change baudrate during Xmodem to the same value= */ > baudrate =3D 0; > -- > 2.20.1 >