USB: qcserial: Fix support for HP lt4112 LTE/HSPA+ Gobi 4G Modem

The DEVICE_HWI type was added under the faulty assumption that Huawei
devices based on Qualcomm chipsets and firmware use the static USB
interface numbering known from Gobi devices.  But this model does
not apply to Huawei devices like the HP branded lt4112 (Huawei me906e).
Huawei firmwares will dynamically assign interface numbers. Functions
are renumbered when the firmware is reconfigured.

Fix by changing the DEVICE_HWI type to use a simplified version
of Huawei's subclass + protocol scheme: Blacklisting known network
interface combinations and assuming the rest are serial.

Reported-and-tested-by: Muri Nicanor <muri+libqmi@immerda.ch>
Tested-by: Martin Hauke <mardnh@gmx.de>
Cc: <stable@vger.kernel.org>
Fixes: e7181d005e ("USB: qcserial: Add support for HP lt4112 LTE/HSPA+ Gobi 4G Modem")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
Bjørn Mork 2015-11-16 13:15:46 +01:00 committed by Johan Hovold
parent 1bcb49e663
commit 59536da345
1 changed files with 34 additions and 20 deletions

View File

@ -215,6 +215,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
int altsetting = -1; int altsetting = -1;
bool sendsetup = false; bool sendsetup = false;
/* we only support vendor specific functions */
if (intf->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
goto done;
nintf = serial->dev->actconfig->desc.bNumInterfaces; nintf = serial->dev->actconfig->desc.bNumInterfaces;
dev_dbg(dev, "Num Interfaces = %d\n", nintf); dev_dbg(dev, "Num Interfaces = %d\n", nintf);
ifnum = intf->desc.bInterfaceNumber; ifnum = intf->desc.bInterfaceNumber;
@ -341,29 +345,39 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
break; break;
case QCSERIAL_HWI: case QCSERIAL_HWI:
/* /*
* Huawei layout: * Huawei devices map functions by subclass + protocol
* 0: AT-capable modem port * instead of interface numbers. The protocol identify
* 1: DM/DIAG * a specific function, while the subclass indicate a
* 2: AT-capable modem port * specific firmware source
* 3: CCID-compatible PCSC interface *
* 4: QMI/net * This is a blacklist of functions known to be
* 5: NMEA * non-serial. The rest are assumed to be serial and
* will be handled by this driver
*/ */
switch (ifnum) { switch (intf->desc.bInterfaceProtocol) {
case 0: /* QMI combined (qmi_wwan) */
case 2: case 0x07:
dev_dbg(dev, "Modem port found\n"); case 0x37:
break; case 0x67:
case 1: /* QMI data (qmi_wwan) */
dev_dbg(dev, "DM/DIAG interface found\n"); case 0x08:
break; case 0x38:
case 5: case 0x68:
dev_dbg(dev, "NMEA GPS interface found\n"); /* QMI control (qmi_wwan) */
break; case 0x09:
default: case 0x39:
/* don't claim any unsupported interface */ case 0x69:
/* NCM like (huawei_cdc_ncm) */
case 0x16:
case 0x46:
case 0x76:
altsetting = -1; altsetting = -1;
break; break;
default:
dev_dbg(dev, "Huawei type serial port found (%02x/%02x/%02x)\n",
intf->desc.bInterfaceClass,
intf->desc.bInterfaceSubClass,
intf->desc.bInterfaceProtocol);
} }
break; break;
default: default: