Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317056
b: refs/heads/master
c: 2cf6993
h: refs/heads/master
v: v3
  • Loading branch information
Bjørn Mork authored and Greg Kroah-Hartman committed Jul 17, 2012
1 parent c31ed1a commit 88efdcf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c026e2b36e8e934de9726398a3e1eeb3fa6055c
refs/heads/master: 2cf69930f03af63731678de79cb1dbe3547a5938
49 changes: 16 additions & 33 deletions trunk/drivers/usb/serial/qcserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
__u8 nintf;
__u8 ifnum;
bool is_gobi1k = id->driver_info ? true : false;
int altsetting = -1;

dev_dbg(dev, "Is Gobi 1000 = %d\n", is_gobi1k);

Expand Down Expand Up @@ -160,15 +161,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
retval = 0; /* Success */
break;
}

retval = usb_set_interface(serial->dev, ifnum, 1);
if (retval < 0) {
dev_err(dev,
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
kfree(data);
}
altsetting = 1;
}
break;

Expand All @@ -193,39 +186,18 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)

if (ifnum == 1 && !is_gobi1k) {
dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n");
retval = usb_set_interface(serial->dev, ifnum, 0);
if (retval < 0) {
dev_err(dev,
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
kfree(data);
}
altsetting = 0;
} else if (ifnum == 2) {
dev_dbg(dev, "Modem port found\n");
retval = usb_set_interface(serial->dev, ifnum, 0);
if (retval < 0) {
dev_err(dev,
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
kfree(data);
}
altsetting = 0;
} else if (ifnum==3 && !is_gobi1k) {
/*
* NMEA (serial line 9600 8N1)
* # echo "\$GPS_START" > /dev/ttyUSBx
* # echo "\$GPS_STOP" > /dev/ttyUSBx
*/
dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n");
retval = usb_set_interface(serial->dev, ifnum, 0);
if (retval < 0) {
dev_err(dev,
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
kfree(data);
}
altsetting = 0;
}
break;

Expand All @@ -235,6 +207,17 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
retval = -ENODEV;
}

if (altsetting >= 0) {
retval = usb_set_interface(serial->dev, ifnum, altsetting);
if (retval < 0) {
dev_err(dev,
"Could not set interface, error %d\n",
retval);
retval = -ENODEV;
kfree(data);
}
}

/* Set serial->private if not returning -ENODEV */
if (retval != -ENODEV)
usb_set_serial_data(serial, data);
Expand Down

0 comments on commit 88efdcf

Please sign in to comment.