usb/usb-serial-sierra-add-new-dev-group
authorKevin Lloyd <klloyd@sierrawireless.com>
Wed, 2 Apr 2008 18:24:56 +0000 (11:24 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:44 +0000 (21:16 -0700)
This patch is for the sierra driver and adds support for a new group of
devices that have a new USB configuration.
This targets kernel 2.6.25-rc7

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/sierra.c

index af667a1828b0dcc28e807f55fab543f1ad171f75..f791eb8887fcd9ba522c32a5aa45692f9612d0eb 100644 (file)
@@ -108,6 +108,26 @@ static int sierra_calc_num_ports(struct usb_serial *serial)
        return result;
 }
 
+static int sierra_calc_interface(struct usb_serial *serial)
+{
+               int interface;
+               struct usb_interface *p_interface;
+               struct usb_host_interface *p_host_interface;
+
+               /* Get the interface structure pointer from the serial struct */
+               p_interface = serial->interface;
+
+               /* Get a pointer to the host interface structure */
+               p_host_interface = p_interface->cur_altsetting;
+
+               /* read the interface descriptor for this active altsetting
+                * to find out the interface number we are on
+               */
+               interface = p_host_interface->desc.bInterfaceNumber;
+
+               return interface;
+}
+
 static int sierra_probe(struct usb_serial *serial,
                        const struct usb_device_id *id)
 {
@@ -123,6 +143,22 @@ static int sierra_probe(struct usb_serial *serial,
        ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
        udev = serial->dev;
 
+               /* Figure out the interface number from the serial structure */
+               ifnum = sierra_calc_interface(serial);
+
+               /*
+                * If this interface supports more than 1 alternate
+                * select the 2nd one
+                */
+               if (serial->interface->num_altsetting == 2) {
+                       dev_dbg(&udev->dev,
+                               "Selecting alt setting for interface %d\n",
+                               ifnum);
+
+                       /* We know the alternate setting is 1 for the MC8785 */
+                       usb_set_interface(udev, ifnum, 1);
+               }
+
        /* Check if in installer mode */
        if (truinstall && id->driver_info == DEVICE_INSTALLER) {
                dev_dbg(&udev->dev, "%s", "FOUND TRU-INSTALL DEVICE(SW)\n");
@@ -165,14 +201,18 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */
        { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
+       { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
+       { USB_DEVICE(0x1199, 0x683B), .driver_info = DEVICE_1_PORT },   /* Sierra Wireless MC8785 Composite*/
        { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */
        { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */
        { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880 E */
        { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881 E */
        { USB_DEVICE(0x1199, 0x6855) }, /* Sierra Wireless AirCard 880 U */
        { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
+       { USB_DEVICE(0x1199, 0x6859), .driver_info = DEVICE_1_PORT },   /* Sierra Wireless AirCard 885 E */
+       { USB_DEVICE(0x1199, 0x685A), .driver_info = DEVICE_1_PORT },   /* Sierra Wireless AirCard 885 E */
 
        { USB_DEVICE(0x1199, 0x6468) }, /* Sierra Wireless MP3G - EVDO */
        { USB_DEVICE(0x1199, 0x6469) }, /* Sierra Wireless MP3G - UMTS/HSPA */