TL-MR6400 v4 - LTE modem for WAN connection

DTR in this context is https://en.wikipedia.org/wiki/Data_Terminal_Ready

And then you might ask what an RS232 terminal signal has to do with a USB connected digital radio... The DTR is mapped to a specific USB control request in the USB Communication class spec. A few years ago Qualcomm started using this request as a suspend/resume signal in their vendor specific QMI/RMNET protocol. So we have to send that request to the modem to wake it. Which is what the DTR patch is about.

(I've been talking about making this behaviour default for all devices for years, but never got around to actually doing that. should probably stop talking about it...)

1 Like

Thank you so much for clarifying this. That's very helpful, and finally makes sense to me. Haha, please don't stop talking about it. If something makes things easier for everyone else, then we should certainly be doing it :slightly_smiling_face:

After more than year, I have returned to this problem to work on it further. First of all I believe I got it working using the latest stable release at this time (openwrt-22.03.3-ramips-mt76x8-tplink_tl-mr6400-v4-squashfs-sysupgrade) to be specific. There are no custom compiled packages required.

After some trial an error, I noticed that the uqmi service often hangs out on very the first try, it would often fail on this step:

Fri Apr 14 11:33:16 2023 daemon.notice netifd: wwan (2142): Network registration failed (reason: '')
Fri Apr 14 11:33:16 2023 daemon.notice netifd: wwan (2502): Stopping network wwan
Fri Apr 14 11:33:16 2023 daemon.notice netifd: wwan (2502): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "wwan" } (Permission denied)

I noticed that after killing these stale process(es) and restarting the network interface again the protocol works as expected. I also tried amending the qmi.sh script but wasn't lucky. Therefore I created a custom script that is invoked from /etc/rc.local after system start.

qmi-workaround

#!/bin/sh


max_retry=3
retry=1

if [ "$(ip addr show wwan0 | grep -c DOWN)" -ne 0 > /dev/null ]; then
    while ip addr show wwan0 | grep -c DOWN > /dev/null; do
        if [ "$retry" -le "$max_retry" ]; then
            if [ "$retry" -eq 1 ]; then
                logger -t netifd Trying to bring up wwan0
            else
                logger -t netifd Trying to bring up wwan0 - Retry $retry
            fi
            killall uqmi > /dev/null 2>&1
            ifdown wwan
            sleep 5
            ifup wwan
            let retry++
        sleep 10;
        else
            logger -t netifd Max retries reached
        return 1
        fi
    done
    logger -t netifd Successfully brought up wwan0
else
    logger -t netifd Interface wwan is not down, moving on
fi

For reference this is how the interface definition looks like in /etc/config/network.

config interface 'wwan'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option modes 'lte,umts'
        option apn 'internet'
        option dhcp '0'
        option pincode '0000'
        option auth 'none'
        option pdptype 'ipv4'

Hope it helps.