# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.486   -> 1.487  
#       drivers/usb/serial/visor.c      1.33    -> 1.34   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/14      [EMAIL PROTECTED]  1.487
# USB visor driver: changes due to core api changes
# 
# - added calc_num_ports() ability to determine the number of actual
#   ports the device has on the fly.  This should help out with some
#   of the Palm and Sony devices.
# --------------------------------------------
#
diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c        Fri Jun 14 14:15:25 2002
+++ b/drivers/usb/serial/visor.c        Fri Jun 14 14:15:25 2002
@@ -168,7 +168,8 @@
 static int  visor_chars_in_buffer      (struct usb_serial_port *port);
 static void visor_throttle     (struct usb_serial_port *port);
 static void visor_unthrottle   (struct usb_serial_port *port);
-static int  visor_startup      (struct usb_serial *serial);
+static int  visor_probe                (struct usb_serial *serial);
+static int  visor_calc_num_ports(struct usb_serial *serial);
 static void visor_shutdown     (struct usb_serial *serial);
 static int  visor_ioctl                (struct usb_serial_port *port, struct file * 
file, unsigned int cmd, unsigned long arg);
 static void visor_set_termios  (struct usb_serial_port *port, struct termios 
*old_termios);
@@ -228,7 +229,8 @@
        close:                  visor_close,
        throttle:               visor_throttle,
        unthrottle:             visor_unthrottle,
-       startup:                visor_startup,
+       probe:                  visor_probe,
+       calc_num_ports:         visor_calc_num_ports,
        shutdown:               visor_shutdown,
        ioctl:                  visor_ioctl,
        set_termios:            visor_set_termios,
@@ -252,7 +254,7 @@
        close:                  visor_close,
        throttle:               visor_throttle,
        unthrottle:             visor_unthrottle,
-       startup:                clie_3_5_startup,
+       attach:                 clie_3_5_startup,
        ioctl:                  visor_ioctl,
        set_termios:            visor_set_termios,
        write:                  visor_write,
@@ -531,11 +533,11 @@
                err(__FUNCTION__ " - failed submitting read urb, error %d", result);
 }
 
-
-static int  visor_startup (struct usb_serial *serial)
+static int visor_probe (struct usb_serial *serial)
 {
        int response;
        int i;
+       int num_ports;
        unsigned char *transfer_buffer =  kmalloc (256, GFP_KERNEL);
 
        if (!transfer_buffer) {
@@ -558,8 +560,9 @@
                char *string;
 
                le16_to_cpus(&connection_info->num_ports);
+               num_ports = connection_info->num_ports;
                info("%s: Number of ports: %d", serial->type->name, 
connection_info->num_ports);
-               for (i = 0; i < connection_info->num_ports; ++i) {
+               for (i = 0; i < num_ports; ++i) {
                        switch (connection_info->connections[i].port_function_id) {
                                case VISOR_FUNCTION_GENERIC:
                                        string = "Generic";
@@ -580,7 +583,10 @@
                                        string = "unknown";
                                        break;  
                        }
-                       info("%s: port %d, is for %s use and is bound to ttyUSB%d", 
serial->type->name, connection_info->connections[i].port, string, serial->minor + i);
+                       info("%s: port %d, is for %s use", serial->type->name,
+                            connection_info->connections[i].port, string);
+               /* save off our num_ports info so that we can use it in the 
+calc_num_ports call */
+               serial->private = (void *)num_ports;
                }
        }
 
@@ -619,6 +625,17 @@
 
        /* continue on with initialization */
        return 0;
+}
+
+static int visor_calc_num_ports (struct usb_serial *serial)
+{
+       int num_ports = 0;
+
+       if (serial->private) {
+               num_ports = (int)serial->private;
+               serial->private = NULL;
+       }
+       return num_ports;
 }
 
 static int clie_3_5_startup (struct usb_serial *serial)

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

Reply via email to