Archer MR200 built in 4G modem in QMI mode

Hello
I have Archer MR200 with built in Qualcom 4G modem and OpenWRT 19.07.07 running on this device. I was lucky and after some manipulations I have able to set it's modem in qmi mode. All of packages described here was installed.
So I get encouraging answers and finally has cdc device

~# ls -l /dev/cdc-wdm0
crw-------    1 root     root      180, 176 Jul 29 11:37 /dev/cdc-wdm0
lsusb
Bus 001 Device 002: ID 05c6:9025 Qualcomm, Inc. Qualcomm HSUSB Device
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=option, 12M
    |__ Port 1: Dev 2, If 1, Class=Vendor Specific Class, Driver=usbfs, 12M
    |__ Port 1: Dev 2, If 2, Class=Vendor Specific Class, Driver=option, 12M
    |__ Port 1: Dev 2, If 3, Class=Vendor Specific Class, Driver=option, 12M
    |__ Port 1: Dev 2, If 4, Class=Vendor Specific Class, Driver=qmi_wwan, 12M
    |__ Port 1: Dev 2, If 5, Class=Mass Storage, Driver=, 12M

then dmesg command shows I haven't any ttyUSB ports

dmesg | grep usb
[    5.957169] usbcore: registered new interface driver usbfs
[    5.962948] usbcore: registered new interface driver hub
[    5.968463] usbcore: registered new device driver usb
[    6.004560] phy phy-usbphy.0: remote usb device wakeup disabled
[    6.010607] phy phy-usbphy.0: UTMI 16bit 30MHz
[   12.412244] usb 1-1: new full-speed USB device number 2 using ohci-platform
[   13.310103] usbcore: registered new interface driver cdc_acm
[   13.393673] usbcore: registered new interface driver cdc_wdm
[   13.491181] hso: drivers/net/usb/hso.c: Option Wireless
[   13.496814] usbcore: registered new interface driver hso
[   13.558405] usbcore: registered new interface driver ipheth
[   13.952267] usbcore: registered new interface driver usbserial
[   13.958320] usbcore: registered new interface driver usbserial_generic
[   13.965103] usbserial: USB Serial support registered for generic
[   14.171525] usbcore: registered new interface driver cdc_ether
[   14.201299] usbcore: registered new interface driver cdc_ncm
[   14.394231] usbcore: registered new interface driver huawei_cdc_ncm
[   14.455515] usbcore: registered new interface driver keyspan
[   14.461377] usbserial: USB Serial support registered for Keyspan - (without firmware)
[   14.469524] usbserial: USB Serial support registered for Keyspan 1 port adapter
[   14.477091] usbserial: USB Serial support registered for Keyspan 2 port adapter
[   14.484690] usbserial: USB Serial support registered for Keyspan 4 port adapter
[   14.710443] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[   14.811147] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-101c1000.ohci-1, WWAN/QMI device, 0e:d2:97:e5:4a:d1
[   14.822083] usbcore: registered new interface driver qmi_wwan
[   14.842430] usbcore: registered new interface driver rndis_host
[   14.932217] usbcore: registered new interface driver cdc_mbim
[   15.384391] usbcore: registered new interface driver option
[   15.390165] usbserial: USB Serial support registered for GSM modem (1-port)
[   15.416815] usbcore: registered new interface driver qcserial
[   15.422855] usbserial: USB Serial support registered for Qualcomm USB modem

Then I used next

echo "05c6 9025" > /sys/bus/usb-serial/drivers/option1/new_id

and get ttyUSB ports, but only till next reboot of device. It works only for current session.
After router's restart I have't ttyUSB anymore
So the first question is there a way to fix ttyUSB not only for current session?

dmesg | grep usb
[    5.957169] usbcore: registered new interface driver usbfs
[    5.962948] usbcore: registered new interface driver hub
[    5.968463] usbcore: registered new device driver usb
[    6.004560] phy phy-usbphy.0: remote usb device wakeup disabled
[    6.010607] phy phy-usbphy.0: UTMI 16bit 30MHz
[   12.412244] usb 1-1: new full-speed USB device number 2 using ohci-platform
[   13.310103] usbcore: registered new interface driver cdc_acm
[   13.393673] usbcore: registered new interface driver cdc_wdm
[   13.491181] hso: drivers/net/usb/hso.c: Option Wireless
[   13.496814] usbcore: registered new interface driver hso
[   13.558405] usbcore: registered new interface driver ipheth
[   13.952267] usbcore: registered new interface driver usbserial
[   13.958320] usbcore: registered new interface driver usbserial_generic
[   13.965103] usbserial: USB Serial support registered for generic
[   14.171525] usbcore: registered new interface driver cdc_ether
[   14.201299] usbcore: registered new interface driver cdc_ncm
[   14.394231] usbcore: registered new interface driver huawei_cdc_ncm
[   14.455515] usbcore: registered new interface driver keyspan
[   14.461377] usbserial: USB Serial support registered for Keyspan - (without firmware)
[   14.469524] usbserial: USB Serial support registered for Keyspan 1 port adapter
[   14.477091] usbserial: USB Serial support registered for Keyspan 2 port adapter
[   14.484690] usbserial: USB Serial support registered for Keyspan 4 port adapter
[   14.710443] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[   14.811147] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-101c1000.ohci-1, WWAN/QMI device, 0e:d2:97:e5:4a:d1
[   14.822083] usbcore: registered new interface driver qmi_wwan
[   14.842430] usbcore: registered new interface driver rndis_host
[   14.932217] usbcore: registered new interface driver cdc_mbim
[   15.384391] usbcore: registered new interface driver option
[   15.390165] usbserial: USB Serial support registered for GSM modem (1-port)
[   15.416815] usbcore: registered new interface driver qcserial
[   15.422855] usbserial: USB Serial support registered for Qualcomm USB modem
[  188.140331] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[  188.154665] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[  188.168950] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2

Then I was tryed to use some basic qmi commands but it's not worked for me. All the time on any command I have "Failed to open device"

uqmi -d / dev / cdc-wdm0 --get-current-settings
Failed to open device
uqmi -d / dev / cdc-wdm0 --get-data-status
Failed to open device
uqmi -d / dev / cdc-wdm0 --get-signal-info
Failed to open device

I add new WAN QMI intesface and of course the connection didn't work

Iterface 'yota' is setting up now
Wed Jul 28 16:04:04 2021 daemon.notice netifd: yota (4092): Waiting for SIM initialization
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4092): PIN verification is disabled
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4092): Waiting for network registration
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4092): Starting network yota
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4092): Unable to connect IPv4
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4174): Stopping network yota
Wed Jul 28 16:04:05 2021 daemon.notice netifd: yota (4174): Command failed: Permission denied
Wed Jul 28 16:04:05 2021 daemon.notice netifd: Interface 'yota' is now down

So guys is there any chance to have working qmi in my case. So I'm out of ideas. And yes I also tryed usb modeswitch and thats not work also. I even haven't any answer from it

usbmode -l
usbmode -s

So I spend a lot of time and it's to bad to stop in one step from... Please any help and suggestions are welcome. I hope somebody can help me. Thanx!

add your echo to /etc/rc.local

remove unnecessary spaces

show its settings - copy/paste the relevant part of /etc/config/network

Thanx AndrerwZ for your quick answer.

Great! It works. And I have third port ttyUSB3. ttyUSB2 was the last one in my message abobe.

root@OpenWrt:~# dmesg | grep usb
[    5.960733] usbcore: registered new interface driver usbfs
[    5.966498] usbcore: registered new interface driver hub
[    5.972017] usbcore: registered new device driver usb
[    6.007430] phy phy-usbphy.0: remote usb device wakeup disabled
[    6.013492] phy phy-usbphy.0: UTMI 16bit 30MHz
[   12.374294] usb 1-1: new full-speed USB device number 2 using ohci-platform
[   13.308560] usbcore: registered new interface driver cdc_acm
[   13.364945] usbcore: registered new interface driver cdc_wdm
[   13.486919] hso: drivers/net/usb/hso.c: Option Wireless
[   13.492484] usbcore: registered new interface driver hso
[   13.540401] usbcore: registered new interface driver ipheth
[   13.933830] usbcore: registered new interface driver usbserial
[   13.939990] usbcore: registered new interface driver usbserial_generic
[   13.946775] usbserial: USB Serial support registered for generic
[   14.156414] usbcore: registered new interface driver cdc_ether
[   14.189948] usbcore: registered new interface driver cdc_ncm
[   14.387363] usbcore: registered new interface driver huawei_cdc_ncm
[   14.447587] usbcore: registered new interface driver keyspan
[   14.453461] usbserial: USB Serial support registered for Keyspan - (without firmware)
[   14.461604] usbserial: USB Serial support registered for Keyspan 1 port adapter
[   14.469165] usbserial: USB Serial support registered for Keyspan 2 port adapter
[   14.476756] usbserial: USB Serial support registered for Keyspan 4 port adapter
[   14.706737] usbcore: registered new interface driver MOSCHIP usb-ethernet driver
[   14.805033] qmi_wwan 1-1:1.4 wwan0: register 'qmi_wwan' at usb-101c1000.ohci-1, WWAN/QMI device, 3a:85:58:1a:e3:9b
[   14.815957] usbcore: registered new interface driver qmi_wwan
[   14.832970] usbcore: registered new interface driver rndis_host
[   14.916395] usbcore: registered new interface driver cdc_mbim
[   15.348782] usbcore: registered new interface driver option
[   15.354644] usbserial: USB Serial support registered for GSM modem (1-port)
[   15.381579] usbcore: registered new interface driver qcserial
[   15.387635] usbserial: USB Serial support registered for Qualcomm USB modem
[   29.587507] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[   29.601703] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[   29.615984] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[   29.630191] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
root@OpenWrt:~# ls /dev | grep ttyUSB
ttyUSB0
ttyUSB1
ttyUSB2
ttyUSB3

Sorry thats my fault. I remove all spaces and get some result with one command:

root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
root@OpenWrt:~#

All other commands like --get-current-settings or --get-signal-info are freezing up console or shows "Failed to connect to service".

config interface 'yota'
	option proto 'qmi'
	option apn 'internet.yota'
	option device '/dev/cdc-wdm0'
	option delegate '0'
	option pdptype 'ipv4'
	option auth 'none'

Any ideas? I still cant get it to work

add ff to your echo line:
echo "05c6 9025 ff" > /sys/bus/usb-serial/drivers/option1/new_id

Correct your pdptype - ipv4 is not a valid option, the allowed values are IP (for IPv4), IPV6 (for IPv6) or IPV4V6 (for dual-stack)
Remove delegate, auth
Add option dhcp '0' (subject to test)

It seems a great solution. Now all qumi command are working

root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-current-settings
"Out of call"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-signal-info
{
        "type": "lte",
        "rssi": -88,
        "rsrq": -11,
        "rsrp": -114,
        "snr": 104
}
root@OpenWrt:~#

Then I creating wan to connect. Here is actual part of network file

config interface '4G'
	option proto 'qmi'
	option apn 'internet.yota'
	option device '/dev/cdc-wdm0'
	option pdptype 'ip'
	option dhcp '0'

But connection is still failed

Sat Jul 31 08:16:47 2021 daemon.notice netifd: Interface '4G' is setting up now
Sat Jul 31 08:16:47 2021 daemon.notice netifd: 4G (3564): Waiting for SIM initialization
Sat Jul 31 08:16:47 2021 daemon.notice netifd: 4G (3564): PIN verification is disabled
Sat Jul 31 08:16:48 2021 daemon.notice netifd: 4G (3564): Waiting for network registration
Sat Jul 31 08:16:48 2021 daemon.notice netifd: 4G (3564): Starting network 4G
Sat Jul 31 08:16:48 2021 daemon.notice netifd: 4G (3564): Unable to connect IPv4
Sat Jul 31 08:16:48 2021 daemon.notice netifd: 4G (3620): Stopping network 4G
Sat Jul 31 08:16:49 2021 daemon.notice netifd: 4G (3620): Command failed: Permission denied
Sat Jul 31 08:16:49 2021 daemon.notice netifd: Interface '4G' is now down

And uqmi commans are not working and again starts to freeze up the console.

Consider using ROOter. This firmware is based on OpenWrt and is known for great modems support.
You can ask for an up-to-date image for your device here.