<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hi everyone,</div><div><br></div><div>I encountered a problem when using ascii-xfr with line delay argument, to send a file over a serial port.</div><div>The minicom version is 2.7.</div><div><br></div><div>The command used was the following:</div><div>sudo sh -c "ascii-xfr -sv -l 1 test-file > /dev/ttyUSB0"<br></div><div><br></div><div>The test file has the following 3 lines:<br></div><div>abcdefghijklmnopq</div><div>abcdefghijklmnopq</div><div>abcdefghijklmnopq</div><div><br></div><div>What I was expecting to see on the serial line was:</div><div>abcdefghijklmnopq [>1ms delay] abcdefghijklmnopq [>1ms delay] abcdefghijklmnopq</div><div><br></div><div>What I actually saw, was all the 3 lines concatenated, without a pause between them.</div><div><br></div><div>After some investigations, I realized that the cause of this problem is the kernel that buffers the bytes to be sent.</div><div><br></div><div>So I added this fix for the code:</div><div><br></div><div><div>--- minicom-2.7-orig/src/ascii-<wbr>xfr.c<span style="white-space:pre-wrap"> </span>2013-01-10 23:38:10.000000000 +0200</div><div>+++ minicom-2.7/src/ascii-xfr.c<span style="white-space:pre-wrap"> </span>2018-03-06 20:29:51.640774246 +0200</div><div>@@ -175,7 +175,11 @@</div><div> lineout(line, len);</div><div> bdone += len;</div><div> if (ldelay)</div><div>+ {</div><div>+ if (isatty (STDOUT_FILENO))</div><div>+ tcdrain (STDOUT_FILENO);</div><div> ms_delay(ldelay);</div><div>+ }</div><div> stats(first);</div><div> first = 0;</div><div> check_answer();</div></div><div><br></div><div>After applying this fix, everything works as expected.</div><div><br></div><div>If necessary, I can attach some screenshots from the logic analyzer that show the before/after.</div><div><br></div><div>Regards!</div><div><br></div></div>
</div><br></div>