On Tue, Dec 18, 2001 at 10:45:42AM +0100, Utz-Uwe Haus wrote:
> Hi,
> 
> I'm eager to announce to a wider audience the availability of another
> usbserial driver. I was stuck with the PalmConnect USB-Serial adapter,
> not having read the proper mailing list in time, so I decided to have a
> go at deciphering the protocol used. It appears that the chip and
> firmware used are made by KLSI, and I am trying to establish contact
> with them to release some information (they have done so in the past,
> see kaweth.c).
> Anyway, although it still is rough in some areas, and the
> sourcecode needs some cleaning, this driver is working for me, and does
> not Ooops anymore :*) I use it to sync my Palm device these days.

Here's a patch against your driver to make it build properly in 2.5.1.

thanks,

greg k-h
diff -Nru a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
--- a/drivers/usb/serial/kl5kusb105.c   Tue Dec 18 13:43:37 2001
+++ b/drivers/usb/serial/kl5kusb105.c   Tue Dec 18 13:43:37 2001
@@ -53,12 +53,10 @@
 #include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-/*#include <linux/fcntl.h>*/
 #include <linux/tty.h>
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 #include <linux/module.h>
-/*#include <linux/spinlock.h>*/
 #include <linux/usb.h>
 
 #ifdef CONFIG_USB_SERIAL_DEBUG
@@ -111,34 +109,20 @@
  */
 
 /*
- * All of the device info needed for the MCT USB-RS232 converter.
+ * All of the device info needed for the KLSI converters.
  */
-static __devinitdata struct usb_device_id id_table_combined [] = {
+static __devinitdata struct usb_device_id id_table [] = {
        { USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) },
        { USB_DEVICE(KLSI_VID, KLSI_KL5KUSB105D_PID) },
        { }             /* Terminating entry */
 };
 
-static __devinitdata struct usb_device_id palmconnect_table [] = {
-        { USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) },
-        { }                        /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id kl5kusb105d_table [] = {
-        { USB_DEVICE(KLSI_VID, KLSI_KL5KUSB105D_PID) },
-        { }                        /* Terminating entry */
-};
-
+MODULE_DEVICE_TABLE (usb, id_table);
 
-MODULE_DEVICE_TABLE (usb, id_table_combined);
 
-
-struct usb_serial_device_type palmconnect_device = {
-       name:                "PalmConnect USB Serial",
-       id_table:            palmconnect_table,
-       needs_interrupt_in:  MUST_HAVE,   /* 1 interrupt-in endpoints */
-       needs_bulk_in:       MUST_HAVE,   /* 1 bulk-in endpoint */
-       needs_bulk_out:      MUST_HAVE,   /* 1 bulk-out endpoint */
+static struct usb_serial_device_type kl5kusb105d_device = {
+       name:                "KL5KUSB105D / PalmConnect",
+       id_table:            id_table,
        num_interrupt_in:    1,
        num_bulk_in:         1,
        num_bulk_out:        1,
@@ -159,33 +143,6 @@
        unthrottle:          klsi_105_unthrottle,
 };
 
-struct usb_serial_device_type kl5kusb105d_device = {
-       name:                "generic KL5KUSB105D USB->Serial",
-       id_table:            kl5kusb105d_table,
-       needs_interrupt_in:  MUST_HAVE,  /* 1 interrupt-in endpoints */
-       needs_bulk_in:       MUST_HAVE,  /* 1 bulk-in endpoint */
-       needs_bulk_out:      MUST_HAVE,  /* 1 bulk-out endpoint */
-       num_interrupt_in:    1,
-       num_bulk_in:         1,
-       num_bulk_out:        1,
-       num_ports:           1,
-       open:                klsi_105_open,
-       close:               klsi_105_close,
-       write:               klsi_105_write,
-       write_bulk_callback: klsi_105_write_bulk_callback,
-       chars_in_buffer:     klsi_105_chars_in_buffer,
-       write_room:          klsi_105_write_room,
-       read_bulk_callback:  klsi_105_read_bulk_callback,
-       ioctl:               klsi_105_ioctl,
-       set_termios:         klsi_105_set_termios,
-       /*break_ctl:         klsi_105_break_ctl,*/
-       startup:             klsi_105_startup,
-       shutdown:            klsi_105_shutdown,
-       throttle:            klsi_105_throttle,
-       unthrottle:          klsi_105_unthrottle,
-};
-
-
 struct klsi_105_port_settings {
        __u8    pktlen;         /* always 5, it seems */
        __u8    baudrate;
@@ -405,11 +362,10 @@
        ++port->open_count;
        MOD_INC_USE_COUNT;
 
-       if (!port->active) {
+       if (port->open_count == 1) {
                int rc;
                int i;
                unsigned long line_state;
-               port->active = 1;
 
                /* force low_latency on so that our tty_push actually forces
                 * the data through
@@ -523,7 +479,7 @@
                /* FIXME */
                /* wgg - do I need this? I think so. */
                usb_unlink_urb (port->interrupt_in_urb);
-               port->active = 0;
+               port->open_count = 0;
                info("kl5kusb105 port stats: %ld bytes in, %ld bytes out", 
priv->bytes_in, priv->bytes_out);
        }
        
@@ -537,9 +493,6 @@
  * leaves at most 62 bytes of payload.
  */
 #define KLSI_105_DATA_OFFSET   2   /* in the bulk urb data block */
-#define MIN3(a,b,c) (a)<(b) ?                                    \
-                         ( (c) < (a) ? (c) : (a))               \
-                       : ( (c) < (b) ? (c) : (b))
 
 
 static int klsi_105_write (struct usb_serial_port *port, int from_user,
@@ -585,8 +538,8 @@
                        }
                }
 
-               size = MIN3 (count, port->bulk_out_size - KLSI_105_DATA_OFFSET,
-                            URB_TRANSFER_BUFFER_SIZE - KLSI_105_DATA_OFFSET);
+               size = min (count, port->bulk_out_size - KLSI_105_DATA_OFFSET);
+               size = min (size, URB_TRANSFER_BUFFER_SIZE - KLSI_105_DATA_OFFSET);
 
                if (from_user) {
                        if (copy_from_user(urb->transfer_buffer
@@ -1103,17 +1056,15 @@
 
 static int __init klsi_105_init (void)
 {
-       usb_serial_register (&palmconnect_device);
        usb_serial_register (&kl5kusb105d_device);
 
-       info(DRIVER_VERSION " " DRIVER_DESC);
+       info(DRIVER_DESC " " DRIVER_VERSION);
        return 0;
 }
 
 
 static void __exit klsi_105_exit (void)
 {
-       usb_serial_deregister (&palmconnect_device);
        usb_serial_deregister (&kl5kusb105d_device);
 }
 
@@ -1123,9 +1074,7 @@
 
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
-#ifdef MODULE_LICENSE
-       MODULE_LICENSE("GPL"); 
-#endif
+MODULE_LICENSE("GPL"); 
 
 
 MODULE_PARM(debug, "i");

Reply via email to