4G dongle : DWM-222

Hey,
I'm trying to make work a 4G USB dongle.

Device : DWM-222 A2 (I also made sure to update the firmware from windows 10)
Usb code : 2001:7e3d

Supposed to work in serial & qmi (or so I guess if it works for dd-wrt ? Couldn't find a thing for openwrt) https://wiki.dd-wrt.com/wiki/index.php/Mobile_Broadband#D-Link

Going for QMI install, I tried https://openwrt.org/docs/guide-user/network/wan/wwan/ltedongle

Dmesg output inserting the dongle :

[  695.067060] usb 1-1: new high-speed USB device number 5 using ehci-platform
[  698.541445] usb 1-1: USB disconnect, device number 5
[  698.947072] usb 1-1: new high-speed USB device number 6 using ehci-platform
[  699.228041] option 1-1:1.0: GSM modem (1-port) converter detected
[  699.234596] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[  699.242604] option 1-1:1.1: GSM modem (1-port) converter detected
[  699.249171] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[  699.257290] option 1-1:1.2: GSM modem (1-port) converter detected
[  699.263788] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[  699.271817] option 1-1:1.3: GSM modem (1-port) converter detected
[  699.278374] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[  699.397367] qmi_wwan 1-1:1.4: cdc-wdm0: USB WDM device
[  699.406261] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1, WWAN/QMI device, e6:98:24:d2:55:63

I also get a device in /dev/cdc-wdm0

I tried adding an interface with

  • Protocol: QMI Cellular
  • device: /dev/cdc-wdm0
  • Firwall wwan

I sadly had no clue on what to do at 'Enter your APN and select the IP type as instructed by the carrier.' I got not instruction ! :<

Of courtse it ended up with the following error on the new interface :

Error: Unknown error (NETWORK_REGISTRATION_FAILED)

Just google for "{your operator name } apn configuration"

Yup, was doing just that in the same time - found "free" for the Free ISP.
While I kinda stalled on the automatic setup, doing it manually seemed to get me a step further.

$ uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
$ uqmi -d /dev/cdc-wdm0 --get-signal-info
{
	"type": "wcdma",
	"rssi": -74,
	"ecio": 8
}
$ uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
89996864
$ uqmi -d /dev/cdc-wdm0 --get-data-status
"connected"

And a LED light up on the dongle. Promising !
Now I have no clue what to do from there !
The interface shows no activity

**RX:** 0 B (0 Pkts.)
**TX:** 0 B (0 Pkts.)

My lack of knowledge shows now, no ideas how to plug "into it" ?

You don't really need to run uqmi manually.
Since you see wcdma you probably have no LTE coverage. I suggest to test this SIM in the phone first.
If the test is positive, please show your QMI interface configuration (as text), then connect to the modem AT command port and make a few standard checks through the terminal. Assuming you have no other devices with serial interfaces, run
picocom /dev/ttyUSB2
and query your modem with AT+CGDCONT?

Yep it work - H+ is some place but can also 4GLTE in others.

You mean in /etc/config/network ?

config interface 'QMI_dongle'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option apn 'free'
        option auth 'none'
        option pdptype 'ipv4v6'

I'll do as you say because I have no clue what's relevant to give ! Also nope, only one USB port available.

$picocom /dev/ttyUSB2
picocom v3.1

port is        : /dev/ttyUSB2
flowcontrol    : none
baudrate is    : 9600
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","free","0.0.0.0",0,0```

OK, change pdptype to ip in interface configuration and from the terminal send AT+CGDCONT=1,"IP","free" to the modem.
Exit the terminal, reconnect the modem, wait a minute and show what is in the system log. There is no need to share the full log, we are only interested in what happened after the modem was plugged in.

Please change the interface name to something like lte or mobile - all lowercase and without "_".

$picocom /dev/ttyUSB2
AT+CGDCONT=1,"IP","free"
OK
Terminating...
Thanks for using picocom

$ nano /etc/config/network
config interface 'mobile'
	option proto 'qmi'
	option device '/dev/cdc-wdm0'
	option apn 'free'
	option auth 'none'
	option pdptype 'ip'

<Unpluging the dongle, reconnecting aaaand.

$dmesg
[  148.395747] usb 1-1: new high-speed USB device number 3 using ehci-platform
[  151.652678] usb 1-1: USB disconnect, device number 3
[  152.105836] usb 1-1: new high-speed USB device number 4 using ehci-platform
[  152.403879] option 1-1:1.0: GSM modem (1-port) converter detected
[  152.410471] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[  152.418481] option 1-1:1.1: GSM modem (1-port) converter detected
[  152.425009] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[  152.433065] option 1-1:1.2: GSM modem (1-port) converter detected
[  152.439621] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[  152.447637] option 1-1:1.3: GSM modem (1-port) converter detected
[  152.454131] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[  152.576417] qmi_wwan 1-1:1.4: cdc-wdm0: USB WDM device
[  152.587188] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1, WWAN/QMI device, 16:75:fb:75:01:8f

(I hope I'm doing this right :octopus: - Dunno if it means anything but the LED does turn from red to green at this point)

You need to show what is in the system log, not in the kernel log (dmesg output).
Unplug your modem, run logread -f, plug the modem back and collect the output.

Alright, first time using logread for me ^^'

$ logread -f
Wed Nov 29 19:58:10 2023 kern.info kernel: [ 1821.982347] usb 1-1: new high-speed USB device number 7 using ehci-platform
Wed Nov 29 19:58:13 2023 kern.info kernel: [ 1825.225178] usb 1-1: USB disconnect, device number 7
Wed Nov 29 19:58:13 2023 kern.info kernel: [ 1825.632455] usb 1-1: new high-speed USB device number 8 using ehci-platform
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.913456] option 1-1:1.0: GSM modem (1-port) converter detected
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.920011] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.928024] option 1-1:1.1: GSM modem (1-port) converter detected
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.934588] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.942663] option 1-1:1.2: GSM modem (1-port) converter detected
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.949165] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.957210] option 1-1:1.3: GSM modem (1-port) converter detected
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1825.963783] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1826.072974] qmi_wwan 1-1:1.4: cdc-wdm0: USB WDM device
Wed Nov 29 19:58:14 2023 kern.info kernel: [ 1826.080780] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-1b000000.usb-1, WWAN/QMI device, 16:75:fb:75:01:8f
Wed Nov 29 19:58:20 2023 daemon.info vnstatd[3445]: Info: Interface "wwan0" enabled.

Missing all the interesting stuff )
run logread -f again and restart the QMI interface in the Web interface (Luci).

Thanks again for your time ~

Wed Nov 29 20:07:49 2023 daemon.notice netifd: Interface 'mobile' is setting up now
Wed Nov 29 20:07:49 2023 daemon.notice netifd: mobile (13138): Waiting for SIM initialization
Wed Nov 29 20:07:49 2023 daemon.notice netifd: mobile (13138): PIN verification is disabled
Wed Nov 29 20:07:50 2023 daemon.notice netifd: mobile (13138): Waiting for network registration
Wed Nov 29 20:07:51 2023 daemon.notice netifd: mobile (13138): Starting network mobile
Wed Nov 29 20:08:27 2023 daemon.notice netifd: mobile (13138): Unable to connect IPv4
Wed Nov 29 20:08:28 2023 daemon.notice netifd: mobile (13173): Stopping network mobile
Wed Nov 29 20:08:28 2023 daemon.notice netifd: mobile (13173): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "mobile" } (Permission denied)
Wed Nov 29 20:08:28 2023 daemon.notice netifd: Interface 'mobile' is now down
Wed Nov 29 20:08:28 2023 daemon.notice netifd: Interface 'mobile' is setting up now
Wed Nov 29 20:08:28 2023 daemon.notice netifd: mobile (13181): Waiting for SIM initialization
Wed Nov 29 20:08:28 2023 daemon.notice netifd: mobile (13181): PIN verification is disabled
Wed Nov 29 20:08:29 2023 daemon.warn odhcpd[1983]: No default route present, overriding ra_lifetime!
Wed Nov 29 20:08:29 2023 daemon.notice netifd: mobile (13181): Waiting for network registration
Wed Nov 29 20:08:41 2023 daemon.notice netifd: mobile (13181): Network registration failed, registration timeout reached
Wed Nov 29 20:08:41 2023 daemon.notice netifd: mobile (13338): Stopping network mobile
Wed Nov 29 20:08:41 2023 daemon.notice netifd: mobile (13338): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "mobile" } (Permission denied)
Wed Nov 29 20:08:41 2023 daemon.notice netifd: Interface 'mobile' is now down
Wed Nov 29 20:08:42 2023 daemon.warn odhcpd[1983]: No default route present, overriding ra_lifetime!

Try moving your router+modem to a better location and try again.

I put it where the phone did have the best 4G reception this time (like 2 bars)

Wed Nov 29 20:05:29 2023 daemon.err uhttpd[2103]: [info] luci: accepted login on /admin/network/network for root from 192.168.1.200
Wed Nov 29 20:05:42 2023 daemon.notice netifd: mobile (4455): Stopping network mobile
Wed Nov 29 20:05:42 2023 daemon.notice netifd: mobile (4455): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "mobile" } (Permission denied)
Wed Nov 29 20:05:42 2023 daemon.notice netifd: Interface 'mobile' is now down
Wed Nov 29 20:05:42 2023 daemon.notice netifd: Interface 'mobile' is setting up now
Wed Nov 29 20:05:43 2023 daemon.notice netifd: mobile (4464): Waiting for SIM initialization
Wed Nov 29 20:05:43 2023 daemon.warn odhcpd[1748]: No default route present, overriding ra_lifetime!
Wed Nov 29 20:05:44 2023 daemon.info dnsmasq[1]: read /etc/hosts - 12 names
Wed Nov 29 20:05:44 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 4 names
Wed Nov 29 20:05:44 2023 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 2 names
Wed Nov 29 20:05:44 2023 daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Wed Nov 29 20:05:59 2023 daemon.warn odhcpd[1748]: No default route present, overriding ra_lifetime!
Wed Nov 29 20:06:15 2023 daemon.warn odhcpd[1748]: No default route present, overriding ra_lifetime!
Wed Nov 29 20:09:07 2023 user.err adblock-4.1.5[1616]: dns backend restart with adblock blocklist failed
Wed Nov 29 20:09:07 2023 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: started, version 2.89 cachesize 1000
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: DNS service limited to local subnets
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-nftset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq-dhcp[1]: DHCP, IP range 192.168.1.100 -- 192.168.1.249, lease time 12h
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using nameserver 80.67.169.12#53
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using nameserver 80.67.169.40#53
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using nameserver 80.67.169.12#53
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using nameserver 80.67.169.40#53
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using nameserver 8.8.8.8#53
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for test
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for local
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: read /etc/hosts - 12 names
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 4 names
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 2 names
Wed Nov 29 20:09:11 2023 daemon.info dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses

(I kinda guess the dnsmasq frenzy is unrelated but. Yeah. It's weird. It doesn't timeout this time, but doesn't say success either ?)

This is the only information about the modem connection, the rest is unrelated.

You need to watch for the progress after these lines:

Oh well, sometimes just retrying get different results. I like having an IP.

Wed Nov 29 20:37:28 2023 daemon.notice netifd: Interface 'mobile' is setting up now
Wed Nov 29 20:37:28 2023 daemon.notice netifd: mobile (8138): Waiting for SIM initialization
Wed Nov 29 20:37:29 2023 daemon.notice netifd: mobile (8138): PIN verification is disabled
Wed Nov 29 20:37:30 2023 daemon.notice netifd: mobile (8138): Waiting for network registration
Wed Nov 29 20:37:31 2023 daemon.notice netifd: mobile (8138): Starting network mobile
Wed Nov 29 20:37:31 2023 daemon.notice netifd: mobile (8138): Setting up wwan0
Wed Nov 29 20:37:31 2023 daemon.notice netifd: Interface 'mobile' is now up
Wed Nov 29 20:37:31 2023 daemon.notice netifd: Network device 'wwan0' link is up
Wed Nov 29 20:37:32 2023 daemon.notice netifd: Network alias 'wwan0' link is up
Wed Nov 29 20:37:32 2023 daemon.notice netifd: Interface 'mobile_4' is enabled
Wed Nov 29 20:37:32 2023 daemon.notice netifd: Interface 'mobile_4' has link connectivity
Wed Nov 29 20:37:32 2023 daemon.notice netifd: Interface 'mobile_4' is setting up now
Wed Nov 29 20:37:32 2023 daemon.notice netifd: mobile_4 (8379): udhcpc: started, v1.36.1
Wed Nov 29 20:37:32 2023 daemon.notice netifd: mobile_4 (8379): udhcpc: broadcasting discover
Wed Nov 29 20:37:32 2023 daemon.notice netifd: mobile_4 (8379): udhcpc: broadcasting select for 10.142.120.5, server 10.142.120.6
Wed Nov 29 20:37:32 2023 daemon.notice netifd: mobile_4 (8379): udhcpc: lease of 10.142.120.5 obtained from 10.142.120.6, lease time 7200
Wed Nov 29 20:37:33 2023 daemon.notice netifd: Interface 'mobile_4' is now up
Wed Nov 29 20:37:35 2023 daemon.info vnstatd[4279]: Info: Interface "wwan0" enabled.
Wed Nov 29 20:37:36 2023 user.notice nlbwmon: Reloading nlbwmon due to ifup of mobile (wwan0)
Wed Nov 29 20:37:38 2023 user.notice nlbwmon: Reloading nlbwmon due to ifup of mobile_4 (wwan0)

Now that it work (the router CAN ping internet !) - thanks ! - I have a (very common) question. How do I make it available to my network ?
I used to have "br-lan" a brige with eth0.1 and usb0 port (with another dongle a friend uses and works pretty much "plug&play"). Is there a way to have them all "plug&play" or should I make a dedicated interface ? I'm really not sure how it should be done.

...But I guess this is another scope a question quite unrelated. - I wish I knew what made it work in the end. I don't even know which answer to mark as "the answer" :melting_face:

You always need to create an interface and put it into the right firewall zone.
Bridging wwan device with LAN is wrong, this way the whole logic of OpenWrt router will be broken.

I'll assume that the change in device position was the finishing touch. So you can mark #11 as a solution.

Is there a small "let's start with the basics" with a few easy example ? I really feel like doing dark magic when I handle theses. Dark magic that might break the router (I already succeed at blocking everything with a very bad interface edit once, had to flash openwrt again like a champ T_T)

Something like this?

I really don't get it. :face_holding_back_tears: I'm not against an example about what could be done from a default setup to tie the "QMI Cellular interface" to LAN ?

I read the things, and it just washes over me. Maybe an example could help that. If it's not too much of a bother that is.