Skip to content

Instantly share code, notes, and snippets.

@NiKiZe
Created September 2, 2021 19:19
Show Gist options
  • Save NiKiZe/cc80ba9689296568f03f823899d109c5 to your computer and use it in GitHub Desktop.
Save NiKiZe/cc80ba9689296568f03f823899d109c5 to your computer and use it in GitHub Desktop.
Start MC7700 LTE on Raspberry Pi
#!/bin/bash
# Connect a Raspberry Pi to LTE using MC7700 Mini PCI Modem with adapter to USB-C
sudo qmicli -d /dev/cdc-wdm0 -p --wds-stop-network
sudo cat /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set dev wwan0 down
# Enable OS Raw IP Mode setting (not persistent)
sudo su -c "echo Y > /sys/class/net/wwan0/qmi/raw_ip"
sudo qmicli -d /dev/cdc-wdm0 -p --device-open-net="net-raw-ip|net-no-qos-header" --wds-start-network="ip-type=6" --client-no-release-cid
sudo qmicli -d /dev/cdc-wdm0 -p --device-open-net="net-raw-ip|net-no-qos-header" --wds-start-network="ip-type=4" --client-no-release-cid
sudo ip link set dev wwan0 up
sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-current-settings
ip a
sudo ip r del default
sudo udhcpc -q -f -n -i wwan0
# -q exit after getting lease
# -f Foreground wait
# -n exit if no lease
# TODO fix no DNS
sudo qmicli -d /dev/cdc-wdm0 --nas-get-signal-info; \
sudo qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength; \
sudo qmicli -d /dev/cdc-wdm0 --nas-get-home-network; \
sudo qmicli -d /dev/cdc-wdm0 --nas-get-serving-system; \
sudo qmicli -d /dev/cdc-wdm0 --nas-get-system-info
sudo qmi-network /dev/cdc-wdm0 status
sudo qmicli -d /dev/cdc-wdm0 --wds-get-packet-service-status
sudo qmicli -d /dev/cdc-wdm0 -p --nas-get-signal-info --nas-get-signal-strength --nas-get-home-network --nas-get-serving-system
sudo qmi-network /dev/cdc-wdm0 status
sudo qmicli -d /dev/cdc-wdm0 --wds-get-packet-service-status
@NiKiZe
Copy link
Author

NiKiZe commented Dec 13, 2021

Another go at this and ended up with:

lsusb
# Bus 001 Device 038: ID 1199:68a2 Sierra Wireless, Inc.
sudo apt-get install libqmi-utils
sudo apt-get install ModemManager
sudo systemctl start ModemManager
sudo mmcli -L
# /org/freedesktop/ModemManager1/Modem/1 [Sierra Wireless, Incorporated] MC7700
sudo mmcli -m 1
sudo mmcli -m 1 --simple-connect="apn=4g.tele2.se,ip-type=ipv4v6"
mmcli -b 3

Before that some alternative notes that did not work out in the end

sudo systemctl stop ModemManager
sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --get-wwan-iface
sudo qmicli --device=/dev/cdc-wdm0 --get-expected-data-format

sudo ip link set dev wwan0 down
sudo su -c (echo Y > /sys/class/net/wwan0/qmi/raw_ip)

sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-current-settings

sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --get-service-version-info

#qmicli -v -d=/dev/cdc-wdm0 --wds-start-network="ip-type=6,apn=4G.tele2.se" --client-no-release-cid
CID=$(sudo qmicli -d /dev/cdc-wdm0 -p --wds-noop --client-no-release-cid|grep CID|cut -d\' -f2)
sudo qmicli -d /dev/cdc-wdm0 -p --wds-start-network="ip-type=4" --client-cid=$CID --client-no-release-cid
sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-current-settings
CID=$(sudo qmicli -d /dev/cdc-wdm0 -p --wds-noop --client-no-release-cid|grep CID|cut -d\' -f2)
sudo qmicli -d /dev/cdc-wdm0 -p --wds-start-network="ip-type=6" --client-cid=$CID --client-no-release-cid

#sudo qmicli -d /dev/cdc-wdm0 -p --wds-set-autoconnect-settings enabled
sudo qmicli -d /dev/cdc-wdm0 -p --wds-get-current-settings
sudo ip link set dev wwan0 up

@mickeygoldsmith
Copy link

mickeygoldsmith commented Dec 20, 2021

I am using: Bus 001 Device 004: ID 1199:68a2 Sierra Wireless, Inc. MC7700
And I have a Ting NanoSIM installed.
mmcli -L output is:
/org/freedesktop/ModemManager1/Modem/1 [Sierra Wireless, Incorporated] MC7700

@NiKiZe
Copy link
Author

NiKiZe commented Dec 20, 2021

$ sudo mmcli -m 1
  --------------------------------
  General  |            dbus path: /org/freedesktop/ModemManager1/Modem/1
           |            device id: 12xxxx
  --------------------------------
  Hardware |         manufacturer: Sierra Wireless, Incorporated
           |                model: MC7700
           |             revision: SWI9200X_03.05.29.03ap r6485 CNSHZ-ED-XP0031 2014/12/02 17:53:15
           |         h/w revision: 1.0
           |            supported: gsm-umts, lte
           |              current: gsm-umts, lte
           |         equipment id: 0128100xxxxxx86
  --------------------------------
  System   |               device: /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4
           |              drivers: qmi_wwan, qcserial
           |               plugin: Sierra
           |         primary port: cdc-wdm0
           |                ports: ttyUSB0 (qcdm), ttyUSB2 (at), cdc-wdm0 (qmi), wwan0 (net)
  --------------------------------
  Numbers  |                  own: xxx
  --------------------------------
  Status   |                 lock: sim-pin2
           |       unlock retries: sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)
           |                state: disabled
           |          power state: on
           |       signal quality: 0% (cached)
  --------------------------------
  Modes    |            supported: allowed: 2g; preferred: none
           |                       allowed: 3g; preferred: none
           |                       allowed: 4g; preferred: none
           |                       allowed: 2g, 3g; preferred: 3g
           |                       allowed: 2g, 3g; preferred: 2g
           |                       allowed: 2g, 4g; preferred: 4g
           |                       allowed: 2g, 4g; preferred: 2g
           |                       allowed: 3g, 4g; preferred: 3g
           |                       allowed: 3g, 4g; preferred: 4g
           |                       allowed: 2g, 3g, 4g; preferred: 4g
           |                       allowed: 2g, 3g, 4g; preferred: 3g
           |                       allowed: 2g, 3g, 4g; preferred: 2g
           |              current: allowed: 2g, 3g, 4g; preferred: 2g
  --------------------------------
  Bands    |            supported: egsm, dcs, pcs, g850, utran-1, utran-6, utran-5, utran-2,
           |                       eutran-1, eutran-4, eutran-17
           |              current: egsm, dcs, pcs, g850, utran-1, utran-6, utran-5, utran-2,
           |                       eutran-1, eutran-4, eutran-17
  --------------------------------
  IP       |            supported: ipv4, ipv6, ipv4v6
  --------------------------------
  3GPP     |                 imei: 0128100xxxxxx86
  --------------------------------
  3GPP EPS | ue mode of operation: ps-1
  --------------------------------
  SIM      |

Modem might be locked to provider
Updated firmware can be found at https://source.sierrawireless.com/resources/airprime/software/mc7700-firmware-package-history/#sthash.wFyZHx8a.dpbs (free account needed)

How to update firmware: https://sigquit.wordpress.com/2016/12/09/qmi-firmware-update-with-libqmi/

$ sudo qmi-firmware-update \
     --update \
     -d 1199:68a2 \
     9999999_9999999_9200_03.05.29.03_00_generic_000.000_001_SPKG_MC.cwe

Also: https://forums.whirlpool.net.au/archive/3vx1k1r3-5#r56848760

Other things to check using qmicli is which profiles exists, sim locks etc. - All that is out of scope from just a bunch of notes.

@NiKiZe
Copy link
Author

NiKiZe commented Jan 1, 2022

Listing modems:

  • mmcli -L
    Getting details, machine readable
  • mmcli -m 3 -K

Bearer sometimes goes away, no way to get it back, list-bearer and friends no longer exists in 1.10
Bearer | dbus path: /org/freedesktop/ModemManager1/Bearer/1

@kuydigital
Copy link

Hi! I just installed a LTE hat and MC7700 on my Raspberry 3B+. Do I just run the script "start_wwan.sh" to make it work? Are there any prerequisites? Thanks!

@peterall
Copy link

Du är en klippa Christian @NiKiZe! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment