'Problems with OpenWRT LTE driver adaptation

everyone.

I tried to adapt the SLM730 LTE module to openwrt.

I use the latest v21.02.3 version

I added usb-modeswitch, kmod-mii, kmod-usb-net, kmod-usb-wdm, kmod-usb-net-qmi-wwan, uqmi, kmod-usb-serial-option, kmod-usb-serial, kmod-usb-serial-wwan, luci, luci-proto-qmi and modified the following files:

  • net/usb/qmi_wwan.c
  • usb/serial/option.c
  • usb/serial/usb_wwan.c

But it has been unable to dial successfully, only TX has data sent, RX is always 0.

The device should be successfully recognized.

root@OpenWrt:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=, Driver=hub/4p, 480M
        |__ Port 2: Dev 3, If 0, Class=, Driver=option, 480M
        |__ Port 2: Dev 3, If 1, Class=, Driver=option, 480M
        |__ Port 2: Dev 3, If 2, Class=, Driver=option, 480M
        |__ Port 2: Dev 3, If 3, Class=, Driver=option, 480M
        |__ Port 2: Dev 3, If 4, Class=, Driver=, 480M
        |__ Port 2: Dev 3, If 5, Class=, Driver=qmi_wwan, 480M

Here is the output of dmesg:

root@OpenWrt:~# dmesg
[    0.000000] Linux version 5.4.188 (xu@xu-virtual-machine) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r16554-1d4dea6d4f)) #0 Sat Apr 16 12:59:34 2022
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is Asus RT-AC51U
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=00035bf1
[    0.000000] Readback ErrCtl register=00035bf1
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 122288K/131072K available (4745K kernel code, 206K rwdata, 1048K rodata, 1224K init, 205K bss, 8784K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x358/0x54c with crng_init=0
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000010] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007611] Calibrating delay loop... 385.02 BogoMIPS (lpj=770048)
[    0.045493] pid_max: default: 32768 minimum: 301
[    0.050185] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.057240] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.071776] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.081258] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.087942] pinctrl core: initialized pinctrl subsystem
[    0.093612] NET: Registered protocol family 16
[    0.474655] mt7620-pci 10140000.pcie: PCIE0 no card, disable it(RST&CLK)
[    0.481162] mt7620-pci: probe of 10140000.pcie failed with error -1
[    0.510746] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.516229] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.522244] GPIO line 10 (enable-leds) hogged as output/low
[    0.527990] rt2880_gpio 10000688.gpio: registering 1 gpios
[    0.533337] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[    0.544501] clocksource: Switched to clocksource systick
[    0.551104] NET: Registered protocol family 2
[    0.555548] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.563304] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.571455] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.578865] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.585705] TCP: Hash tables configured (established 1024 bind 1024)
[    0.592020] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.598370] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.605409] NET: Registered protocol family 1
[    0.609655] PCI: CLS 0 bytes, default 32
[    0.616407] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.624774] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.639628] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.645300] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.673582] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.681013] printk: console [ttyS0] disabled
[    0.685220] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.694838] printk: console [ttyS0] enabled
[    0.711374] printk: bootconsole [early0] disabled
[    0.736465] spi spi0.0: force spi mode3
[    0.755771] spi-nor spi0.0: w25q128 (16384 Kbytes)
[    0.765400] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.778065] Creating 4 MTD partitions on "spi0.0":
[    0.787625] 0x000000000000-0x000000030000 : "u-boot"
[    0.798620] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.810317] 0x000000040000-0x000000050000 : "factory"
[    0.821535] 0x000000050000-0x000001000000 : "firmware"
[    0.836226] 2 uimage-fw partitions found on MTD device firmware
[    0.848103] Creating 2 MTD partitions on "firmware":
[    0.858012] 0x000000000000-0x0000001e828c : "kernel"
[    0.869101] 0x0000001e828c-0x000000fb0000 : "rootfs"
[    0.880012] mtd: device 5 (rootfs) set to be root filesystem
[    0.893263] 1 squashfs-split partitions found on MTD device rootfs
[    0.905655] 0x00000056d000-0x000000fb0000 : "rootfs_data"
[    0.928631] gsw: setting port4 to ephy mode
[    0.937039] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 3 link up (100Mbps/Full duplex)
[    0.955759] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.968361] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.985429] rt2880_wdt 10000120.watchdog: Initialized
[    0.997153] NET: Registered protocol family 10
[    1.010488] Segment Routing with IPv6
[    1.018010] NET: Registered protocol family 17
[    1.026942] 8021q: 802.1Q VLAN Support v1.8
[    1.044632] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    1.065693] Freeing unused kernel memory: 1224K
[    1.074737] This architecture does not have kernel memory protection.
[    1.087570] Run /sbin/init as init process
[    1.376461] random: fast init done
[    1.986622] init: Console is alive
[    1.993833] init: - watchdog -
[    3.420622] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.635304] usbcore: registered new interface driver usbfs
[    3.646413] usbcore: registered new interface driver hub
[    3.657139] usbcore: registered new device driver usb
[    3.674675] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.689736] ehci-fsl: Freescale EHCI Host controller driver
[    3.702634] ehci-platform: EHCI generic platform driver
[    3.723451] phy phy-usbphy.0: remote usb device wakeup disabled
[    3.735261] phy phy-usbphy.0: UTMI 16bit 30MHz
[    3.744124] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.755613] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    3.771544] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    3.788422] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    3.801994] hub 1-0:1.0: USB hub found
[    3.809990] hub 1-0:1.0: 1 port detected
[    3.823568] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.837841] ohci-platform: OHCI generic platform driver
[    3.848666] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    3.862262] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    3.878194] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    3.915374] hub 2-0:1.0: USB hub found
[    3.923373] hub 2-0:1.0: 1 port detected
[    3.936495] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.955358] init: - preinit -
[    4.080508] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    4.668805] hub 1-1:1.0: USB hub found
[    4.768271] hub 1-1:1.0: 4 ports detected
[    4.848520] random: procd: uninitialized urandom read (4 bytes read)
[    5.231629] usb 1-1.2: new high-speed USB device number 3 using ehci-platform
[    5.251938] random: jshn: uninitialized urandom read (4 bytes read)
[    5.431566] random: jshn: uninitialized urandom read (4 bytes read)
[    5.916295] urandom_read: 4 callbacks suppressed
[    5.916304] random: jshn: uninitialized urandom read (4 bytes read)
[    6.396876] 8021q: adding VLAN 0 to HW filter on device eth0
[    8.040037] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    8.058390] urandom-seed: Seed file not found (/etc/urandom.seed)
[    8.181039] procd: - early -
[    8.187091] procd: - watchdog -
[    8.847980] random: jshn: uninitialized urandom read (4 bytes read)
[    8.948155] procd: - watchdog -
[    8.955179] procd: - ubus -
[    9.185351] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.221234] procd: - init -
[   11.701987] kmodloader: loading kernel modules from /etc/modules.d/*
[   11.988760] usbcore: registered new interface driver cdc_wdm
[   12.017931] Loading modules backported from Linux version v5.10.110-0-g3238bffaf992
[   12.033279] Backport generated by backports.git v5.10.110-1-0-g1fbde860
[   12.113347] usbcore: registered new interface driver usbserial_generic
[   12.126509] usbserial: USB Serial support registered for generic
[   12.193556] xt_time: kernel timezone is -0000
[   12.239731] urngd: jent-rng init failed, err: 2
[   12.401783] PPP generic driver version 2.4.2
[   12.413893] NET: Registered protocol family 24
[   12.426633] qmi_wwan 1-1.2:1.5: work on RawIP mode
[   12.437478] qmi_wwan 1-1.2:1.5: cdc-wdm0: USB WDM device
[   12.449206] qmi_wwan 1-1.2:1.5 wwan0: register 'qmi_wwan' at usb-101c0000.ehci-1.2, WWAN/QMI device, 7a:a8:ae:e9:6e:86
[   12.470905] usbcore: registered new interface driver qmi_wwan
[   12.627036] usbcore: registered new interface driver option
[   12.638338] usbserial: USB Serial support registered for GSM modem (1-port)
[   12.652833] option 1-1.2:1.0: GSM modem (1-port) converter detected
[   12.665686] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[   12.679853] option 1-1.2:1.1: GSM modem (1-port) converter detected
[   12.692748] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[   12.706902] option 1-1.2:1.2: GSM modem (1-port) converter detected
[   12.719824] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[   12.733958] option 1-1.2:1.3: GSM modem (1-port) converter detected
[   12.746833] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3
[   12.943757] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "factory"
[   12.958194] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[   12.973669] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[   12.987503] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   13.031948] kmodloader: done loading kernel modules from /etc/modules.d/*
[   24.722303] crng init done
[   46.735943] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   46.779026] jffs2_build_filesystem(): unlocking the mtd device...
[   46.779981] done.
[   46.796204] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   48.934666] 8021q: adding VLAN 0 to HW filter on device eth0
[   49.060777] br-lan: port 1(eth0.1) entered blocking state
[   49.071639] br-lan: port 1(eth0.1) entered disabled state
[   49.082849] device eth0.1 entered promiscuous mode
[   49.092455] device eth0 entered promiscuous mode
[   49.237050] br-lan: port 1(eth0.1) entered blocking state
[   49.247889] br-lan: port 1(eth0.1) entered forwarding state
[   49.938878] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[  293.242138] done.
[  293.246035] jffs2: notice: (2443) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[  293.495834] overlayfs: upper fs does not support tmpfile.

Attach a screenshot of the network interface

enter image description here

The modified driver code is attached, please refer to

drivers.zip

After two weeks of research, I really have no clue. Please forgive my English writing.

Please give me some pointers. Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source