summaryrefslogtreecommitdiff
path: root/common/xyzModem.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-08-03 17:28:44 +0300
committerTom Rini <trini@konsulko.com>2021-09-03 21:32:41 +0300
commitdffeb400985d3244ce13ca95ad7c18a78ffd207f (patch)
tree40d868670757b71fc97cab910df5a31f70907322 /common/xyzModem.c
parentc97b2557bcd5899cdf7bd57e09379b159f4796c8 (diff)
downloadu-boot-dffeb400985d3244ce13ca95ad7c18a78ffd207f.tar.xz
xyz-modem: Allow to cancel transfer also by CTRL+C
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 <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/xyzModem.c')
-rw-r--r--common/xyzModem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/xyzModem.c b/common/xyzModem.c
index c200c9ff91..ece25acb18 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)