David Eriksson wrote:
Has anyone added tty_hangup to the usb-serial core yet?

Here is a patch you can experiment with. This is for 2.6.9-rc1; it adds calls to tty_hangup on all ports of a usb-serial device that has been disconnected.

Not sure if this is what is needed for ipaq or any other purpose.
I experimented with this briefly in a different context, where it
turned out it was not needed--otherwise, this has not been tested.

-- Al
diff --exclude-from=dontdiff -urp linux-2.6.9-rc1.tmp/drivers/usb/serial/usb-serial.c 
linux-2.6.9-rc1.new/drivers/usb/serial/usb-serial.c
--- linux-2.6.9-rc1.tmp/drivers/usb/serial/usb-serial.c 2004-08-14 05:56:26.000000000 
-0500
+++ linux-2.6.9-rc1.new/drivers/usb/serial/usb-serial.c 2004-08-30 15:26:26.856728808 
-0500
@@ -1200,13 +1200,20 @@ probe_error:
 
 void usb_serial_disconnect(struct usb_interface *interface)
 {
+       int i;
        struct usb_serial *serial = usb_get_intfdata (interface);
+       struct usb_serial_port *port;
        struct device *dev = &interface->dev;
 
        dbg ("%s", __FUNCTION__);
 
        usb_set_intfdata (interface, NULL);
        if (serial) {
+               for (i = 0; i < serial->num_ports; ++i) {
+                       port = serial->port[i];
+                       if (port && port->tty)
+                               tty_hangup(port->tty);
+               }
                /* let the last holder of this object 
                 * cause it to be cleaned up */
                kref_put(&serial->kref);

Reply via email to