<br><div class="gmail_quote">On Sat, May 5, 2012 at 1:17 AM, Simon Peter <span dir="ltr">&lt;<a href="mailto:speter@inf.ethz.ch" target="_blank">speter@inf.ethz.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Thanks for your patch!<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- trap &quot;pkill -P $$&quot; SIGINT can not kill previous cat process properly,<br>
so each time I&#39;ll get a &quot;device<br>
busy&quot; error<br>
</blockquote>
<br></div>
Can you point out why it is failing? It seems to be working here. Unfortunately, your fix will end up killing any cat process in the system, which is not desirable.</blockquote><div><br></div><div>My understanding is that the script&#39;s process id ($$) is not the same on each run. So the second run of the script fail to kill the cat processes created by the first run of the script. Is this reasonable?</div>

<div><br></div><div>As for the potential side effect of killing other cat processes, I haven&#39;t figure out how to resolve this...</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- &quot;cat /dev/crbif0rb0c${i}ttyS0 | grep . --line-buffered &amp;&quot; in the for<br>
loop can not display the<br>
outputs properly: only empty lines are printed.<br>
</blockquote>
<br></div>
Thanks for fixing this one. I&#39;m not sure why it prints only empty lines in your case, though I see no problem applying your fix.</blockquote><div><br></div><div>I don&#39;t know why it fails here either. I tried stackoverflow[1][2] by get no useful answer. Personally, I suspect that there are some control bytes in the UART stream that fools grep, but I&#39;m not sure...</div>

<div><br></div><div>[1] <a href="http://stackoverflow.com/questions/10429434/concurrent-uart-output-with-line-buffered">http://stackoverflow.com/questions/10429434/concurrent-uart-output-with-line-buffered</a></div><div>
[2] <a href="http://stackoverflow.com/questions/10443704/line-buffered-cat">http://stackoverflow.com/questions/10443704/line-buffered-cat</a></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
<br>
Simon<br>
<br>
</font></span></blockquote></div><br>