# HG changeset patch # User gthomas # Date 1118409959 0 # Node ID b6d1bd49a61d545175cac692470ab41f5ba29e0f # Parent f199806a09e025d4e77cd528e23c79daf7314eb9 Better handling of Y-modem (^Z chars) - from David Vrabel diff --git a/packages/redboot/current/ChangeLog b/packages/redboot/current/ChangeLog --- a/packages/redboot/current/ChangeLog +++ b/packages/redboot/current/ChangeLog @@ -1,3 +1,11 @@ +2005-06-09 David Vrabel + + * src/xyzModem.c: Use the Ymodem length field by #define'ing + USE_YMODEM_LENGTH. + (xyzModem_stream_read): Only discard runs of ^Z's if we're using + Xmodem or the Ymodem length field is 0. This allows binary files + with runs of ^Z's to be transferred. + 2005-06-07 Andrew Lunn * src/flash.c (_flash_info): Fixed a warning about a diag_printf diff --git a/packages/redboot/current/src/xyzModem.c b/packages/redboot/current/src/xyzModem.c --- a/packages/redboot/current/src/xyzModem.c +++ b/packages/redboot/current/src/xyzModem.c @@ -68,7 +68,7 @@ #define CAN 0x18 #define EOF 0x1A // ^Z for DOS officionados -#define nUSE_YMODEM_LENGTH +#define USE_YMODEM_LENGTH // Data & state local to the protocol static struct { @@ -416,13 +416,14 @@ xyzModem_stream_read(char *buf, int size xyz.tx_ack = true; ZM_DEBUG(zm_dprintf("ACK block %d (%d)\n", xyz.blk, __LINE__)); xyz.next_blk = (xyz.next_blk + 1) & 0xFF; - // Data blocks can be padded with ^Z (EOF) characters - // This code tries to detect and remove them -#ifdef xyzModem_zmodem - if (xyz.mode != xyzModem_zmodem) { + +#if defined(xyzModem_zmodem) || defined(USE_YMODEM_LENGTH) + if (xyz.mode == xyzModem_xmodem || xyz.file_length == 0) { #else if (1) { #endif + // Data blocks can be padded with ^Z (EOF) characters + // This code tries to detect and remove them if ((xyz.bufp[xyz.len-1] == EOF) && (xyz.bufp[xyz.len-2] == EOF) && (xyz.bufp[xyz.len-3] == EOF)) {