# Install OpenWrt on TP-Link TL-MR6400 V5 using QMI I write this, because i had several problems to connect the LTE modul with the existing tutorials. A. https://openwrt.org/toh/tp-link/tl-mr6400_v5 - Wrong package `luci-proto-uqmi`, no usage of the existing LuCi configuration B. https://gist.github.com/gamwe6/ef726b550037957a4d6d5255dc7efa7a - I was not able to use the package "modemmanager" because of insuffient drive space ## So, these are the steps to succeed: 1. Download OpenWrt firmware image from here: https://openwrt.org/toh/tp-link/tl-mr6400_v5 (at time of writing this in April 2023, i got version 22.03.04) 1.1 On Mac using TFTP-Server (dnsmasq) and the TFTP-recovery image (as descripted on the firmware download page) 2. Install the package "luci-proto-qmi" using LuCi: "System" -> "Software" 3. Configure the modem using LuCi: Network -> Interfaces -> "Add new interface" -> Protocol "QMI Cellular" using modem at "/dev/cdc-wdm0" 4. The LTE interface should be running and connected now ### LTE problem and quick fix Sometimes the uqmi commands hang and result in a not connected LTE interface. `If you type any uqmi command and get no output, you may need to edit the qmi.sh script to fix it.` The file is located in /lib/netifd/proto/qmi.sh Locate the line that looks like this: ```` while uqmi -s -d "$device" --get-pin-status | grep '"UIM uninitialized"' > /dev/null; do ```` On OpenWRT 19.7 it's on line 83. It might be on a different line if you have a newer or older OS version. Add the following 3 lines before the line above. ```` uqmi -s -d "$device" --get-pin-status & sleep 3 killall uqmi || echo "UQMI now works fine!" ```` Thanks a lot to https://teklager.se/en/knowledge-base/openwrt-4g-wwan-configuration/ for this hint! ### LTE disconnect problem after dhcp lease and quick fix Use this check in cron (add by using crontab -e), if the gateway is missing after dhcp lease and the interface is not connected anymore. This code will restart the network interfaces to reconnect all interfaces. ``` * * * * * [ "$(uqmi -d /dev/cdc-wdm0 --get-current-settings | grep -oFm1 "Out of call")" != "Out of call" ] || /etc/init.d/network restart ``` Follow ups: - https://github.com/openwrt/openwrt/issues/6196 - https://forum.turris.cz/t/setting-up-lte-modem/14762/21