Hi,

Here's a patch against 2.4.10-ac2 that sets the DTR line high on
initialization, and fixes a problem with getting the module reference
out of whack when removing a device when a program still had the port
open.

Yes, RTS/DTR line control is not implemented yet, but by raising DTR all
the time, it fixes the majority of problems people have reported so far :)

thanks,

greg k-h



diff --minimal -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c       Mon Oct  1 13:31:58 2001
+++ b/drivers/usb/serial/pl2303.c       Mon Oct  1 13:31:58 2001
@@ -103,6 +103,7 @@
 static int pl2303_write (struct usb_serial_port *port, int from_user,
                         const unsigned char *buf, int count);
 static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
+static void pl2303_shutdown (struct usb_serial *serial);
 
 
 /* All of the device info needed for the PL2303 SIO serial converter */
@@ -125,6 +126,7 @@
        read_bulk_callback:     pl2303_read_bulk_callback,
        read_int_callback:      pl2303_read_int_callback,
        write_bulk_callback:    pl2303_write_bulk_callback,
+       shutdown:               pl2303_shutdown,
 };
 
 
@@ -289,7 +291,7 @@
 
        i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
                             SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE,
-                            0, 0, NULL, 0, 100);
+                            1, 0, NULL, 0, 100);
        dbg ("0x21:0x22:1:0  %d", i);
 #if 0
        i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
@@ -439,16 +441,8 @@
 }
 
 
-static int
-pl2303_ioctl (struct usb_serial_port *port, struct file *file,
-             unsigned int cmd, unsigned long arg)
+static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsigned 
+int cmd, unsigned long arg)
 {
-// struct usb_serial *serial = port->serial;
-// __u16 urb_value=0; /* Will hold the new flags */
-// char buf[1];
-// int  ret, mask;
-
-
        dbg ("pl2303_sio ioctl 0x%04x", cmd);
 
        /* Based on code from acm.c and others */
@@ -473,7 +467,6 @@
                        return(-ENOIOCTLCMD);
                        break;
        }
-       dbg ("pl2303_ioctl returning 0");
 
        return 0;
 }
@@ -498,6 +491,19 @@
                                  0, NULL, 0, 100);
        if (result)
                dbg (__FUNCTION__" - error sending break = %d", result);
+}
+
+
+static void pl2303_shutdown (struct usb_serial *serial)
+{
+       int i;
+
+       dbg (__FUNCTION__);
+
+       /* stop everything on all ports */
+       for (i = 0; i < serial->num_ports; ++i)
+               while (serial->port[i].open_count > 0)
+                       pl2303_close (&serial->port[i], NULL);
 }
 
 

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to