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 0FC8CC28CF5 for ; Wed, 26 Jan 2022 15:45:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E510C81F7E; Wed, 26 Jan 2022 16:42:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1643211772; bh=KkhrzbQXxlR75d+ZhiqqrkTODXwHA5is1xwvUYMsqB4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=0CiJonlF7iN73DWrTLCAiWOY8An1lOzhFcq0XnSvV1s2hQeL3T4y0hgAiUR72OX0H PGLxknNVWbjDGCnajbYpNsCndxLg04/KrbC/Ln3/aA+nb7Etw1s1cOdWY30kiTa57e aTq1FNpwi0VJRGUhg46M1WJ4OrGlbXCf0MoUIks8nO3O9B/omPZTlvmaPdTgflNmz7 dUsi6YJcseAXn9xTqVlLLguYiE/HPia47bTfu1GVnkp1W2WO59mNBeCosljM1LXz7O ZWH09f0Wjxf4UGqu2G9325dKlcjX3/aKbx/sDD8KHcrKrXdX7Rp1d+FIH4Qlxtl+YJ AfGX3yAceIPkQ== Received: by phobos.denx.de (Postfix, from userid 109) id 2821383841; Wed, 26 Jan 2022 16:40:09 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [91.198.250.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8885C838E3 for ; Wed, 26 Jan 2022 16:40:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (unknown [91.198.250.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4JkSb40xGJz9skp; Wed, 26 Jan 2022 16:40:00 +0100 (CET) Message-ID: Date: Wed, 26 Jan 2022 16:39:55 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell 08/14] tools: kwboot: Allow to use option -b without image path Content-Language: en-US To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: u-boot@lists.denx.de, pali@kernel.org, =?UTF-8?Q?Marek_Beh=c3=ban?= References: <20220125171313.14498-1-kabel@kernel.org> <20220125171313.14498-9-kabel@kernel.org> From: Stefan Roese In-Reply-To: <20220125171313.14498-9-kabel@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 1/25/22 18:13, Marek Behún wrote: > From: Pali Rohár > > Allow option -b without image path parameter, to send boot pattern and > wait for response but not send any image. This allows to use kwboot just > for processing boot pattern and user can use any other xmodem tool for > transferring the image itself (e.g. sx). Useful for debugging purposes. > > Signed-off-by: Pali Rohár > Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwboot.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/tools/kwboot.c b/tools/kwboot.c > index 1dcec1969a..c413a8bf51 100644 > --- a/tools/kwboot.c > +++ b/tools/kwboot.c > @@ -1699,6 +1699,8 @@ main(int argc, char **argv) > size_t size; > size_t after_img_rsv; > int baudrate; > + int prev_optind; > + int c; > > rv = 1; > tty = -1; > @@ -1716,22 +1718,32 @@ main(int argc, char **argv) > kwboot_verbose = isatty(STDOUT_FILENO); > > do { > - int c = getopt(argc, argv, "hb:ptaB:dD:q:s:o:"); > + prev_optind = optind; > + c = getopt(argc, argv, "hbptaB:dD:q:s:o:"); > if (c < 0) > break; > > switch (c) { > case 'b': > + if (imgpath || bootmsg || debugmsg) > + goto usage; > bootmsg = kwboot_msg_boot; > - imgpath = optarg; > + if (prev_optind == optind) > + goto usage; > + if (argv[optind] && argv[optind][0] != '-') > + imgpath = argv[optind++]; > break; > > case 'D': > + if (imgpath || bootmsg || debugmsg) > + goto usage; > bootmsg = NULL; > imgpath = optarg; > break; > > case 'd': > + if (imgpath || bootmsg || debugmsg) > + goto usage; > debugmsg = kwboot_msg_debug; > break; > > @@ -1774,11 +1786,11 @@ main(int argc, char **argv) > if (!bootmsg && !term && !debugmsg) > goto usage; > > - if (argc - optind < 1) > - goto usage; > - > ttypath = argv[optind++]; > > + if (optind != argc) > + goto usage; > + > tty = kwboot_open_tty(ttypath, imgpath ? 115200 : baudrate); > if (tty < 0) { > perror(ttypath); Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de