Fwd: Line delay not working as intended in ascii-xfr

Sebastian Panceac spanceac at gmail.com
Wed Mar 7 06:25:13 UTC 2018


Hi everyone,

I encountered a problem when using ascii-xfr with line delay argument, to
send a file over a serial port.
The minicom version is 2.7.

The command used was the following:
sudo sh -c "ascii-xfr -sv -l 1 test-file > /dev/ttyUSB0"

The test file has the following 3 lines:
abcdefghijklmnopq
abcdefghijklmnopq
abcdefghijklmnopq

What I was expecting to see on the serial line was:
abcdefghijklmnopq [>1ms delay] abcdefghijklmnopq [>1ms delay]
abcdefghijklmnopq

What I actually saw, was all the 3 lines concatenated, without a pause
between them.

After some investigations, I realized that the cause of this problem is the
kernel that buffers the bytes to be sent.

So I added this fix for the code:

--- minicom-2.7-orig/src/ascii-xfr.c 2013-01-10 23:38:10.000000000 +0200
+++ minicom-2.7/src/ascii-xfr.c 2018-03-06 20:29:51.640774246 +0200
@@ -175,7 +175,11 @@
     lineout(line, len);
     bdone += len;
     if (ldelay)
+    {
+      if (isatty (STDOUT_FILENO))
+          tcdrain (STDOUT_FILENO);
       ms_delay(ldelay);
+    }
     stats(first);
     first = 0;
     check_answer();

After applying this fix, everything works as expected.

If necessary, I can attach some screenshots from the logic analyzer that
show the before/after.

Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/minicom-devel/attachments/20180307/025bf11d/attachment.html>


More information about the minicom-devel mailing list