Several questions about Omnia - mostly about LTE modules and Omnia UI in comparison to MOFI 4500

I had some time so I wrote something that seems to me like a script. I plan to invoke it every 5 to 10 minutes from cron. Any feedback is appreciated.

Summary
 #!/bin/sh

#Ping google DNS twice through Lte, if it fails, test protocol and card state
#rather than using ping we could use nslookup?
/usr/bin/ping -c2 -w 5 -I wwan0 8.8.8.8 >/dev/null 2>&1 && { logger "Lte DNS ping success"; exit 1; }

#Qmi protocol test, if it fails use AT command to reset the modem and bring up the interface
/usr/bin/qmicli -d /dev/cdc-wdm0 --dms-uim-get-state >/dev/null 2>&1 && { logger "Qmi proto test success"; exit 2; } || { ifdown Lte; sleep 2; echo -e "AT+CFUN=1,1" > /dev/ttyUSB2; sleep 23; ifup Lte; }

#Sim card power state test, if it fails power on sim card and bring up the interface
/usr/bin/qmicli -d /dev/cdc-wdm0 --uim-get-card-status | grep "Card state: 'present'" >/dev/null 2>&1 && { loggr "Sim test success"; exit 3; } || { ifdown Lte; sleep 2; /usr/bin/qmicli -d /dev/cdc-wdm0 --uim-sim-power-on=1 >/dev/null 2>&1; sleep 23; ifup Lte; }

exit 0

Yo! Sorry, I wasn’t around the past week. Had a friend visiting me.

The script itself looks okay to me. I’d only suggest repeating each qmicli command up to 3 times, just in case there’s a temporary issue when communicating via QMI with the modem. I’ve been seeing some random timeouts using qmicli/uqmi from time to time.

I also added some formatting. New lines never hurt.

Please note I haven’t tested it. Just wrote it here on the forum.

try_many() {
  for i in 1 2 3; do
    $@ && return 1
  done
  return 0
}

try_many /usr/bin/ping -c2 -w 5 -I wwan0 8.8.8.8 >/dev/null 2>&1 && {
  logger "Lte DNS ping success"
  exit 1
}

#Qmi protocol test, if it fails use AT command to reset the modem and bring up the interface
try_many /usr/bin/qmicli -d /dev/cdc-wdm0 --dms-uim-get-state >/dev/null 2>&1 && {
  logger "Qmi proto test success"
  exit 2
} || {
  ifdown Lte
  sleep 2
  echo -e "AT+CFUN=1,1" > /dev/ttyUSB2
  sleep 23
  ifup Lte
}

#Sim card power state test, if it fails power on sim card and bring up the interface
try_many /usr/bin/qmicli -d /dev/cdc-wdm0 --uim-get-card-status | grep "Card state: 'present'" >/dev/null 2>&1 && {
  logger "Sim test success"
  exit 3
} || { 
  ifdown Lte
  sleep 2
  /usr/bin/qmicli -d /dev/cdc-wdm0 --uim-sim-power-on=1 >/dev/null 2>&1
  sleep 23
  ifup Lte
}

Also, maybe it makes sense to run it every minute in cron. For that situation, I would introduce a lock file at the beginning to skip the execution if another script from the previous cron call is still running. If you like the idea, let me know and I’ll write a flock and trap mechanism for you.

1 Like

Yes please this would be really good.

Sorry for the late post, but I have a EM7544 in an external USB3.0 enclosure. Modem is MBIM, since I use it in a PC, it offers better compatibility.
In the past (TOSv3.11), I used MBIM protocol with a custom mbim.sh script, and I didn’t have Luci support.
Since TOSv5, I’m using ModemManager. I installed luci-proto-modemmanager from Openwrt master.
Modem is recognized and configurable in Luci.
ModemManager should be able to support MBIM and QMI modems.

2 Likes

Here’s how to use flock. In your crontab, define your command as: flock -n /tmp/qmi-restarter-lock /path/to/qmi-restarter.sh. This will cause your restart script to run only if no other script is running. With this in place, you can set up your script to run every minute in cron, but it won’t run two instances of the script if the previous execution is still active.

2 Likes

I got it working using MBIM as the protocol (using updated scripts for PR by hyc), but the connection stops working after 24 hours (works again after power-cycle).
Do you have this issue?

What’s your network? AT&T maybe? I’ve had the same happen to me - not necessarily every 24 hours - it could be less, or more, sometimes even just a couple hours. AT&T has been messing with something recently: https://ltehacks.com/viewtopic.php?f=8&t=1403&start=50. I overcame it by pushing all my traffic through a VPN as apparently, AT&T blocks TCP but not UDP.

If you have a complete connection stop, you may try AT+CFUN=1,1 as shared above.

It’s an Irish one called Gomo/Eir. The connection drop is exactly 24 hours so I guess an address lease is not being renewed. Easily solved with a reboot but would be nice to have a proper fix. Thanks

Is this a typo? icomgt => comgt

To slightly improve on instructions by @Nowaker

opkg update
opkg install comgt comgt-directip kmod-mii kmod-usb-net kmod-usb-net-cdc-mbim kmod-usb-net-cdc-ncm kmod-usb-net-sierrawireless kmod-usb-serial kmod-usb-serial-qualcomm kmod-usb-serial-sierrawireless kmod-usb-serial-wwan umbim wwan
wget 'https://raw.githubusercontent.com/openwrt/openwrt/c3c409f1c70bc1aa69d3ab6b4d6af3f07c0c0d25/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh' -O /lib/netifd/proto/mbim.sh
wget 'https://raw.githubusercontent.com/openwrt/luci/8995accd5c52188388857d6e1238697e14e1b478/protocols/luci-proto-mbim/htdocs/luci-static/resources/protocol/mbim.js' -O /www/luci-static/resources/protocol/mbim.js
chmod u+x /lib/netifd/proto/mbim.sh
reboot # because I didn't know how to tell Luci UI to reload its JavaScripts
2 Likes
rm -rf /tmp/luci-*
/etc/init.d/rpcd restart
/etc/init.d/lighttpd restart

And CTRL+SHIFT+R in the browser.

1 Like

Unfortunately I am still in trouble with the modem disconnecting:

Sun Oct 25 00:29:03 IST 2020
Sun Oct 25 03:14:03 GMT 2020
Sun Oct 25 15:39:03 GMT 2020
Mon Oct 26 03:54:03 GMT 2020
Mon Oct 26 15:39:03 GMT 2020
Tue Oct 27 15:39:03 GMT 2020
Wed Oct 28 15:39:03 GMT 2020
Thu Oct 29 00:54:03 GMT 2020
Thu Oct 29 08:19:03 GMT 2020
Thu Oct 29 15:39:03 GMT 2020
Fri Oct 30 06:54:03 GMT 2020
Fri Oct 30 15:39:03 GMT 2020
Fri Oct 30 18:04:03 GMT 2020
Sat Oct 31 15:39:03 GMT 2020
Sun Nov 1 01:04:03 GMT 2020
Sun Nov 1 15:39:03 GMT 2020
Mon Nov 2 15:39:03 GMT 2020
Tue Nov 3 15:39:03 GMT 2020
Wed Nov 4 15:39:03 GMT 2020
Thu Nov 5 01:44:03 GMT 2020
Thu Nov 5 15:39:03 GMT 2020
Fri Nov 6 15:39:03 GMT 2020
Sat Nov 7 15:39:03 GMT 2020
Sun Nov 8 05:39:03 GMT 2020
Sun Nov 8 15:39:03 GMT 2020
Mon Nov 9 15:39:03 GMT 2020
Tue Nov 10 03:34:03 GMT 2020

Previously it was losing the connection every morning at around 8.20.
I thought it was 24 hours because I would manually reboot it each day.
I then setup a script to reboot if it loses connection and noticed that it now disconnects every day at 15:39.
I started rebooting each day at 5am (not shown in log) but it doesn’t seem to make a difference.

I’m guessing this may be an issue in the kernel driver?
If anyone has any ideas then please let me know.
Thanks

We don’t know why disconnects happen, and whether it’s a hardware, software or provider problem. All we can do is react to disconnects and do something about it, preferably without a reboot. Please read the thread and use some of these AT commands, usbresets and other tips and maybe you can workaround your problem.

BTW, the fact a disconnect happens exactly 15:39:03 regardless of the time you reboot would suggest it’s the ISP.

First of all, thank you for the well documented discussion. I was full of question about the SIM card slot (Omnia 1.x) and LTE antenna holes, which are shown on the main web pages but seems to gets very little discussion in the docs (maybe I’m scanning for the wrong keywords).

I have some questions regarding the LTE module you’ve used. Did you end up having to use an external antenna with it? If not, how is the reception quality when compared to something like a cellphone?

Thank you in advance.

Yes, I use external yagi (directional) antennas. The difference is huge. Worth the investment.

New summer (as I only use the modem-TO in my allotment and only use the allotment in the summer), new ISP - at last I thought I should try another one as the old one only provided UMTS but no LTE.
So I replaced the old SIM with the new one (which I beforehand checked in an older smartphone to be working well), changed the APN and added the PIN-code in /etc/config/network and I thought I’d be done, but nothing happens:

''Pincode rejected''

/etc/config/network

config interface 'lte'
	option ifname 'eth0.10'
	option proto 'mbim'
	option device '/dev/cdc-wdm0'
	option autoconnect '0'
	option apn 'web.vodafone.de'
	option pin '<pin>'

syslog

May 24 22:39:22 Router kernel: [  109.065045] usb 1-1: USB disconnect, device number 2
May 24 22:39:22 Router kernel: [  109.070224] qcserial ttyUSB0: Qualcomm USB modem converter now disconnected from ttyUSB0
May 24 22:39:22 Router kernel: [  109.078455] qcserial 1-1:1.0: device disconnected
May 24 22:39:22 Router kernel: [  109.083751] qcserial ttyUSB1: Qualcomm USB modem converter now disconnected from ttyUSB1
May 24 22:39:22 Router kernel: [  109.091951] qcserial 1-1:1.2: device disconnected
May 24 22:39:22 Router kernel: [  109.097384] qcserial ttyUSB2: Qualcomm USB modem converter now disconnected from ttyUSB2
May 24 22:39:22 Router kernel: [  109.105609] qcserial 1-1:1.3: device disconnected
May 24 22:39:22 Router kernel: [  109.110454] cdc_mbim 1-1:1.12 wwan0: unregister 'cdc_mbim' usb-f1058000.usb-1, CDC MBIM
May 24 22:39:22 Router kernel: [  116.811334] usb 1-1: new high-speed USB device number 3 using orion-ehci
May 24 22:39:22 Router kernel: [  117.012126] usb 1-1: config 1 has an invalid interface number: 12 but max is 4
May 24 22:39:22 Router kernel: [  117.019374] usb 1-1: config 1 has an invalid interface number: 13 but max is 4
May 24 22:39:22 Router kernel: [  117.026626] usb 1-1: config 1 has an invalid interface number: 13 but max is 4
May 24 22:39:22 Router kernel: [  117.033876] usb 1-1: config 1 has no interface number 1
May 24 22:39:22 Router kernel: [  117.039114] usb 1-1: config 1 has no interface number 4
May 24 22:39:22 Router kernel: [  117.046074] qcserial 1-1:1.0: Qualcomm USB modem converter detected
May 24 22:39:22 Router kernel: [  117.052678] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB0
May 24 22:39:22 Router kernel: [  117.060085] qcserial 1-1:1.2: Qualcomm USB modem converter detected
May 24 22:39:22 Router kernel: [  117.066592] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB1
May 24 22:39:22 Router kernel: [  117.073812] qcserial 1-1:1.3: Qualcomm USB modem converter detected
May 24 22:39:22 Router kernel: [  117.080566] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB2
May 24 22:39:22 Router kernel: [  117.101908] cdc_mbim 1-1:1.12: cdc-wdm0: USB WDM device
May 24 22:39:22 Router kernel: [  117.107533] cdc_mbim 1-1:1.12 wwan0: register 'cdc_mbim' at usb-f1058000.usb-1, CDC MBIM, <MAC>

Modem output

AT!GSTATUS?
!GSTATUS:
Current Time:  101              Temperature: 30
Reset Counter: 2                Mode:        ONLINE
System mode:   WCDMA            PS state:    Not attached
WCDMA band:    WCDMA 2100
WCDMA channel: 10836
GMM (PS) state:DEREGISTERED     NO IMSI
MM (CS) state: IDLE             NO IMSI

WCDMA L1 state:L1M_PCH_SLEEP    LAC:         10B9 (4281)
RRC state:   DISCONNECTED       Cell ID:     005E7250 (6189648)
RxM RSSI C0:   -67              RxD RSSI C0:  ---
RxM RSSI C1:    ---             RxD RSSI C1:  ---


OK

Screenshot luci network
grafik

It seems that somehow PIN code does not work when entered via /etc/config/network because when unlocking the SIM with AT-commands (AT+CLCK="SC",0,"<PIN>") and restarting the interface I get the following (which is the same if I do not have the Sim locked with PIN)

''Unknown error (NO_REGISTRATION)''

Syslog

May 24 21:11:31 Router netifd: Interface 'lte' is setting up now
May 24 21:11:31 Router netifd: lte (18036): mbim[18036] Reading capabilities
May 24 21:11:33 Router netifd: lte (18036):   devicetype: 0003 - remote
May 24 21:11:33 Router netifd: lte (18036):   cellularclass: 0001
May 24 21:11:33 Router netifd: lte (18036):   voiceclass: 0001 - no-voice
May 24 21:11:33 Router netifd: lte (18036):   simclass: 0002
May 24 21:11:33 Router netifd: lte (18036):   dataclass: 003C
May 24 21:11:33 Router netifd: lte (18036):   smscaps: 0003
May 24 21:11:33 Router netifd: lte (18036):   controlcaps: 0001
May 24 21:11:33 Router netifd: lte (18036):   maxsessions: 0008
May 24 21:11:33 Router netifd: lte (18036):   deviceid: 359072062690124
May 24 21:11:33 Router netifd: lte (18036):   firmwareinfo: SWI9X30C_02.20.03.00
May 24 21:11:33 Router netifd: lte (18036):   hardwareinfo: MC7455
May 24 21:11:33 Router netifd: lte (18036): mbim[18036] Checking pin
May 24 21:11:33 Router netifd: lte (18036): mbim[18036] Checking subscriber
May 24 21:11:33 Router netifd: lte (18036):   readystate: 0001 - initialized
May 24 21:11:33 Router netifd: lte (18036):   simiccid: <ID>
May 24 21:11:33 Router netifd: lte (18036):   subscriberid: <ID>
May 24 21:11:33 Router netifd: lte (18036): mbim[18036] Register with network
May 24 21:11:33 Router netifd: lte (18036):   nwerror: 0000 - unknown
May 24 21:11:33 Router netifd: lte (18036):   registerstate: 0007 - (null)
May 24 21:11:33 Router netifd: lte (18036):   registermode: 0001 - automatic
May 24 21:11:33 Router netifd: lte (18036):   availabledataclasses: 0000 - (null)
May 24 21:11:33 Router netifd: lte (18036):   currentcellularclass: 0001 - gsm
May 24 21:11:33 Router netifd: lte (18036):   provider_id: 26201
May 24 21:11:33 Router netifd: lte (18036):   provider_name: Vodafone
May 24 21:11:33 Router netifd: lte (18036):   roamingtext: (null)
May 24 21:11:33 Router netifd: lte (18036): mbim[18036] Subscriber registration failed
May 24 21:11:33 Router root: mbim bringup failed, retry in 15s

Modem output

AT!GSTATUS?
!GSTATUS:
Current Time:  2315             Temperature: 35
Reset Counter: 2                Mode:        ONLINE
System mode:   WCDMA            PS state:    Not attached
WCDMA band:    WCDMA 2100
WCDMA channel: 10836
GMM (PS) state:DEREGISTERED     LIMITED SERVICE
MM (CS) state: IDLE             LIMITED SERVICE

WCDMA L1 state:L1M_PCH_SLEEP    LAC:         10B9 (4281)
RRC state:   DISCONNECTED       Cell ID:     005E7250 (6189648)
RxM RSSI C0:   -67              RxD RSSI C0:  ---
RxM RSSI C1:    ---             RxD RSSI C1:  ---


OK

Screenshot luci network
grafik

Any idea what I can do about that or what I misconfigured?

edit1: I checked the APN directly on the modem via AT-commands and it seems it is the old one from last year. So when entering the new one directly via AT-commands (AT+CGDCONT=1,"IP","web.vodafone.de"), the connection comes up:

working

Syslog

May 24 21:42:43 Router netifd: Interface 'lte' is setting up now
May 24 21:42:43 Router netifd: lte (15412): mbim[15412] Reading capabilities
May 24 21:42:53 Router netifd: lte (15412):   devicetype: 0003 - remote
May 24 21:42:53 Router netifd: lte (15412):   cellularclass: 0001
May 24 21:42:53 Router netifd: lte (15412):   voiceclass: 0001 - no-voice
May 24 21:42:53 Router netifd: lte (15412):   simclass: 0002
May 24 21:42:53 Router netifd: lte (15412):   dataclass: 003C
May 24 21:42:53 Router netifd: lte (15412):   smscaps: 0003
May 24 21:42:53 Router netifd: lte (15412):   controlcaps: 0001
May 24 21:42:53 Router netifd: lte (15412):   maxsessions: 0008
May 24 21:42:53 Router netifd: lte (15412):   deviceid: <ID>
May 24 21:42:53 Router netifd: lte (15412):   firmwareinfo: SWI9X30C_02.20.03.00
May 24 21:42:53 Router netifd: lte (15412):   hardwareinfo: MC7455
May 24 21:42:53 Router netifd: lte (15412): mbim[15412] Checking pin
May 24 21:42:53 Router netifd: lte (15412): mbim[15412] Checking subscriber
May 24 21:42:53 Router netifd: lte (15412):   readystate: 0001 - initialized
May 24 21:42:53 Router netifd: lte (15412):   simiccid: <ID>
May 24 21:42:53 Router netifd: lte (15412):   subscriberid: <ID>
May 24 21:42:53 Router netifd: lte (15412): mbim[15412] Register with network
May 24 21:42:54 Router netifd: lte (15412):   nwerror: 0000 - unknown
May 24 21:42:54 Router netifd: lte (15412):   registerstate: 0003 - home
May 24 21:42:54 Router netifd: lte (15412):   registermode: 0001 - automatic
May 24 21:42:54 Router netifd: lte (15412):   availabledataclasses: 0020 - lte
May 24 21:42:54 Router netifd: lte (15412):   currentcellularclass: 0001 - gsm
May 24 21:42:54 Router netifd: lte (15412):   provider_id: 26202
May 24 21:42:54 Router netifd: lte (15412):   provider_name: Vodafone
May 24 21:42:54 Router netifd: lte (15412):   roamingtext: (null)
May 24 21:42:54 Router netifd: lte (15412): mbim[15412] Attach to network
May 24 21:42:54 Router netifd: lte (15412):   nwerror: 0000 - unknown
May 24 21:42:54 Router netifd: lte (15412):   packetservicestate: 0002 - attached
May 24 21:42:54 Router netifd: lte (15412):   uplinkspeed: 50000000
May 24 21:42:54 Router netifd: lte (15412):   downlinkspeed: 300000000
May 24 21:42:54 Router netifd: lte (15412): mbim[15412] Connect to network
May 24 21:42:54 Router netifd: lte (15412):   sessionid: 0
May 24 21:42:54 Router netifd: lte (15412):   activationstate: 0001 - activated
May 24 21:42:54 Router netifd: lte (15412):   voicecallstate: 0000 - none
May 24 21:42:54 Router netifd: lte (15412):   nwerror: 0000 - unknown
May 24 21:42:54 Router netifd: lte (15412):   iptype: 0001 - ipv4
May 24 21:42:54 Router netifd: lte (15412): mbim[15412] Connected, obtain IP address and configure interface
May 24 23:42:54 Router kernel: [ 3965.378289] IPv6: ADDRCONF(NETDEV_UP): wwan0: link is not ready
May 24 23:42:54 Router kernel: [ 3965.384772] 8021q: adding VLAN 0 to HW filter on device wwan0
May 24 21:42:54 Router netifd: Interface 'lte' is now up
May 24 21:42:54 Router netifd: Network device 'wwan0' link is up

Interfaces
grafik
Modem

AT!GSTATUS?
!GSTATUS:
Current Time:  75               Temperature: 36
Reset Counter: 3                Mode:        ONLINE
System mode:   LTE              PS state:    Attached
LTE band:      B1               LTE bw:      20 MHz
LTE Rx chan:   100              LTE Tx chan: 18100
LTE CA state:  NOT ASSIGNED
EMM state:     Registered       Normal Service
RRC state:     RRC Idle
IMS reg state: No Srv

PCC RxM RSSI:  -53              RSRP (dBm):  -79
PCC RxD RSSI:  -44              RSRP (dBm):  -71
Tx Power:      0                TAC:         B447 (46151)
RSRQ (dB):     -7.4             Cell ID:     030D7514 (51213588)
SINR (dB):     27.0


OK

So the necessary question is: why are the parameters from within /etc/config/network not transferred to the MC7455? It worked in case of the first ISP/APN last year, but it didn’t update when I entered the new ISP/APN and a PIN (which I didn’t use last year).
Are the parameters somewhat stored within the modem? But if so - why are they not updated? Did maybe a update break it?