xmodem crc16 checksum send on linux NACK because stream not flushed, RFC PATCH

Domen Puncer domen at cba.si
Wed Sep 7 13:25:55 UTC 2011


Hello!

I've been having trouble uploading a file through xmodem with crc16,
every time I got a bunch of NACKs and it just failed. After lots of
googling, I found I'm not the only one [1] [2], and that the cause was
that receiver sent some data which was misinterpreted ("C" chars in my
case, which is crc16 xmodem RX prompt IIRC). Some website suggested
"cat /dev/ttySx" just before sending the file, and that did the trick,
so flushing was the way.

Following trivial patch flushes serial port before starting file
transfer. I DO NOT KNOW if it has any bad effects on any transfers. I
do know that it makes xmodem transfer work in MY case.
Maybe someone with more experience with file transfers could comment on this?

References:
[1] http://www.usenet-forums.com/linux-general/85644-xmodem-checksum-linux.html
[2] http://www.justlinux.com/forum/archive/index.php/t-142901.html


--- src/updown.c.orig   2011-09-07 15:14:44.000000000 +0200
+++ src/updown.c        2011-09-07 15:14:32.000000000 +0200
@@ -302,6 +302,7 @@ void updown(int what, int nr)
  } else
    mc_wleave();

+  m_flush(portfd);
  switch (udpid = fork()) {
    case -1:
      werror(_("Out of memory: could not fork()"));


--
   Domen



More information about the minicom-devel mailing list