How to connect via qmi_wwan on Ubuntu?

I just received a new MC7304 card to put into my Ubuntu 14.04 Server. I am replacing a USB Huawei stick which worked reasonably well via wvdial and PPP.

I managed to get the MC7304 connected via wvdial and PPP after setting the correct /dev/ttyUSB2. I am now looking at using the QMI interface since it is supposed to be faster.

I installed the libqmi-utils package to get qmicli and qmi-network.

I then followed a gist I found on how to conenct via this on Debian. However after connecting the wwan0 interface does not get assigned and IP and dhclient does not get a response either.

How should I configure it? Ideally I want to set it into /etc/network/interfaces so it will connect at boot.

I am on Ubuntu 14.04 Server.

Here is the output from dmesg:

[    2.489035] usb 1-5: new high-speed USB device number 4 using xhci_hcd
[    2.516771] usb 1-5: config 1 has an invalid interface number: 8 but max is 5
[    2.523818] usb 1-5: config 1 has an invalid interface number: 10 but max is 5
[    2.523819] usb 1-5: config 1 has an invalid interface number: 11 but max is 5
[    2.523826] usb 1-5: config 1 has no interface number 1
[    2.523829] usb 1-5: config 1 has no interface number 4
[    2.523833] usb 1-5: config 1 has no interface number 5
[    2.576398] usb 1-5: New USB device found, idVendor=1199, idProduct=68c0
[    2.582571] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.588829] usb 1-5: Product: MC7304
[    2.588831] usb 1-5: Manufacturer: Sierra Wireless, Incorporated

[   18.452576] usbcore: registered new interface driver usbserial
[   18.452586] usbcore: registered new interface driver usbserial_generic
[   18.452592] usbserial: USB Serial support registered for generic
[   18.505217] usbcore: registered new interface driver cdc_wdm
[   18.505386] usbcore: registered new interface driver qcserial
[   18.505405] usbserial: USB Serial support registered for Qualcomm USB modem
[   18.512255] qcserial 1-5:1.0: Qualcomm USB modem converter detected
[   18.512337] usb 1-5: Qualcomm USB modem converter now attached to ttyUSB0
[   18.520279] qcserial 1-5:1.2: Qualcomm USB modem converter detected
[   18.520336] usb 1-5: Qualcomm USB modem converter now attached to ttyUSB1
[   18.525646] qcserial 1-5:1.3: Qualcomm USB modem converter detected
[   18.525710] usb 1-5: Qualcomm USB modem converter now attached to ttyUSB2
[   18.557315] qmi_wwan 1-5:1.8: cdc-wdm1: USB WDM device
[   18.557904] qmi_wwan 1-5:1.8 wwan0: register 'qmi_wwan' at usb-0000:00:14.0-5, WWAN/QMI device, 32:d8:ac:1b:14:11
[   18.560861] qmi_wwan 1-5:1.10: cdc-wdm2: USB WDM device
[   18.561186] qmi_wwan 1-5:1.10 wwan1: register 'qmi_wwan' at usb-0000:00:14.0-5, WWAN/QMI device, 32:d8:ac:1b:14:11
[   18.562097] qmi_wwan 1-5:1.11: cdc-wdm3: USB WDM device
[   18.562195] qmi_wwan 1-5:1.11 wwan2: register 'qmi_wwan' at usb-0000:00:14.0-5, WWAN/QMI device, 32:d8:ac:1b:14:11
[   18.562222] usbcore: registered new interface driver qmi_wwan

Here is output from qmicli:

[/dev/cdc-wdm1] Successfully got system info:
        GSM service:
                Status: 'none'
                True Status: 'none'
                Preferred data path: 'no'
        WCDMA service:
                Status: 'available'
                True Status: 'available'
                Preferred data path: 'no'
                Domain: 'cs-ps'
                Service capability: 'cs-ps'
                Roaming status: 'off'
                Forbidden: 'no'
                Location Area Code: '32200'
                Cell ID: '196610508'
                MCC: '505'
                MNC: '02'
                HS call status: 'hsdpa-hsupa-unsupported'
                HS service: 'dc-hsdpa-plus-hsupa-supported'
                Primary scrambling code: '44'
                Cell broadcast support: 'off'
                Call barring status (CS): 'all-calls'
                Call barring status (PS): 'all-calls'
                Cipher Domain: 'none'
        LTE service:
                Status: 'none'
                True Status: 'none'
                Preferred data path: 'no'
        SIM reject info: 'vailable'

Here are the commands I tried to use to connect:

leith@server:~$ sudo qmi-network /dev/cdc-wdm1 start
Loading previous state...
/usr/bin/qmi-network: 72: /usr/bin/qmi-network: source: not found
Starting network with 'qmicli -d /dev/cdc-wdm1 --wds-start-network=  --client-no-release-cid'...
Saving state... (CID: 12)
Saving state... (PDH: 1205786472)
Network started successfully
leith@server:~$ sudo qmi-network /dev/cdc-wdm1 status
Loading previous state...
/usr/bin/qmi-network: 72: /usr/bin/qmi-network: source: not found
Getting status with 'qmicli -d /dev/cdc-wdm1 --wds-get-packet-service-status '...
Status: connected
leith@server:~$ sudo ifconfig wwan0 up
leith@server:~$ sudo dhclient -v wwan0
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wwan0/32:d8:ac:1b:14:11
Sending on   LPF/wwan0/32:d8:ac:1b:14:11
Sending on   Socket/fallback
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 3 (xid=0x5f89d54a)
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 5 (xid=0x5f89d54a)
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 13 (xid=0x5f89d54a)
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 11 (xid=0x5f89d54a)
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 11 (xid=0x5f89d54a)
^Cleith@server:~$ sudo ifconfig wwan0 down
leith@server:~$ sudo qmi-network /dev/cdc-wdm1 stop
Loading previous state...
/usr/bin/qmi-network: 72: /usr/bin/qmi-network: source: not found
Network already stopped
Clearing state...
leith@server:~$

seems this problem only

[url]https://forum.sierrawireless.com/t/sierra-mc7304-on-debian/7297/1]

I managed to figure it out thanks to this nugget of gold lists.freedesktop.org/archives/l … 00875.html:

lists.freedesktop.org/archives/l … 00876.html:

Turns out that the first interface was raw-IP and I had to use the second interface to connect. :smiley:

Is this documented somewhere in the MC7304 technical docs? I read them but did not see anything about this.

So basically anyone using MC73xx need to be sure to use the second interface.

Only question left is why my cdc_wcm and wwan interfaces to not align (cdc starts at 1, wwan at 0). Only does this on boot, replugging or resetting the modem causes cdc to start a 0.

Well, or, instead of just using always the second interface, you can switch the data format being used in the network interface before using it. E.g. you can run this unconditionally before running the WDS Start Network command (using qmicli+libqmi+qmi_wwan):

$ qmicli -d /dev/cdc-wdm0 --wda-set-data-format=802-3

Or for older devices which don’t support the WDA service:

$ qmicli -d /dev/cdc-wdm0 --wds-noop --device-open-net="net-802-3|net-no-qos-header"

The alignment is something that isn’t guaranteed by the kernel (although they usually are aligned). If you want a quick check of which WWAN interface corresponds to which cdc-wdm port you can use (only with libqmi git master):

$ qmicli -d /dev/cdc-wdm0 --get-wwan-iface

Or, otherwise looking at sysfs, but I just find that new command quicker.