On Monday 28 January 2008 10:09, Vladimir Dronnikov wrote: > > About usleep(10) - why is it needed? Because if we ^X > > fast enough, comm port is shut down too fast and last char(s) > > are not xmitted? > > Right you are! > This delay is not needed unless we have piped input. > When input is piped we almost never get a chance to see device output.
I don't understand. I thought kernel will block us if we try to write too much data to serial port (writing way faster than it can send bits). Is this not the case? If so, we probably need to check for buffer space availability with POLLOUT, instead of blindly writing gobs of data. In other words: we may need full-fledged, bidirectional piping loop here with checks for input AND output buffer availability. We already have a few - see e.g. telnetd. In any case, adding arbitrary delays is not a good design. What if the delay is too small or too big for the particular device? > Will it work too if it is moved after 'done:' label, > > so that this pause is done only once at exit? > > No. See above. _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
