qmi_wwan fails with error -22

Bjørn Mork bjorn at mork.no
Fri Oct 30 06:48:14 PDT 2015


[CCing Martin Hauke, as the source of the driver entry for this device]

Muri Nicanor <muri+libqmi at immerda.ch> writes:

> hello list,
>
> i'm not really sure if this is the right place, if it's not, please excuse.
> i have a brand new hp elitebook 820 g2 with a HP lt4112 Gobi 4G card
> included. i installed debian stretch on the notebook with kernel
> 4.2.3-2. qmi_wwan is loaded as a module on boot, but says
>> qmi_wwan: probe of 2-6:2.4 failed with error -22.
> cdc_ether also is loaded but no /dev/cdc-ether device appears. in the
> network manager i can see a 'Ethernet Network (Hewlett-Packard HP lt4112
> Gobi 4G)', but its greyed out.

Ouch, I believe i see what happens here. The device entry in the driver
assume a one-to-one mapping between USB interface numbers and functions,
like e.g. Sierra devices will have.  But that is not valid for Huawei
devices like this one.  They use subclass and protocol to map to
functions, and the interface numbers are dynamic.

In your case, interface #3 of cfg #1 is the QMI interface:

 >       bInterfaceClass       255 Vendor Specific Class
 >       bInterfaceSubClass      1 
 >       bInterfaceProtocol      7 


But the kernel has switched your modem to cfg #2 by default, because of
a preference for proper classes.  And that configuration has a standard
CDC ECM function.  Which should really work with the cdc_ether driver.
I'm a little puzzled as to why that doesn't work.

In any case, we'll probably prefer switching this modem to cfg #3 and
use it in MBIM mode.  But it would be interesting to make cfg #1 work as
well, so that we can use the QMI function.  Could you try these commands
as an initial test:

 echo 1 >/sys/bus/usb/devices/2-6/bConfigurationValue
 echo "03f0 581d" >/sys/bus/usb/drivers/qmi_wwan/new_id

The latter might seem redundant since we have an entry in the driver
already.  But the problem is that the driver entry refers to interface
#4, while your modem is set up with QMI at interface #3.

As for making it work properly with ModemManager, my proposal is to
switch it to cfg #3:

 echo 3 >/sys/bus/usb/devices/2-6/bConfigurationValue

You may need to do this immediately after device discovery, or the
firmware could fail to do a proper mode switch.  An udev rule similar to
this one should work (untested, of course...):

SUBSYSTEM=="usb", ATTR{idVendor}=="03f0", ATTR{idProduct}=="581d", \
  ATTR{bNumConfigurations}=="3", ATTR{bConfigurationValue}!="3" \
  ATTR{bConfigurationValue}="3"


We do handle this scheme correctly for devices with a Huawei vendor ID,
but this modem has a HP vendor ID.  Unfortunately, we cannot just switch
to the Huawei scheme for all HP devices either, since they use the same
vendor ID for modems from many different manufacturers.

We'll probably just have to add "Huawei type" entries for each known
Huawei modem with a HP vendor ID.

Hmm, we have the same problems for the entry in qcserial.  I'm afraid
the QCSERIAL_HWI scheme is broken.  Huawei does not use fixed interface
numbers. We,ll have to redo this.  Sorry for not catching it earlier.

> i can use the modem only, if i do
>> echo "03f0 581d" >/sys/bus/usb-serial/drivers/generic/new_id
> and restart ModemManager, but its doesn't work very good (i.e. i can
> browse the web, but not connect to any vpn).

No, that's not going to work very well.  That driver is made for testing
slow serial links and not suitable for high speed modems.


> maybe i'm missing one simple step (i also tried to use usb_modeswitch on
> the card, but no success), any help appreciated...

Hmm, I believe usb_modeswitch should prefer MBIM when supported.  Do you
have the cdc_mbim driver available?  What's the output when you run
usb_modeswitch?

> lsusb of the card is attached.

Thanks a lot for that!  It made it very easy to verify our error here,
and also made it terribly clear that we have a little cleaup to do.
It's reports like yours that move us forward. Thanks.


Bjørn

(leaving the lsusb output quoted below for Martin, so he can compare it
with his device)


> Bus 002 Device 009: ID 03f0:581d Hewlett-Packard 
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   idVendor           0x03f0 Hewlett-Packard
>   idProduct          0x581d 
>   bcdDevice            2.28
>   iManufacturer           2 Hewlett-Packard
>   iProduct                3 HP lt4112 Gobi 4G Module
>   iSerial                 4 0123456712ABCA17
>   bNumConfigurations      3
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          157
>     bNumInterfaces          5
>     bConfigurationValue     1
>     iConfiguration          0 
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower              500mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      2 
>       iInterface             50 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      3 
>       iInterface             51 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x02  EP 2 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        2
>       bAlternateSetting       0
>       bNumEndpoints           3
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      1 
>       iInterface             49 HP lt4112 Gobi 4G Module
>       ** UNRECOGNIZED:  05 24 00 10 01
>       ** UNRECOGNIZED:  05 24 01 00 00
>       ** UNRECOGNIZED:  04 24 02 02
>       ** UNRECOGNIZED:  05 24 06 00 00
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x84  EP 4 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x000a  1x 10 bytes
>         bInterval               9
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x03  EP 3 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        3
>       bAlternateSetting       0
>       bNumEndpoints           3
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      7 
>       iInterface             55 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x86  EP 6 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0008  1x 8 bytes
>         bInterval               9
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x85  EP 5 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x04  EP 4 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        4
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      5 
>       iInterface             53 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x87  EP 7 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x05  EP 5 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          149
>     bNumInterfaces          5
>     bConfigurationValue     2
>     iConfiguration          0 
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower              500mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      6 Ethernet Networking
>       bInterfaceProtocol      0 
>       iInterface             57 HP lt4112 Gobi 4G Module
>       CDC Header:
>         bcdCDC               1.10
>       CDC Union:
>         bMasterInterface        0
>         bSlaveInterface         1 
>       CDC Ethernet:
>         iMacAddress                     11 021E101F0000
>         bmEthernetStatistics    0x00000000
>         wMaxSegmentSize               1514
>         wNumberMCFilters            0x0000
>         bNumberPowerFilters              0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0010  1x 16 bytes
>         bInterval               9
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface             57 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        2
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      3 
>       iInterface             51 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x02  EP 2 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        3
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      2 
>       iInterface             50 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x84  EP 4 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x03  EP 3 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        4
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      5 
>       iInterface             53 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x85  EP 5 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x04  EP 4 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          118
>     bNumInterfaces          3
>     bConfigurationValue     3
>     iConfiguration          0 
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower              500mA
>     Interface Association:
>       bLength                 8
>       bDescriptorType        11
>       bFirstInterface         0
>       bInterfaceCount         2
>       bFunctionClass          2 Communications
>       bFunctionSubClass      14 
>       bFunctionProtocol       0 
>       iFunction               0 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass     14 
>       bInterfaceProtocol      0 
>       iInterface             56 HP lt4112 Gobi 4G Module
>       CDC Header:
>         bcdCDC               1.10
>       CDC Union:
>         bMasterInterface        0
>         bSlaveInterface         1 
>       CDC MBIM:
>         bcdMBIMVersion       1.00
>         wMaxControlMessage   4096
>         bNumberFilters       32
>         bMaxFilterSize       128
>         wMaxSegmentSize      1500
>         bmNetworkCapabilities 0x20
>           8-byte ntb input size
>       UNRECOGNIZED CDC:  08 24 1c 00 01 40 dc 05
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               9
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      2 
>       iInterface             13 MBIM Data
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      2 
>       iInterface             13 MBIM Data
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        2
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      1 
>       bInterfaceProtocol      5 
>       iInterface             53 HP lt4112 Gobi 4G Module
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x02  EP 2 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0200  1x 512 bytes
>         bInterval               0
> Device Qualifier (for other device speed):
>   bLength                10
>   bDescriptorType         6
>   bcdUSB               2.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   bNumConfigurations      3
> Device Status:     0x0000
>   (Bus Powered)
>
> _______________________________________________
> libqmi-devel mailing list
> libqmi-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libqmi-devel


More information about the libqmi-devel mailing list