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 X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CB23C4338F for ; Tue, 3 Aug 2021 14:30:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F0E1460230 for ; Tue, 3 Aug 2021 14:30:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F0E1460230 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 31C2C82EBB; Tue, 3 Aug 2021 16:29:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="WWXBTH5l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F78B82DF3; Tue, 3 Aug 2021 16:29:35 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 ACFE482DBC for ; Tue, 3 Aug 2021 16:29:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 448B360FC2; Tue, 3 Aug 2021 14:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628000964; bh=eSgoTU9T2WfqRSl2uulaL3YaJNZ4HJd+eR8H4u0e+tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWXBTH5lcpUGKxBa/AqAEPj+vSDn5N7mU5IlDwiYh5YbbIPAxEGGWFdMGxfCqyw6+ oYOB9fglaCKUBPUv5/qTFEGLgUc3d5QI0Aq9+f0UzW+eR2oFHRyqtRSbUDs201LtDd OsRSp1CyldbxtNrIweLTf3HXKyAPP212b/MxXwqRocEUU+KOAwXtdjjJYArBiC1+Rq wXr2Ne0zffDBrvfzoN3Tt1Wjk1Zlra7usU8q0T7vugTutD5+Lj1M3eW13Kg4eMaTN1 lQvOc10qn835N0ieuo3mM2k1BU8cCKkhLZz5sKkqkX6di8Cb+1PUPxrlS3aTIc3l0Q D4yQdRshq08sQ== Received: by pali.im (Postfix) id 06FA27F1; Tue, 3 Aug 2021 16:29:24 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Heinrich Schuchardt , Michal Simek , =?UTF-8?q?Marek=20Beh=C3=BAn?= Cc: u-boot@lists.denx.de Subject: [PATCH 7/7] xyz-modem: Allow to cancel transfer also by CTRL+C Date: Tue, 3 Aug 2021 16:28:44 +0200 Message-Id: <20210803142844.19455-8-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210803142844.19455-1-pali@kernel.org> References: <20210803142844.19455-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Currently it is possible to cancel loadx and loady commands by pressing CTRL+X (CAN character) at least 3 times quickly. All other U-Boot commands, including loadb and loads can be cancelled by CTRL+C. So allow it also in xyz-modem code used by loadx and loady commands. Implement it by handling CTRL+C (ETX character) in the same way as CTRL+X (CAN character). Due to how x/y-modem protocol works, it is required to press CTRL+C or CTRL+X at least 3 times quickly. Signed-off-by: Pali Rohár --- common/xyzModem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/xyzModem.c b/common/xyzModem.c index c200c9ff9177..ece25acb183b 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -32,6 +32,7 @@ /* Values magic to the protocol */ #define SOH 0x01 #define STX 0x02 +#define ETX 0x03 /* ^C for interrupt */ #define EOT 0x04 #define ACK 0x06 #define BSP 0x08 @@ -283,6 +284,7 @@ xyzModem_get_hdr (void) hdr_found = true; break; case CAN: + case ETX: xyz.total_CAN++; ZM_DEBUG (zm_dump (__LINE__)); if (++can_total == xyzModem_CAN_COUNT) -- 2.20.1