QMI configuration in openWrt

Modern USB-modems can be connected to the network not only in standard way via serial ports (ttyUSBx) but via QMI interface.

Standard connecting a modem with a USB connection looks like the following (if in two words):
Modem is connected to the usb port and a set of serial ports are created in the system. The modem settings can be adjusted via AT-commands and the modem can be connected to the network. As a rule a driver from the kernel menu is responsible for the creating of the serial port set (ttyUSBx):
USB Serial Converter support.

This driver is not required for modems with QMI interface. But we need a kernel driver:
USB_NET_QMI_WWAN
or optio:
kmod-usb-net-qmi-wwan in openwrt.
Besides we need to install the packet:
uqmi.

And no the section looks like the following in the configuration file /etc/config/network:

config interface 'wwan0'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option modes 'umts'
        option username 'gdata'
        option password 'gdata'
        option apn 'internet'
        option ifname 'wwan0'

The output ifconfig looks like the following after network restart or device restart:

# ifconfig
wwan0     Link encap:Ethernet  HWaddr 7E:0E:3B:46:6F:0D  
          inet addr:10.209.197.186  Bcast:10.209.197.187  Mask:255.255.255.252
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:252 errors:0 dropped:0 overruns:0 frame:0
          TX packets:252 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21143 (20.6 KiB)  TX bytes:24439 (23.8 KiB)

It is not required to set dhcp options for this interface because openwrt system does it by default. Output ps:

# ps
1798 root      1220 S    udhcpc -p /var/run/udhcpc-wwan0.pid -s /lib/netifd/

We can use the utility uqmi for more information about connection.

Signal level and connection type:

#uqmi -d /dev/cdc-wdm0 --get-signal-inf
{
        "type": "wcdma",
        "rssi": -83,
        "ecio": 20
}

Operator name:

# uqmi -d /dev/cdc-wdm0 --get-serving-system
{
        "registration": "registered",
        "plmn_mcc": 250,
        "plmn_mnc": 2,
        "plmn_description": "MegaFon",
        "roaming": false
}