[Patch 2/2] usb/serial/mct_usb232: add delay on close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried waiting for !port->write_urb_busy, but it didn't help. Looks like
a small delay is the only way to do it.

Signed-off-by: Pete Zaitcev <zaitcev@xxxxxxxxxx>

---
 drivers/usb/serial/mct_u232.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

commit 66b10b12c5bee0d65834d7bb7a0620a7e0cd4e12
Author: Master <zaitcev@xxxxxxxxxxxxxxxxxxx>
Date:   Sat Dec 5 15:01:05 2009 -0700

    Add the delay on close while output drains.

diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index f978e08..3486d75 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -552,6 +552,16 @@ static void mct_u232_close(struct usb_serial_port *port)
 {
 	dbg("%s port %d", __func__, port->number);
 
+	/*
+	 * Since the driver is reverse-engineered, we don't know how to
+	 * ask the device if bytes were actually transmitted. So, when
+	 * writes return and our URBs have completed, the bits are still
+	 * being sent. When we close and reopen, one data byte is lost.
+	 * Nothing to it but sleep a little bit while transmit drains.
+	 * RH bz#170490.
+	 */
+	msleep(2);
+
 	if (port->serial->dev) {
 		/* shutdown our urbs */
 		usb_kill_urb(port->write_urb);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux