Fwd: Line delay not working as intended in ascii-xfr
Adam Lackorzynski
adam at os.inf.tu-dresden.de
Fri Mar 9 20:19:08 GMT 2018
Hi,
On Wed Mar 07, 2018 at 08:25:13 +0200, Sebastian Panceac wrote:
> 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.
Looks good, applied.
Adam
More information about the minicom-devel
mailing list