OpenWrt support for Zyxel LTE5398-M904

Is anyone able to test whether usb_power GPIO switches off only front USB or the entire USB controller together with the LTE modem?

And this on any snapshot older than last week.

if you tell me what to do I will be happy to help you

as long as it is not destructive to my router

ubus call system board
{
        "kernel": "6.6.56",
        "hostname": "LTE5398-M904",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "Zyxel LTE5398-M904",
        "board_name": "zyxel,lte5398-m904",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r27800-3c76bed6a9",
                "target": "ramips/mt7621",
                "description": "OpenWrt SNAPSHOT r27800-3c76bed6a9"
        }
}

cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 512-543, parent: platform/1e000600.gpio, 1e000600.gpio-bank0:
 gpio-512 (                    |usb_power           ) out hi 
 gpio-518 (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-520 (                    |wps                 ) in  hi IRQ ACTIVE LOW
 gpio-525 (                    |orange:lte          ) out lo 
 gpio-526 (                    |green:lte           ) out lo 
 gpio-527 (                    |red:lte             ) out lo 
 gpio-528 (                    |green:power         ) out lo 
 gpio-531 (                    |reset               ) out hi ACTIVE LOW
 gpio-534 (                    |blue:power          ) out lo 
 gpio-535 (                    |green:internet      ) out lo 
 gpio-536 (                    |green:wifi          ) out lo 
 gpio-537 (                    |green:voice         ) out lo 
 gpio-539 (                    |lte_power           ) out lo ACTIVE LOW

gpiochip1: GPIOs 544-575, parent: platform/1e000600.gpio, 1e000600.gpio-bank1:

gpiochip2: GPIOs 576-607, parent: platform/1e000600.gpio, 1e000600.gpio-bank2:

if it can help I have a usb-key inserted and mounted...

lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux 6.6.56 xhci-hcd xHCI Host Controller
Bus 001 Device 019: ID 18a5:0302 Verbatim STORE N GO
Bus 002 Device 001: ID 1d6b:0003 Linux 6.6.56 xhci-hcd xHCI Host Controller
Bus 002 Device 002: ID 2c7c:0512 Quectel EG18-EA

mount | grep sda
/dev/sda1 on /tmp/mnt type ext2 (rw,relatime)
1 Like

On r27755-a9402a83e6 echoing 0 to /sys/class/gpio/usb_power/value cuts the power to the USB port on the back; the LTE modem continues to operate.

1 Like

Thanks a lot!

2 Likes

Hello everyone!
I am trying to install openwrt on my Zyxel LTE5398-M904 and I can install the "openwrt-ramips-mt7621-zyxel_lte5398-m904-initramfs-recovery.bin" (via scp + ssh + mtd) but not the "openwrt-ramips-mt7621-zyxel_lte5398-m904-squashfs-sysupgrade. bin"

I tried with "sysupgrade" and with "mtd write" (also with CheckBypass at 0, and other options) I also tried with netcat as per openwrt docs, but nothing

Please, do not say "I tried" or "I cannot", we do not have a crystal ball here. Copy-paste the command you executed and the results that you obtained.

1 Like

Hi, perhaps the same issue like xwally.

An other way i go, was changing the network config and go online.
The install Luci and start the sysgrade there.
It does not work.
I download the .bin files multiple times.
Now i am back to OEM.

I do not know, where my mistake is.

OpenWrt SNAPSHOT, r28608-693c1ea81a
root@OpenWrt:~# sysupgrade -i /tmp/sysupgrade.bin
Keep config files over reflash (Y/n): 
Edit config file list (y/N): 
Thu Jan 16 13:11:04 GMT 2025 upgrade: Saving config files...
Thu Jan 16 13:11:06 GMT 2025 upgrade: Commencing upgrade. Closing all shell sessions.
Command failed: Connection failed
root@OpenWrt:~# Connection to 192.168.1.1 closed by remote host.
Connection to 192.168.1.1 closed.

create a custom image with the packages you prefer

https://firmware-selector.openwrt.org/?version=24.10.0-rc5&target=ramips%2Fmt7621&id=zyxel_lte5398-m904

I recommend adding the following packages:

at htop wget-ssl sed curl diffutils lsof usbutils procps-ng-watch coreutils-base64 flock lslocks picocom sms-tool qmi-utils luci-proto-qmi kmod-usb-net-cdc-mbim umbim luci-proto-mbim owut tcpdump kmod-button-hotplug openssh-client openssh-client-utils openssh-keygen block-mount e2fsprogs fdisk kmod-fs-ext4 kmod-usb-storage-uas mount-utils smartmontools
luci luci-ssl luci-app-uhttpd luci-app-firewall luci-app-https-dns-proxy pingcheck

ps: if you trust me this is the image just created with the packages I recommended:

https://sysupgrade.openwrt.org/store/21dcfc95df63a92de0d9f18beddd1e0cd5565f5c1e610783bc8191c332133ed6/openwrt-24.10.0-rc5-42ff520ad4fd-ramips-mt7621-zyxel_lte5398-m904-squashfs-sysupgrade.bin

sha256sum: ad24e02dcc358ca878add907bb716a52dcf02ed7124c0bf83456db034135d7

for the update procedure I refer you to the official documentation:

https://openwrt.org/docs/guide-user/installation/sysupgrade.cli#download_and_verify_the_openwrt_firmware_upgrade_image

after installing openwrt the first time:

and have a internet connection (edit /etc/config/network)

if you trust the created image you only have to do

cd /tmp

wget https://sysupgrade.openwrt.org/store/21dcfc95df63a92de0d9f18beddd1e0cd5565f5c1e610783bc8191c332133ed6/openwrt-24.10.0-rc5-42ff520ad4fd-ramips-mt7621-zyxel_lte5398-m904-squashfs-sysupgrade.bin

sha256sum openwrt-24.10.0-rc5-42ff520ad4fd-ramips-mt7621-zyxel_lte5398-m904-squashfs-sysupgrade.bin

sysupgrade -v openwrt-24.10.0-rc5-42ff520ad4fd-ramips-mt7621-zyxel_lte5398-m904-squashfs-sysupgrade.bin
1 Like

In ncompact i trust.
The router runs now on openwrt.
I suppose the failure was using the snapshot, says so in the wiki.

Thank you very much!

1 Like

do you need anything else?

Definitely soon. There's a lot to learn.
But for now, I'm just going to get by on my own.

Stable release version 24.10.0 doesn't come with luci-proto-qmi pre installed.
Could that package be added in the next 24.10.x release?

IMHO it’s so easy to add packages using firmware selector that it wouldn’t make sense adding any additional packages to the base image.

1 Like

Firmware selector is easy, but that shouldn't be the first place to stop by for using the device as advertised on it's device page, but rather for custom built images tailored to your needs. The latest release has luci and uqmi already installed and luci-proto-qmi is just the missing piece for sake of completeness.

Edit: Wrong package link

is it possible to speed up the "CPU" performance ?

as a script launched on this router gives me these times:

real    12m 58.91s
user    14m 25.98s
sys     1m 54.34s

instead the same script launched on a "Fritbox 4040" gives me these times:

real    0m 15.18s
user    0m 14.70s
sys     0m 6.61s

is there something that can be done ?

ps: I tried adding the "irqbalance" package without any improvements ... and I know I'm comparing performance between a dual core and a quad core but the execution time seems really disproportionate

15m vs 15s does seem like a crazy difference even with the CPU differences in mind. What is the script trying to do?

its function is to detect the packages added to the default firmware
(since they generate the images with "owut" or with "firmware selector" the scripts on the official documentation fail ...
https://openwrt.org/docs/guide-user/installation/sysupgrade.packages)

I found it on this forum:

In case you want to see what is executed, I attach the script

root@LTE5398-M904:~# cat listUserInstalled.sh

#! /bin/sh
if test ! -s /tmp/my-def-pkgs 
 then 
   echo " /tmp/my-def-pkgs was not found or is empty."
   echo " Please add list of default packages there and re-run this script."
   echo
   exit
 fi

opkg list-installed >/tmp/my-wd-input

echo "made temp file for what-depends list at /tmp/my-wd-input"
echo "generating list of packages and what depends on each to file /tmp/my-wd-output..."

for i in $( cat /tmp/my-wd-input | cut -d\  -f 1 | sort -u )
  do 
    #echo $i
    printf "."
    k=$( opkg whatdepends $i | grep  "^\t" | sed 's/^\t//g' | cut -d\  -f1 | sed 's/\n/ /g' )
    j=$( echo "$k" | wc -w )
    printf "$j\t$i\t $( echo $k )\n" >>/tmp/my-wd-output
    # printf "$j\t$i\t $( echo $k )\n"
    printf "."
done
echo ""

echo "preparing input list for user installed list..."
cat /tmp/my-wd-output | grep "^0" | cut -f2 >/tmp/my-user-inst-input

echo "The list of user installed packages is being written to /tmp/my-user-installed-packages"
echo "as well as on screen..."

for i in $( cat /tmp/my-user-inst-input)
  do
    if !(grep -Fqw $i /tmp/my-def-pkgs)
     then 
       echo $i >>/tmp/my-user-installed-packages
       echo $i
    fi
  done

echo
echo Done
echo "Clean up temp files /tmp/my-wd-output and /tmp/my-user-installed-packages in /tmp/ before re-running script."
echo

and the input file taken from firmware selector:

root@LTE5398-M904:~# cat my-def-pkgs

base-files busybox ca-bundle dnsmasq dropbear firewall4 fstools kmod-crypto-hw-eip93 kmod-gpio-button-hotplug kmod-leds-gpio kmod-mt7603 kmod-mt7615-firmware kmod-nft-offload kmod-usb-ledtrig-usbport kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 libc libgcc libustream-mbedtls logd luci mtd netifd nftables odhcp6c odhcpd-ipv6only opkg ppp ppp-mod-pppoe procd procd-seccomp procd-ujail uboot-envtools uci uclient-fetch uqmi urandom-seed urngd wpad-basic-mbedtls

Obviously I have a different list of packages, but it also takes ~15 seconds on my Zyxel.

real	0m 15.55s
user	0m 14.69s
sys	0m 8.47s

The script does opkg list-installed >/tmp/my-wd-input which takes less than 0.1s and then loops opkg whatdepends over each package printing a dot every time. Each dot takes ~0.1s and with my 213 packages/dots that would be 21.3s or in reality ~15s. The rest of the script is cat/grep/sed which should be fast enough with ~10-50kB that it processes.

1 Like

I can't figure out if you are indicating that the listUserInstalled.sh script takes many minutes on your device, but if it is, @efahl wrote a much more capable and performant utility. See post The OpenWrt Firmware Selector - #621 by efahl for the link to the code and a description. He improved it since that post. It also shows package differences between the current and version-to version if desired. See pkg-scan.sh --help for more info. You might be interested in options ./pkg-scan.sh -d -v -l to see some more verbose output and the list of default and user-added packages. pkg-scan.sh uses info from the json files on the update server so that connectivity needs to be working.

1 Like

I don't know why it takes so long on my router, it doesn't seem to be busy.

I have a script that runs every minute but I don't see much cpu usage

What can I check?