Commit 5e0dd8c0 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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.
parent 8274ff48
......@@ -168,7 +168,8 @@ static int visor_write_room (struct usb_serial_port *port);
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 @@ static struct usb_serial_device_type handspring_device = {
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 @@ static struct usb_serial_device_type clie_3_5_device = {
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 @@ static void visor_unthrottle (struct usb_serial_port *port)
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 @@ static int visor_startup (struct usb_serial *serial)
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 @@ static int visor_startup (struct usb_serial *serial)
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;
}
}
......@@ -621,6 +627,17 @@ static int visor_startup (struct usb_serial *serial)
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)
{
int result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment