On Mon, 19 Apr 2004 15:41:41 -0600
[EMAIL PROTECTED] wrote:
> With the USB->tty port the OFF signal never gets sent, rather
> the RTS drops as the program exits BEFORE the characters are sent to
> the device. If I put in either a second write -or- a 5 second sleep
> at the end of the program, then the 4char write at the end of the
> program succeeds (as seen by watching a breakout box).
It is a known deficiency, I am very sorry to say. The 2.4 serial
does about the same thing. This is what has to be done in ->release,
very approximately:
+++ linux-2.4.22-1.2176-u1/drivers/usb/serial/usbserial.c 2004-03-23
11:07:12.000000000 -0800
@@ -642,6 +656,20 @@
/* if disconnect beat us to the punch here, there's nothing to do */
if (tty->driver_data) {
+ /*
+ * XXX The right thing would be to wait for the output to drain.
+ * But we are not sufficiently daring to experiment in 2.4.
+ * N.B. If we do wait, no need to run post_helper here.
+ * Normall callback mechanism wakes it up just fine.
+ */
+#if I_AM_A_DARING_HACKER
+ tty->closing = 1;
+ up (&port->sem);
+ if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE)
+ tty_wait_until_sent(tty, info->closing_wait);
+ down (&port->sem);
+ if (!tty->driver_data) /* woopsie, disconnect, now what */ ;
+#endif
__serial_close(port, filp);
}
Wellm as you can see it has to process disconnect in a meaningful way.
But other than that, such is the canonical way to drain on close.
-- Pete
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel