| 155 | * [wiki:wireless/modem#uqmi uqmi] |
| 156 | |
| 157 | |
| 158 | [=#link-protocol] |
| 159 | ==== Link Protocols ==== |
| 160 | QMI modems support multiple link protocols: |
| 161 | - 802-3: wraps IP packets within Ethernet frames (similar to an Ethernet device) like traditional modems |
| 162 | - raw-ip: does away with the Ethernet layer and provides raw IP frames which is more efficient and allows higher throughput, but disallows things that rely on 802-3 such as DHCP |
| 163 | |
| 164 | Some QMI modem/firmware/SIM combinations support 802-3 only, others support raw-ip only, and some support both. It is important to make sure the driver and the network device are configured to use the same link protocol. |
| 165 | |
| 166 | |
| 167 | [=#ip-family] |
| 168 | ==== IP Family ==== |
| 169 | QMI modem/firmware/SIM combinations can support IPv4, IPv6, or both IP families. If you are trying to connect and receive an error related to IP family check that your asking for something supported. |
| 170 | |
| 171 | |
| 172 | [=#client-cid] |
| 173 | ==== Client ID ==== |
| 174 | To use QMI services you need a 'Client ID' or CID. The CID's can be created then released when they are no longer needed. When working with sessions the CID is what allows QMI services to be operated on the right session. Both libqmi and uqmi userspace applications allow you to issue QMI commands by using an existing specified CID and to not release CID upon completion. It is important to use this when configuring and starting connections. For example, you can have an ipv4 session concurrent with an ipv6 session, each must have their own CID that is not released (until the connection is closed) and must be used when referring to those sessions. |
| 175 | |
| 176 | When using {{{qmicli}} you do this with the {{{--client-cid=<cid>}}} and the {{{--client-no-release-cid}}} options. |
| 177 | |
| 178 | When using {{{uqmi}}} you obtain a client-id with the {{{--get-client-id}}} option and use an existing one with the {{{--get-client-id}}} option and release a CID with the {{{---release-client-id}}} option. |
552 | | '''Connection Notes''': |
553 | | |
554 | | If your !Modem/Firmware/SIM combination supports the 802-3 protocol, you can use dhcp instead of manually configuring the interface: |
555 | | {{{#!bash |
556 | | echo "APN=h2g2" > /etc/qmi-network.conf # specify APN |
557 | | echo "PROXY=yes" >> /etc/qmi-network.conf # allow ports to be shared by multiple libqmi apps |
558 | | qmicli -p -d /dev/cdc-wdm0 --wda-set-data-format=802-3 # set data format (raw-ip/802-3) |
559 | | qmicli -p -d /dev/cdc-wdm0 --set-expected-data-format=802-3 # set expected format, should match above |
560 | | qmi-network /dev/cdc-wdm0 start |
561 | | dhclient wwan0 |
562 | | }}} |
563 | | |
564 | | Some sims require that a particular IP family be used to establish a connection. The IP family can be specified on the command line when you start the network: |
565 | | {{{#!bash |
566 | | qmicli -p -d /dev/cdc-wdm0 --wda-set-data-format=802-3 # set data format (raw-ip/802-3) |
567 | | qmicli -p -d /dev/cdc-wdm0 --set-expected-data-format=802-3 # set expected format, should match above |
568 | | qmicli -p -d /dev/cdc-wdm0 --wds-start-network="apn=h2g2,ip-type=4" --client-no-release-cid |
569 | | dhclient wwan0 |
570 | | }}} |
571 | | |
572 | | Notice that the start network commands used above, including the {{{qmi-network}}} call, all contain the {{{--client-no-release-cid}}} argument. This along with the {{{--client-cid=[CID]}}} argument provides the saving and recall of client IDs. The client ID (CID) references a client of a QMI service running in the firmware of the modem which in this case is qmicli. Unless saved, the CID will be released once the call is finished and the program will exit. This behavior is expected for short lived commands like checking network status or signal strength but would result in an instantly dropped network connection if the "start network" call does not have its CID saved. |
| 590 | Troubleshooting QMI connection issues: |
| 591 | - make sure you are using a [wiki:wireless/modem#link-protocol Link Protocol] compatible with your modem/firmware/SIM |
| 592 | - make sure you are using an [wiki:wireless/modem#ip-family IP Family] compatible with your modem/firmware/SIM |
| 593 | - don't use DHCP if its not supported by your carrier or if your not using the 802-3 link protocol - instead use 'wds-get-current-settings' and manually configure the interface |
| 594 | - make sure you are not releasing the [wiki:wireless/modem#client-id Client ID] when connecting to the network |
1840 | | * {{{/sys/class/net/wwan1}}} - data for GSM |
1841 | | * {{{/sys/class/net/wwan2}}} |
1842 | | |
1843 | | Modem: |
1844 | | For using with GSM, please use these lines inside the /etc/config/network file. |
1845 | | {{{#!bash |
1846 | | config interface 'wan' |
1847 | | option ifname 'wwan1' |
1848 | | option proto 'qmi' |
1849 | | option apn 'ISP.CINGULAR' |
1850 | | option device '/dev/cdc-wdm1' |
1851 | | option delay '90' |
1852 | | }}} |
| 1867 | * {{{/sys/class/net/wwan1}}} |
| 1868 | |
| 1869 | OpenWrt configuration: |
| 1870 | {{{#!bash |
| 1871 | uci set network.wan=interface |
| 1872 | uci set network.wan.ifname=wwan0 |
| 1873 | uci set network.wan.proto=qmi |
| 1874 | uci set network.wan.apn=vzwinternet |
| 1875 | uci set network.wan.device=/dev/cdc-wdm0 |
| 1876 | uci set network.wan.autoconnect=0 |
| 1877 | uci commit network |
| 1878 | }}} |
| 1879 | - '''it is important to configure autoconnect=0 as shown above for OpenWrt otherwise qmi.sh will not connect''' |