LT4120: Switching Modes (QMI & MBIM)

# READ THROUGH THE ENTIRE SET OF DIRECTIONS BEFORE STARTING...
# Basically you will see a bunch of errors if you use Ubuntu 16.04.6 LTS, but these errors don't matter
# As far as this working... just ignore them

# Directions below were tested from a Ubuntu 16.04.6 LTS live CD/flash drive

http://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-amd64.iso
http://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-amd64.iso.torrent

# They can also be utilized on an installed copy of Trisquel 8 /w a 4.16+ kernel installed
# See https://jxself.org/linux-libre for directions on installing a more recent kernel

http://mirror.fsf.org/trisquel-images/trisquel_8.0_amd64.iso

# Open a terminal and run the following command

sudo su
wget https://www.freedesktop.org/software/libqmi/libqmi-1.17.900.tar.xz
tar xf libqmi-1.17.900.tar.xz
cd libqmi-1.17.900
apt-get update
apt-get install libglib2.0-dev libtool gudev-1.0 libmbim-glib-dev
./configure
make
cd src/qmicli

You will get an bunch of errors like this after running make, but not to worry, the program will still work:

CC swi-update.o
swi-update.c: In function ‘download_image’:
swi-update.c:846:3: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
write(serfd, buf, rlen);

# Plug your modem into a USB port on the computer you are using
# and then use the directions below to switch to the mode you need the router in

# IMPORTANT: You must give it a good minute or so to change modes after the
# command is run to actually get the card to switch modes

# Switch from QMI to MBIM mode

./qmicli -d /dev/cdc-wdm0 --dms-change-device-download-mode=4

# Switch from MBIM to QMI mode

./qmicli -d /dev/cdc-wdm0 --dms-change-device-download-mode=2 --device-open-mbim