From 9ac16049b86e56cb757d92145c21fb648f3f850d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 27 May 2018 08:43:22 -0600 Subject: [PATCH] apps/system/zmodem: Fix an incompatibility with the way that CRCs are calculated. --- system/zmodem/README.txt | 3 ++- system/zmodem/zm_proto.c | 5 +---- system/zmodem/zm_send.c | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/system/zmodem/README.txt b/system/zmodem/README.txt index 47d573c15..15fd638e2 100755 --- a/system/zmodem/README.txt +++ b/system/zmodem/README.txt @@ -80,9 +80,10 @@ Using NuttX Zmodem with a Linux Host $ sudo stty -F /dev/ttyS0 9600 # Select 9600 BAUD $ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking * + $ sudo stty -F /dev/ttyS0 raw # Puts the TTY in raw mode $ sudo stty -F /dev/ttyS0 # Show the TTY configuration - * Only is hardware flow control is enabled. + * Only if hardware flow control is enabled. Start rz on the Linux host (using /dev/ttyS0 as an example): diff --git a/system/zmodem/zm_proto.c b/system/zmodem/zm_proto.c index 05edc46f6..083af29b9 100644 --- a/system/zmodem/zm_proto.c +++ b/system/zmodem/zm_proto.c @@ -235,11 +235,10 @@ int zm_senddata(FAR struct zm_state_s *pzm, FAR const uint8_t *buffer, *ptr++ = term; - /* Calcualate and transfer the final CRC value */ + /* Calculate and transfer the final CRC value */ if (zbin == ZBIN) { - crc = (uint32_t)crc16part(g_zeroes, 2, (uint16_t)crc); ptr = zm_putzdle(pzm, ptr, (crc >> 8) & 0xff); ptr = zm_putzdle(pzm, ptr, crc & 0xff); } @@ -314,7 +313,6 @@ int zm_sendhexhdr(FAR struct zm_state_s *pzm, int type, /* crc-1 crc-2 */ - crc = crc16part(g_zeroes, 2, crc); ptr = zm_puthex8(ptr, (crc >> 8) & 0xff); ptr = zm_puthex8(ptr, crc & 0xff); @@ -391,7 +389,6 @@ int zm_sendbin16hdr(FAR struct zm_state_s *pzm, int type, /* crc-1 crc-2 */ - crc = crc16part(g_zeroes, 2, crc); ptr = zm_putzdle(pzm, ptr, (crc >> 8) & 0xff); ptr = zm_putzdle(pzm, ptr, crc & 0xff); diff --git a/system/zmodem/zm_send.c b/system/zmodem/zm_send.c index 9daeb2789..e872daaaf 100644 --- a/system/zmodem/zm_send.c +++ b/system/zmodem/zm_send.c @@ -1047,7 +1047,6 @@ static int zms_sendpacket(FAR struct zm_state_s *pzm) if (!bcrc32) { - crc = (uint32_t)crc16part(g_zeroes, 2, (uint16_t)crc); ptr = zm_putzdle(pzm, ptr, (crc >> 8) & 0xff); ptr = zm_putzdle(pzm, ptr, crc & 0xff); }