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 6BDA7C433EF for ; Sun, 6 Mar 2022 13:12:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 362BB83A27; Sun, 6 Mar 2022 14:12:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="O2488mN0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 47AF0837EC; Sun, 6 Mar 2022 14:12:12 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D529483A27 for ; Sun, 6 Mar 2022 14:12:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPSA id 354AE140439; Sun, 6 Mar 2022 14:12:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1646572328; bh=otGJWxhmSk+nFAX7L3nUNb5zdCNNwI2WPCxA0kUWRhI=; h=Date:From:To; b=O2488mN09tfOcJpryOCn1ppaetGqA62YuBWyZLtva467hsltm+4oy4RjI1Hg96B53 9yLG1aFV4pZYBI6cJK5zxYoO6GmUtzTX9b8uLeSd+7BJDl9TK5gD1/4eJRtbGPXTMt AVEo+V0ka5s4wm9ONZ+rxw+4+ifthMXKKBvGjQhI= Date: Sun, 6 Mar 2022 14:12:02 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: [PATCH] tools: kwboot: Check if baudrate value is supported before sending image Message-ID: <20220306141202.28cbe8a3@thinkpad> In-Reply-To: <20220306123907.24798-1-pali@kernel.org> References: <20220306123907.24798-1-pali@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 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 On Sun, 6 Mar 2022 13:39:07 +0100 Pali Roh=C3=A1r 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. >=20 > 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. >=20 > 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. >=20 > 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 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" >=20 > Signed-off-by: Pali Roh=C3=A1r > --- > tools/kwboot.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > 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; > =20 > - tty =3D kwboot_open_tty(ttypath, imgpath ? 115200 : baudrate); > + tty =3D kwboot_open_tty(ttypath, baudrate); > if (tty < 0) { > perror(ttypath); > goto out; > } > =20 > + /* > + * 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 !=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; Marek