March 11, 2015

Linux running 4G LTE modem

The modem I have is Sierra Wireless Air Prime MC7453 Mini PCI Express Module.  The carrier I tested is AT&T.

Before running on Linux, I had to install the card on a regular Laptop that supports 4G card, and run Windows 7 on the laptop, install all the drivers and the Sierra Wireless Connect Manager to try out the card. This confirmed that the card has the latest firmware, and the carrier setting is correct, etc.

Next I run it on Linux. Instead of using the Gobi driver from Sierra Wireless, I used the qmi_wwan driver in the latest Linux (after kernel version 3.14).  An user land utility is also needed. libqmi seems to be popular, but it depends on a fairly new version of glib, which itself depends on a bunch of libraries. It becomes a hassle to compile everything. Then I discovered uqmi, a small utility developed and used by the openwrt project. It's much more lightweight, and seems to be pretty mature. I was able to get my modem to connect and ping with the following commands.

device="/dev/cdc-wdm1"
modes="lte"
uqmi -s -d "$device" --get-pin-status
uqmi -s -d "$device" --get-serving-system
uqmi -s -d "$device" --set-data-format 802.3
uqmi -s -d "$device" --wda-set-data-format 802.3
uqmi -s -d "$device" --set-network-modes "$modes"
wds=`uqmi -s -d "$device" --get-client-id wds`
uqmi -s -d "$device" --set-client-id wds,"$wds" --start-network "ISP.CINGULAR" --autoconnect
uqmi -s -d "$device" --get-signal-info
uqmi -s -d "$device" --get-data-status
dhclient wwan1

Now I can ping

To disconnect:
uqmi -s -d "$device" --stop-network 0xffffffff    --autoconnect > /dev/null


[1] The home page of uqmi:  http://nbd.name/gitweb.cgi?p=uqmi.git;a=summary
[2] A list of useful commands of how to use uqmi: http://trac.gateworks.com/wiki/modem
[3] The official Openwrt qmi script that uses uqmi:  https://dev.openwrt.org/browser/trunk/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
[4] Another useful link: https://lists.openwrt.org/pipermail/openwrt-devel/2014-April/025046.html

6 comments:

  1. Hello,

    Have you tested it with dual stack IPs?

    ReplyDelete
  2. You made everything click! After many days of researching and hitting dead ends, finding the wrong information all over the Internet, this was the first place that actually had the correct commands to use. Keep in mind, this works great on OpenWRT and possibly DD-WRT as long as you have the correct drivers loaded. The ROOter modification of OpenWRT includes all needed modem drivers preinstalled and active which really helps when you don't have working internet connection. Some Sierra devices default to raw-ip mode and need to be switched to 802.3 mode as shown above. In particular the "Netgear" Sierra 341u needs to be switched to 802.3 while disconnected from cellular network. From what I can tell, uqmi cannot diconnect the modem. My strategy so far is to disable Autoconnect in the modem's management webpage, send the
    uqmi -d "$device" --set-device-operating-mode offline
    uqmi -d "$device" --set-device-operating-mode reset
    to get the device offline, then execute the rest of the commands above to check signal, put the device in 802.3 mode, and finally connect.

    ReplyDelete
  3. You made everything click! After many days of researching and hitting dead ends, finding the wrong information all over the Internet, this was the first place that actually had the correct commands to use. Keep in mind, this works great on OpenWRT and possibly DD-WRT as long as you have the correct drivers loaded. The ROOter modification of OpenWRT includes all needed modem drivers preinstalled and active which really helps when you don't have working internet connection. Some Sierra devices default to raw-ip mode and need to be switched to 802.3 mode as shown above. In particular the "Netgear" Sierra 341u needs to be switched to 802.3 while disconnected from cellular network. From what I can tell, uqmi cannot diconnect the modem. My strategy so far is to disable Autoconnect in the modem's management webpage, send the
    uqmi -d "$device" --set-device-operating-mode offline
    uqmi -d "$device" --set-device-operating-mode reset
    to get the device offline, then execute the rest of the commands above to check signal, put the device in 802.3 mode, and finally connect.

    ReplyDelete
  4. Thank you! This clarified everything for me. Between wading around all over the Internet through misinformation, shitty manufacturer provided drivers, and a lack of information on QMI and uqmi in general this has been a pain. I got this working in OpenWRT with the ROOter modification that includes all needed drivers for these modems. This is a plus when you are working without an internet connection!

    In order to get the "Netgear" Sierra 341u working in IP Passthrough mode with Openwrt or DD-WRT it absolutely needs to be switched to 802.3 mode. This does not work for some reason while the device is connected to the cellular 3g or 4g network. So I actually have to disable Autoconnect in the management web page of the device, take the device offline with
    uqmi -d "$device" --set-device-operating-mode offline
    then reboot the modem with
    uqmi -d "$device" --set-device-operating-mode reset

    Then the above process works great.

    ReplyDelete
  5. Thank you! This clarified everything for me. Between wading around all over the Internet through misinformation, shitty manufacturer provided drivers, and a lack of information on QMI and uqmi in general this has been a pain. I got this working in OpenWRT with the ROOter modification that includes all needed drivers for these modems. This is a plus when you are working without an internet connection!

    In order to get the "Netgear" Sierra 341u working in IP Passthrough mode with Openwrt or DD-WRT it absolutely needs to be switched to 802.3 mode. This does not work for some reason while the device is connected to the cellular 3g or 4g network. So I actually have to disable Autoconnect in the management web page of the device, take the device offline with
    uqmi -d "$device" --set-device-operating-mode offline
    then reboot the modem with
    uqmi -d "$device" --set-device-operating-mode reset

    Then the above process works great.

    ReplyDelete