- edited description
Bug listing TTYS in switch4g
In line 577 all devices are listed
TTYS=$(ls -d $PATHDIAG/$DEVICENAME/${DEVICENAME}*/usb:cdc-wdm?* 2>/dev/null | sed -e "s/.*\/\//.*/g" -e "s/.*://g")
In my case I’m using a ZTE 4G modem (19d2:0166) so that line gives me "cdc-wdm0 cdc-wdm1"
then in line 580 the TTYS is redefined as TTYS="/dev/$TTYS"
as $TTYS was "cdc-wdm0 cdc-wdm1"
now TTYS is "/dev/cdc-wdm0 cdc-wdm1"
Then DNVR
and "$PREFIX"_modem_dev
is set incorrectly.
"$PREFIX"_modem_dev
is used in connect() function and in line 50 the script evaluates if "$DEVNR
" exists and it doesn’t and the exits.
I could make progress in the script by adding a head -n 1 in the line 577
TTYS=$(ls -d $PATHDIAG/$DEVICENAME/${DEVICENAME}*/usb:cdc-wdm?* 2>/dev/null | sed -e "s/.*\/\//.*/g" -e "s/.*://g" | tail -n 1)
(tail, because I found the device where I can get data from is cdc-wdm1
)
If more than one may be better test which one returns data (like uqmi --get-capabilities)
Now I’m getting other error (more kernel related) which I’m trying to figure that out.
kern.err kernel: ehci_hcd 0000:00:0b.1: force halt; handshake d0bb0014 00004000 00000000 -> -110
Jun 21 22:04:38 unknown kern.err kernel: qmi_wwan 2-2:1.4: Error submitting int urb - -110
Jun 21 22:04:38 unknown kern.err kernel: qmi_wwan 2-2:1.4: Error submitting int urb - -108
Comments (36)
-
reporter -
repo owner You didn’t provide information what is your router and on what FW version of FreshTomato.
-
repo owner Waiting for your answer.
Also what gives you:
uqmi -d /dev/cdc-wdm0 --get-capabilities
and
uqmi -d /dev/cdc-wdm1 --get-capabilities
?
Without these informations, I can’t do anything…
-
reporter Sorry I’m travelling and I don’t have the device with me. Tomorrow I will give you the response for those commands.
The router I’m using is a Netgear R7000 in the latest version of the firmware (2023.3).
Thank you in advance!
-
reporter Here it is the information:
#root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm0 --get-capabilities ^C"Failed to connect to service" -->> it never returned, then ctrl+c messages log: Jun 30 20:42:43 unknown kern.err kernel: qmi_wwan 2-2:1.3: unknown notification 32 received: index 3 len 2 root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --get-capabilities { "max_tx_channel_rate": 50000000, "max_rx_channel_rate": 100000000, "data_service": "simultaneous_cs_ps", "sim": "supported", "networks": [ "gsm", "umts", "lte" ] } Steps I did before running the --get-capabilities commands: root@unknown:/tmp/home/root# lsusb Bus 001 Device 001: ID 1d6b:0003 Bus 002 Device 001: ID 1d6b:0002 Bus 002 Device 003: ID 19d2:0166 root@unknown:/tmp/home/root# modprobe -r qmi_wwan root@unknown:/tmp/home/root# /usr/sbin/usb_modeswitch -Q -c /etc/usb_modeswitch.d/19d2:0166 -v 19d2 -p 0166 -b 002 -g 002 root@unknown:/tmp/home/root# lsusb Bus 001 Device 001: ID 1d6b:0003 Bus 002 Device 001: ID 1d6b:0002 Bus 002 Device 003: ID 19d2:0167 root@unknown:/tmp/home/root# modprobe qmi_wwan messages after switching Jun 30 20:41:18 unknown kern.info kernel: scsi1 : usb-storage 2-2:1.5 Jun 30 20:41:19 unknown kern.notice kernel: scsi 1:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 Jun 30 20:41:35 unknown kern.info kernel: usbcore: registered new interface driver cdc_wdm Jun 30 20:41:35 unknown kern.info kernel: qmi_wwan 2-2:1.3: cdc-wdm0: USB WDM device Jun 30 20:41:35 unknown kern.info kernel: qmi_wwan 2-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.1-2, WWAN/QMI device, 8a:17:a3:19:24:10 Jun 30 20:41:35 unknown kern.info kernel: qmi_wwan 2-2:1.4: cdc-wdm1: USB WDM device Jun 30 20:41:35 unknown kern.info kernel: qmi_wwan 2-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.1-2, WWAN/QMI device, 8a:17:a3:19:24:10 Jun 30 20:41:35 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan
-
reporter additional info.
root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --stop-network 0xffffffff --autoconnect "No effect" root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --set-data-format 802.3 root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --wda-set-data-format 802.3 root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --wda-get-data-format "802.3" root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --sync root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --get-serving-system { "registration": "searching", "roaming": false }
It never changed the registration state. After a while I got
root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm1 --get-serving-system Failed to open device
In the log there was these
Jun 30 21:10:52 unknown kern.info kernel: usb 2-2: USB disconnect, address 3 Jun 30 21:10:52 unknown kern.info kernel: qmi_wwan 2-2:1.3: wwan0: unregister 'qmi_wwan' usb-0000:00:0b.1-2, WWAN/QMI device Jun 30 21:10:52 unknown kern.info kernel: qmi_wwan 2-2:1.4: wwan1: unregister 'qmi_wwan' usb-0000:00:0b.1-2, WWAN/QMI device Jun 30 21:10:57 unknown kern.info kernel: usb 2-2: new high speed USB device using ehci_hcd and address 4 Jun 30 21:10:57 unknown kern.info kernel: scsi2 : usb-storage 2-2:1.0 Jun 30 21:10:58 unknown kern.notice kernel: scsi 2:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2
Then even reloading the driver nor running the /usr/sbin/usb_modeswitch again (lsusb told me the product id was 0166 again), I was no able to get the device up. I needed to reboot the router.
-
repo owner So one more test; enter:
uqmi -d /dev/cdc-wdm0 --get-capabilities
let it hangs and check in 2nd shell:
ps | grep [u]qmi
Thanks.
-
reporter Hi Pedro! Thank you!
Here are several commands executed within 30s between each other
root@unknown:/tmp/home/root# ps | grep [u]qmi 1758 root 828 S uqmi -d /dev/cdc-wdm0 --get-capabilities root@unknown:/tmp/home/root# ps | grep [u]qmi 1758 root 828 S uqmi -d /dev/cdc-wdm0 --get-capabilities root@unknown:/tmp/home/root# ps | grep [u]qmi 1758 root 828 S uqmi -d /dev/cdc-wdm0 --get-capabilities root@unknown:/tmp/home/root# ps | grep [u]qmi 1758 root 828 S uqmi -d /dev/cdc-wdm0 --get-capabilities
It run for 4 min and when I cancel (ctrl+c)
root@unknown:/tmp/home/root# uqmi -d /dev/cdc-wdm0 --get-capabilities ^C"Failed to connect to service"
-
repo owner - changed status to new
-
repo owner Try this switch4g script: https://bitbucket.org/pedro311/freshtomato-arm/downloads/switch4g
Remember to only check “USB 1.1 Support”, because qmi_wwan driver has problems with other modules.
So, change USB module to 1.1, halt router, switch off power, connect modem, switch on power, and please let me know (with log).
//EDIT: I forgot to say: first copy this new version of switch4g file to JFFS and mount it in Admin → Scripts → Init:
mount --bind /path/to/added/switch4g /usr/sbin/switch4g
-
reporter Thank you Pedro!.
I realized I didn’t have checked USB 1.1 Support. I followed your instructions, here are the results.
NOTE: I kept the WAN2 config untouched before following the instructions (set as 4G modem).
NOTE2: As I don’t know how to update the script without making a new built or overriding built in scripts I copied the script to /tmp/ and run it from there. But as I already had the WAN 2 configured. The old script did the switch. So when I logged in the router I had this
root@unknown:/tmp/home/root# lsusb Bus 001 Device 001: ID 1d6b:0003 Bus 002 Device 001: ID 1d6b:0002 Bus 003 Device 001: ID 1d6b:0001 Bus 002 Device 003: ID 19d2:0167
root@unknown:/tmp/home/root# nvram get wan2_modem_dev /dev/cdc-wdm0 cdc-wdm1
If I run the script
/tmp/switch4g wan2 connect
I got this error becausewan2_modem_dev
is not well definedroot@unknown:/tmp/home/root# /tmp/switch4g wan2 connect sh: MODEM: unknown operand log in messaged (I added a LOG to debug variables) Jul 10 14:34:13 unknown user.notice switch4g[1909]: Variables: MTYPE= qmi_wwan, DEVNR= /dev/cdc-wdm0 cdc-wdm1 Jul 10 14:34:13 unknown user.notice switch4g[1909]: 4G MODEM - DIAG interface not found - connection terminated!
Then I configured
wan2_modem_dev
as the device I know it works (/dev/cdc-wdm1
)root@unknown:/tmp/home/root# nvram set wan2_modem_dev="/dev/cdc-wdm1"
Then I run the command again
root@unknown:/tmp/home/root# /tmp/switch4g wan2 connect "No effect" sh: MODEM: unknown operand messages log Jul 10 14:37:12 unknown user.notice switch4g[1956]: Variables: MTYPE= qmi_wwan, DEVNR= /dev/cdc-wdm1 Jul 10 14:37:12 unknown user.notice switch4g[1956]: 4G MODEM - connecting ... Jul 10 14:37:18 unknown user.notice switch4g[1956]: 4G MODEM - waiting for network registration ... Jul 10 14:37:50 unknown user.notice switch4g[1956]: 4G MODEM - network registration failed!
Probably since changing USB 1.1 support, but now I see info here where before I didn’t
Thank you in advance!
-
repo owner You must follow exactly my instruction, otherwise I’ll still don’t know what’s going on:
Copy this new version of switch4g file somewhere to JFFS and add this script to Administration → Scripts → Init:
mount --bind /path/to/new/switch4g /usr/sbin/switch4g
Click Save.
Next, change USB module to 1.1 (only! the rest has to be unchecked, only “Core USB Support“ and “USB 1.1 Support“) - click save, wait a minute, halt router, switch off power, connect modem, switch on power, and please let me know (with log, filter by “switch4g” - starting with “
4G MODEM - detecting ...
“ up to last entry with “switch4g”).New version of switch4g: https://bitbucket.org/pedro311/freshtomato-arm/downloads/switch4g
-
reporter Thank you Pedro. After reboot, this is what I got in the logs
root@unknown:/tmp/home/root# cat /var/log/messages | grep switch4g Jan 1 01:00:15 unknown user.notice switch4g[941]: 4G MODEM - detecting ... Jan 1 01:00:15 unknown user.notice switch4g[941]: 4G MODEM not found in USB_ModeSwitch database - already switched? Loading modules... Jan 1 01:00:16 unknown user.notice switch4g[941]: 4G MODEM WAN (qmi_wwan) not found ... Jan 1 01:00:18 unknown user.notice switch4g[941]: 4G MODEM WAN (cdc_ether) not found ... Jan 1 01:00:20 unknown user.notice switch4g[941]: 4G MODEM WAN (huawei_ether) not found ... Jan 1 01:00:22 unknown user.notice switch4g[941]: 4G MODEM WAN (cdc_ncm) not found ... Jan 1 01:00:24 unknown user.notice switch4g[941]: 4G MODEM WAN (rndis_host) not found ... Jan 1 01:00:26 unknown user.notice switch4g[941]: 4G MODEM WAN not found - connection process terminated! root@unknown:/tmp/home/root# lsusb Bus 001 Device 001: ID 1d6b:0001 Bus 001 Device 002: ID 19d2:0166
Then I went to overview and clicked “disconnect” and then “connect” and now I see an interesting log
Jul 10 18:22:34 unknown user.notice switch4g[5744]: 4G MODEM - disconnecting ... Jul 10 18:22:43 unknown user.notice switch4g[5831]: 4G MODEM - disconnecting ... Jul 10 18:22:43 unknown user.notice switch4g[5859]: 4G MODEM - detecting ... Jul 10 18:22:44 unknown user.notice switch4g[5859]: 4G MODEM FOUND - 19d2:0166 - switching ... Jul 10 18:22:47 unknown kern.info kernel: usb 1-2: USB disconnect, address 2 Jul 10 18:22:51 unknown kern.info kernel: usb 1-2: new full speed USB device using ohci_hcd and address 3 Jul 10 18:22:52 unknown kern.info kernel: scsi1 : usb-storage 1-2:1.5 Jul 10 18:22:53 unknown kern.notice kernel: scsi 1:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 Jul 10 18:22:53 unknown user.notice switch4g[5859]: 4G MODEM ready - 19d2:0167 Jul 10 18:22:53 unknown kern.info kernel: usbcore: registered new interface driver cdc_wdm Jul 10 18:22:53 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 10 18:22:53 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, ea:28:88:3b:d2:a1 Jul 10 18:22:53 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 10 18:22:53 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, ea:28:88:3b:d2:a1 Jul 10 18:22:53 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 10 18:22:54 unknown user.notice switch4g[5859]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 10 18:22:54 unknown user.notice switch4g[5859]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 10 18:22:54 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 10 18:22:55 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 10 18:22:55 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 10 18:23:02 unknown user.notice switch4g[5859]: 4G Modem - another uqmi process in action (hang up?) - exiting ... Jul 10 18:23:02 unknown user.notice switch4g[5859]: **** 4G MODEM - UQMIRET: Jul 10 18:23:03 unknown user.notice switch4g[5859]: **** 4G MODEM - UQMIRET: {"max_tx_channel_rate":50000000,"max_rx_channel_rate":100000000,"data_service":"simultaneous_cs_ps","sim":"supported","networks":["gsm","umts","lte"]} Jul 10 18:23:03 unknown user.notice switch4g[5859]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jul 10 18:23:03 unknown user.notice switch4g[5859]: 4G MODEM - Waiting for SIM initialization Jul 10 18:23:03 unknown user.notice switch4g[5859]: 4G MODEM - SIM ready Jul 10 18:23:03 unknown user.notice switch4g[5859]: 4G MODEM - connecting ... Jul 10 18:23:09 unknown user.notice switch4g[5859]: 4G MODEM - waiting for network registration ... Jul 10 18:23:40 unknown user.notice switch4g[5859]: 4G MODEM - network registration failed!
Network registration is failing but you fixed the dev listing issue. Now I don’t know why is not registering into the network. I could make this work in ubuntu, so the HW and sim should work.
Thank you
-
repo owner Check APN, Network Type, Roaming, LTE Band.
-
repo owner - changed status to resolved
others: switch4g: fix listing TTYs in QMI mode (resolves
#289)→ <<cset eaf185ff2110>>
-
reporter Other observation. When I tried to connect again (disconnect/connect) after changing connection parameters, I got
Jul 10 20:15:16 unknown user.notice switch4g[21857]: 4G MODEM - disconnecting ... Jul 10 20:15:16 unknown kern.info kernel: usbcore: deregistering interface driver qmi_wwan Jul 10 20:15:16 unknown user.notice switch4g[21885]: 4G MODEM - detecting ... Jul 10 20:15:17 unknown user.notice switch4g[21885]: 4G MODEM FOUND - 19d2:0166 - switching ... Jul 10 20:15:19 unknown kern.info kernel: usb 1-2: USB disconnect, address 4 Jul 10 20:15:24 unknown kern.info kernel: usb 1-2: new full speed USB device using ohci_hcd and address 5 Jul 10 20:15:24 unknown kern.info kernel: scsi3 : usb-storage 1-2:1.5 Jul 10 20:15:25 unknown kern.notice kernel: scsi 3:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 Jul 10 20:15:26 unknown user.notice switch4g[21885]: 4G MODEM ready - 19d2:0167 Jul 10 20:15:26 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 10 20:15:26 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 72:47:71:2a:da:28 Jul 10 20:15:26 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 10 20:15:26 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 72:47:71:2a:da:28 Jul 10 20:15:26 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 10 20:15:27 unknown user.notice switch4g[21885]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 10 20:15:27 unknown user.notice switch4g[21885]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 10 20:15:33 unknown user.notice switch4g[21885]: 4G Modem - another uqmi process in action (hang up?) - exiting ...
Then I checked and there was one --get-capabilities running which definitely should have killed the kill -9 in the script
root@unknown:/tmp/home/root# ps | grep uqmi 6155 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities
-
repo owner OK, so I uploaded a new version: https://bitbucket.org/pedro311/freshtomato-arm/downloads/switch4g
Extended delay after
kill
to 2 seconds and added more verbose log to get to know what’s going on. Please test it and let me know.
-
reporter First Run
Jan 1 01:01:35 unknown user.notice switch4g[1949]: 4G MODEM - detecting ... Jan 1 01:01:36 unknown user.notice switch4g[1949]: 4G MODEM FOUND - 19d2:0166 - switching ... Jan 1 01:01:39 unknown kern.info kernel: usb 1-2: USB disconnect, address 2 Jan 1 01:01:43 unknown kern.info kernel: usb 1-2: new full speed USB device using ohci_hcd and address 3 Jan 1 01:01:44 unknown kern.info kernel: scsi1 : usb-storage 1-2:1.5 Jan 1 01:01:45 unknown kern.notice kernel: scsi 1:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 Jan 1 01:01:45 unknown user.notice switch4g[1949]: 4G MODEM ready - 19d2:0167 Jan 1 01:01:45 unknown kern.info kernel: usbcore: registered new interface driver cdc_wdm Jan 1 01:01:45 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jan 1 01:01:45 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 1e:06:22:72:ce:54 Jan 1 01:01:45 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jan 1 01:01:45 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 1e:06:22:72:ce:54 Jan 1 01:01:45 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jan 1 01:01:46 unknown user.notice switch4g[1949]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jan 1 01:01:46 unknown user.notice switch4g[1949]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jan 1 01:01:46 unknown user.notice switch4g[1949]: 4G MODEM - running --get-capabilities in bg ... Jan 1 01:01:46 unknown user.notice switch4g[1949]: 4G MODEM - done with --get-capabilities in bg! Jan 1 01:01:46 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jan 1 01:01:47 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jan 1 01:01:47 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jan 1 01:01:48 unknown user.notice switch4g[1949]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - another uqmi process in action (hang up?) - exiting ... Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - done with -> running --get-capabilities: Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - running --get-capabilities in bg ... Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - done with --get-capabilities in bg! Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - done with -> running --get-capabilities: {"max_tx_channel_rate":50000000,"max_rx_channel_rate":100000000,"data_service":"simultaneous_cs_ps","sim":"supported","networks":["gsm","umts","lte"]} Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - Waiting for SIM initialization Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - SIM ready Jan 1 01:01:55 unknown user.notice switch4g[1949]: 4G MODEM - connecting ... Jul 11 03:31:12 unknown user.info ntpd_synced[2408]: initial clock set Jul 11 03:31:12 unknown user.info preinit[1]: httpd is stopped Jul 11 03:31:13 unknown user.info preinit[1]: httpd is started Jul 11 03:31:15 unknown cron.info crond[914]: time disparity of 28150650 minutes detected Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - waiting for network registration ... Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - network type is set to 'all' Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - roaming is set to 'any' Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - got new client ID: 2 Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [1] ... Jul 11 03:31:20 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [2] ... Jul 11 03:31:25 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [3] ... Jul 11 03:31:30 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [4] ... Jul 11 03:31:35 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [5] ... Jul 11 03:31:40 unknown user.notice switch4g[1949]: 4G MODEM - connection failed - process terminated!
Second run (disconnect/connect)
Jul 11 03:33:54 unknown user.notice switch4g[4834]: 4G MODEM - disconnecting ... Jul 11 03:33:57 unknown kern.info kernel: usbcore: deregistering interface driver qmi_wwan Jul 11 03:33:57 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 11 03:33:57 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 11 03:33:58 unknown user.notice switch4g[4899]: 4G MODEM - detecting ... Jul 11 03:33:58 unknown user.notice switch4g[4899]: 4G MODEM not found in USB_ModeSwitch database - already switched? Loading modules... Jul 11 03:33:58 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 11 03:33:58 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 32:b7:c0:b1:d5:b4 Jul 11 03:33:58 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 11 03:33:58 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 32:b7:c0:b1:d5:b4 Jul 11 03:33:58 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 11 03:33:59 unknown user.notice switch4g[4899]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 11 03:33:59 unknown user.notice switch4g[4899]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 11 03:33:59 unknown user.notice switch4g[4899]: 4G MODEM - running --get-capabilities in bg ... Jul 11 03:34:01 unknown user.notice switch4g[4834]: 4G MODEM - another uqmi process in action (hang up?) - exiting ... Jul 11 03:34:05 unknown user.notice switch4g[4899]: 4G MODEM - another uqmi process in action (hang up?) - exiting ...
Note the PID of line 15 has a different PID from the current switch4g run and different than previous one but same as the one in line 1 (suspect that disconnect process keep running in BG while the connect button is enabled in the Web Console.
Third run (just disconnect)
Jul 11 03:37:26 unknown user.notice switch4g[7698]: 4G MODEM - disconnecting ... Jul 11 03:37:32 unknown user.notice switch4g[7698]: 4G MODEM - another uqmi process in action (hang up?) - exiting ...
If I run a ps now I got
root@unknown:/tmp/home/root# ps | grep qmi 2199 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 4547 root 828 S uqmi -s -d /dev/cdc-wdm1 --set-client-id wds 2 --stop-network 0xffffffff --autoconnect
-
repo owner First run was OK, except that your modem doesn’t connect to the network:
Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - got new client ID: 2 Jul 11 03:31:15 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [1] ... Jul 11 03:31:20 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [2] ... Jul 11 03:31:25 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [3] ... Jul 11 03:31:30 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [4] ... Jul 11 03:31:35 unknown user.notice switch4g[1949]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [5] ... Jul 11 03:31:40 unknown user.notice switch4g[1949]: 4G MODEM - connection failed - process terminated!
It should end like this (like mine):
Jan 1 01:00:42 router user.notice switch4g[1159]: 4G MODEM - got new client ID: 2 Jan 1 01:00:43 router user.notice switch4g[1159]: 4G MODEM - connected (device /dev/cdc-wdm0) - session ID: 38972872
Another version available: https://bitbucket.org/pedro311/freshtomato-arm/downloads/switch4g
-
reporter Hi Pedro, here are the new logs.
First Run
Jul 12 07:29:24 unknown user.notice switch4g[1932]: 4G MODEM - disconnecting ... Jul 12 07:29:24 unknown user.notice switch4g[1932]: 4G MODEM - release Client ID: 2 Jul 12 07:29:24 unknown user.notice switch4g[1932]: 4G MODEM - disconnected Jul 12 07:29:24 unknown user.notice switch4g[2032]: 4G MODEM - detecting ... Jul 12 07:29:25 unknown user.notice switch4g[2032]: 4G MODEM FOUND - 19d2:0166 - switching ... Jul 12 07:29:28 unknown kern.info kernel: usb 1-2: USB disconnect, address 2 Jul 12 07:29:33 unknown kern.info kernel: usb 1-2: new full speed USB device using ohci_hcd and address 3 Jul 12 07:29:33 unknown kern.info kernel: scsi1 : usb-storage 1-2:1.5 Jul 12 07:29:34 unknown kern.notice kernel: scsi 1:0:0:0: CD-ROM LTE USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 Jul 12 07:29:34 unknown user.notice switch4g[2032]: 4G MODEM ready - 19d2:0167 Jul 12 07:29:34 unknown kern.info kernel: usbcore: registered new interface driver cdc_wdm Jul 12 07:29:35 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 12 07:29:35 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, ce:d2:f9:25:3f:b9 Jul 12 07:29:35 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 12 07:29:35 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, ce:d2:f9:25:3f:b9 Jul 12 07:29:35 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 12 07:29:36 unknown user.notice switch4g[2032]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 12 07:29:36 unknown user.notice switch4g[2032]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 12 07:29:36 unknown user.notice switch4g[2032]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:29:36 unknown user.notice switch4g[2032]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:29:36 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 12 07:29:36 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 12 07:29:36 unknown kern.err kernel: qmi_wwan 1-2:1.3: unknown notification 32 received: index 3 len 2 Jul 12 07:29:38 unknown user.notice switch4g[2032]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - done with -> running --get-capabilities: Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - done with -> running --get-capabilities: {"max_tx_channel_rate":50000000,"max_rx_channel_rate":100000000,"data_service":"simultaneous_cs_ps","sim":"supported","networks":["gsm","umts","lte"]} Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - Waiting for SIM initialization Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - SIM ready Jul 12 07:29:47 unknown user.notice switch4g[2032]: 4G MODEM - connecting ... Jul 12 07:29:53 unknown user.notice switch4g[2032]: 4G MODEM - waiting for network registration ... Jul 12 07:29:53 unknown user.notice switch4g[2032]: 4G MODEM - network type is set to 'all' Jul 12 07:29:53 unknown user.notice switch4g[2032]: 4G MODEM - roaming is set to 'any' Jul 12 07:29:53 unknown user.notice switch4g[2032]: 4G MODEM - got new client ID: 2 Jul 12 07:29:53 unknown user.notice switch4g[2032]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [1] ... Jul 12 07:29:58 unknown user.notice switch4g[2032]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [2] ... Jul 12 07:30:03 unknown user.notice switch4g[2032]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [3] ... Jul 12 07:30:08 unknown user.notice switch4g[2032]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [4] ... Jul 12 07:30:13 unknown user.notice switch4g[2032]: 4G MODEM - connection failed: "Call failed" (device /dev/cdc-wdm1) [5] ... Jul 12 07:30:18 unknown user.notice switch4g[2032]: 4G MODEM - connection failed - process terminated!
After finishing this I can see the process is still running
root@unknown:/tmp/home/root# ps| grep qmi 2274 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities
Second Run (just Disconnect)
Jul 12 07:32:38 unknown user.notice switch4g[4874]: 4G MODEM - disconnecting ...
And the process hangs. In the ps I can see these lines
2274 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 2837 root 1224 S dropbear -p 22 -a 2846 root 1424 S -sh 4874 root 1496 S {switch4g} /bin/sh /usr/sbin/switch4g wan2 disconnect 4903 root 828 S uqmi -s -d /dev/cdc-wdm1 --set-client-id wds 2 --stop-network 0xffffffff --autoconnect
So, It got stuck stopping the network
Third Run (Connect as the we enabled it)
Jul 12 07:37:04 unknown user.notice switch4g[8269]: 4G MODEM - disconnecting ... Jul 12 07:37:07 unknown kern.info kernel: usbcore: deregistering interface driver qmi_wwan Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 12 07:37:07 unknown user.notice switch4g[8324]: 4G MODEM - detecting ... Jul 12 07:37:07 unknown user.notice switch4g[8324]: 4G MODEM not found in USB_ModeSwitch database - already switched? Loading modules... Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 16:3d:ed:03:7a:eb Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 12 07:37:07 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 16:3d:ed:03:7a:eb Jul 12 07:37:07 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 12 07:37:08 unknown user.notice switch4g[8324]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 12 07:37:08 unknown user.notice switch4g[8324]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 12 07:37:08 unknown user.notice switch4g[8324]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:37:17 unknown user.notice switch4g[8324]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:37:19 unknown user.notice switch4g[8324]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jul 12 07:37:22 unknown user.notice switch4g[8269]: 4G MODEM - release Client ID: 2 Jul 12 07:37:22 unknown user.notice switch4g[8269]: 4G MODEM - disconnected Jul 12 07:37:29 unknown user.notice switch4g[8324]: 4G MODEM - done with -> running --get-capabilities: Jul 12 07:37:29 unknown user.notice switch4g[8324]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:37:38 unknown user.notice switch4g[8324]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:37:40 unknown user.notice switch4g[8324]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jul 12 07:37:49 unknown user.notice switch4g[8324]: 4G MODEM - done with -> running --get-capabilities: Jul 12 07:37:49 unknown user.notice switch4g[8324]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jul 12 07:37:49 unknown user.notice switch4g[8324]: 4G MODEM - Waiting for SIM initialization Jul 12 07:37:58 unknown user.notice switch4g[8324]: 4G MODEM - SIM ready Jul 12 07:37:58 unknown user.notice switch4g[8324]: 4G MODEM - connecting ... Jul 12 07:38:50 unknown user.notice switch4g[8324]: 4G MODEM - waiting for network registration ... Jul 12 07:39:08 unknown user.notice switch4g[8324]: 4G MODEM - network type is set to 'all' Jul 12 07:39:17 unknown user.notice switch4g[8324]: 4G MODEM - roaming is set to 'any' Jul 12 07:39:27 unknown user.notice switch4g[8324]: 4G MODEM - unable to obtain client ID!
After this finished, I can still see these in the ps
2274 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 2837 root 1224 S dropbear -p 22 -a 2846 root 1424 S -sh 4903 root 828 S uqmi -s -d /dev/cdc-wdm1 --set-client-id wds 2 --stop-network 0xffffffff --autoconnect
checking the script. In line 592 and 600 the ps may need to get the f2 instead f1. If I run that I got nothing, but with f2 in cut I got the 2 pids. That’s why was not killing the process!
root@unknown:/tmp/home/root# ps | grep [u]qmi | cut -d ' ' -f2 2274 4903
If I run a Disconnect/Connect again with the changes. It worked!
Jul 12 07:51:12 unknown user.notice switch4g[20581]: 4G MODEM - disconnecting ... Jul 12 07:51:12 unknown kern.info kernel: usbcore: deregistering interface driver qmi_wwan Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 12 07:51:12 unknown user.notice switch4g[20609]: 4G MODEM - detecting ... Jul 12 07:51:12 unknown user.notice switch4g[20609]: 4G MODEM not found in USB_ModeSwitch database - already switched? Loading modules... Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.3: cdc-wdm0: USB WDM device Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.3: wwan0: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 0e:81:3d:24:eb:13 Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.4: cdc-wdm1: USB WDM device Jul 12 07:51:12 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: register 'qmi_wwan' at usb-0000:00:0b.0-2, WWAN/QMI device, 0e:81:3d:24:eb:13 Jul 12 07:51:12 unknown kern.info kernel: usbcore: registered new interface driver qmi_wwan Jul 12 07:51:13 unknown user.notice switch4g[20609]: 4G MODEM WAN (qmi_wwan) found - using qmi_wwan module and wwan0 as WAN Jul 12 07:51:13 unknown user.notice switch4g[20609]: 4G MODEM - DIAG(s) found (cdc-wdm0 cdc-wdm1) Jul 12 07:51:13 unknown user.notice switch4g[20609]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:51:22 unknown user.notice switch4g[20609]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:51:24 unknown user.notice switch4g[20609]: 4G MODEM - found another uqmi process (PID: 2274), killing ... Jul 12 07:51:29 unknown user.notice switch4g[20609]: 4G MODEM - still found another uqmi process (PID: 4903), killing once again ... Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - done with killing another uqmi process (PID: 4903) Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - running --get-capabilities in bg ... Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - done with --get-capabilities in bg! Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - no other uqmi process -> running --get-capabilities ... Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - done with -> running --get-capabilities: {"max_tx_channel_rate":50000000,"max_rx_channel_rate":100000000,"data_service":"simultaneous_cs_ps","sim":"supported","networks":["gsm","umts","lte"]} Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - Waiting for SIM initialization Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - SIM ready Jul 12 07:51:34 unknown user.notice switch4g[20609]: 4G MODEM - connecting ... Jul 12 07:51:41 unknown user.notice switch4g[20609]: 4G MODEM - waiting for network registration ... Jul 12 07:51:41 unknown user.notice switch4g[20609]: 4G MODEM - network type is set to 'all' Jul 12 07:51:41 unknown user.notice switch4g[20609]: 4G MODEM - roaming is set to 'any' Jul 12 07:51:41 unknown user.notice switch4g[20609]: 4G MODEM - got new client ID: 4 Jul 12 07:51:48 unknown user.notice switch4g[20609]: 4G MODEM - connected (device /dev/cdc-wdm1) - session ID: 35986320 Jul 12 07:51:53 unknown user.notice switch4g[20609]: 4G MODEM - WAN IFACE configured (wwan0)
Note: In the setup page there is no field to setup the MCC and MNC. I set it up with uqmi and with that I got the dongle registered into the network.
Even though, now the iface is connected, the command
uqmi -d /dev/cdc-wdm1 --get-data-status
returns"disconnected"
and not getting IP.
Thank you!!
-
repo owner checking the script. In line 592 and 600 the ps may need to get the f2 instead f1. If I run that I got nothing, but with f2 in cut I got the 2 pids. That’s why was not killing the process!
Are you sure, you don’t have “different” kind of
ps
in your system (ie. from entware)?root@router:/tmp/home/root# which ps /bin/ps
root@router:/tmp/home/root# ps | grep [s]tubby 13625 root 4508 S stubby -g -C /etc/stubby/stubby.yml root@router:/tmp/home/root# ps | grep [s]tubby | cut -d ' ' -f1 13625
It has to be
f1
otherwise I have:root@router:/tmp/home/root# ps | grep [s]tubby | cut -d ' ' -f2 root
Note: In the setup page there is no field to setup the MCC and MNC
It’s not needed in normal use - your dongle should just register to the home network.
What returns:
uqmi -s -d /dev/cdc-wdm1 --wda-get-data-format
?
-
reporter Here are the results
root@unknown:/www/user/cgi-bin# which ps /bin/ps
you are right regarding f1 but, if the ps’s list has space before the PID number, it takes those spaces. i]In fact depending on the numbers, the pid ID could be on f1, f2 or f3.
root@unknown:/tmp/home/root# ps | grep [u]qmi 483 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 20975 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities
See this, there are 2 ' ' before 483, so the -f is 3 in the case of 483
root@unknown:/tmp/home/root# ps | grep [u]qmi 483 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 20975 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities root@unknown:/tmp/home/root# ps | grep [u]qmi | cut -d ' ' -f2 root root@unknown:/tmp/home/root# ps | grep [u]qmi | cut -d ' ' -f1 20975 root@unknown:/tmp/home/root# ps | grep [u]qmi | cut -d ' ' -f3 483
I think
ps | grep [u]qmi | awk '{print $1}'
is better hereroot@unknown:/tmp/home/root# ps | grep [u]qmi | awk '{print $1}' 483 20975
In regards to the data format
root@unknown:/www/user/cgi-bin# uqmi -s -d /dev/cdc-wdm1 --wda-get-data-format "802.3"
-
reporter Hi Pedro, looping on why I’m not getting IP on the connected iface and I found the issue.
in line 482 there is this code
# TODO: add a delayed loop? # check if interface is up for WAN in $(ls $PATHWAN/ | grep -e eth -e usb -e wwan); do [ -f $PATHWAN/$WAN/uevent -a -f $PATHWAN/$WAN/device/uevent ] || continue # check if interface has our $MODULE [ "$(grep -s ^DRIVER $PATHWAN/$WAN/device/uevent | cut -d "=" -f2)" == "$MODULE" ] && { FOUND=1 break 2 } || { continue } done
I have two WAN interfaces in my modem,
wwan0
andwwan1
, both have the same Driver, so WAN is set to wwan0 but actually the device connected is/dev/cdc-wdm1
. So, in my case the ifname should bewwan1
. To test it I hardcoded the ifname and then the DHCP run on the correct interface and i got IP right away.
-
repo owner I think
ps | grep [u]qmi | awk '{print $1}'
is better hereRight!
I have two WAN interfaces in my modem,
wwan0
andwwan1
, both have the same DriverCould you
ls
for me:ls /sys/class/net/wwan0 ls /sys/class/net/wwan1 ls /sys/class/net/wwan0/device ls /sys/class/net/wwan2/device
? Thanks.
-
reporter here it is (last line wwan2 does not exist, so I’m sendign the one for wwan1)
root@unknown:/tmp/home/root# ls /sys/class/net/wwan0 addr_assign_type dormant link_mode subsystem addr_len duplex mtu tx_queue_len address features operstate type broadcast flags qmi uevent carrier ifalias queues dev_id ifindex speed device iflink statistics root@unknown:/tmp/home/root# ls /sys/class/net/wwan1 addr_assign_type dormant link_mode subsystem addr_len duplex mtu tx_queue_len address features operstate type broadcast flags qmi uevent carrier ifalias queues dev_id ifindex speed device iflink statistics root@unknown:/tmp/home/root# ls /sys/class/net/wwan0/device bAlternateSetting bus net:wwan0 bInterfaceClass driver subsystem bInterfaceNumber ep_04 supports_autosuspend bInterfaceProtocol ep_84 uevent bInterfaceSubClass ep_85 usb:cdc-wdm0 bNumEndpoints modalias root@unknown:/tmp/home/root# ls /sys/class/net/wwan2/device ls: /sys/class/net/wwan2/device: No such file or directory root@unknown:/tmp/home/root# ls /sys/class/net/wwan1/device bAlternateSetting bus net:wwan1 bInterfaceClass driver subsystem bInterfaceNumber ep_05 supports_autosuspend bInterfaceProtocol ep_86 uevent bInterfaceSubClass ep_87 usb:cdc-wdm1 bNumEndpoints modalias
-
reporter Hi Pedro, as my use case is to use the 4G modem as a backup (failover), I’ve been testing it. Today is a day where I have a ver unstable service, so good day to test the fail over.
Here is some feedback about what I found.
I saw that the detection of the internet connection is checking byte received in a fraction of time using
cat /sys/class/net/vlan2/statistics/rx_bytes
. IMHO, this method is fragile because 1 byte in makes the connection as OK and this is not a real proof the “service” is usable. As a user I’d like to have a stable or almost stable (can have some packages loss) connection. What I could see today with a faulty service isroot@unknown:/tmp/home/root# cat /sys/class/net/vlan2/statistics/rx_bytes 4874856 root@unknown:/tmp/home/root# cat /sys/class/net/vlan2/statistics/rx_bytes 4875765 root@unknown:/tmp/home/root# cat /sys/class/net/vlan2/statistics/rx_bytes 5007374
So the watchdog is marking WAN0 as good and making it the default route but the “internet service” is unusable. Here is the ping in that same moment
64 bytes from 216.58.202.78: icmp_seq=66 ttl=115 time=17.538 ms Request timeout for icmp_seq 67 Request timeout for icmp_seq 68 Request timeout for icmp_seq 69 Request timeout for icmp_seq 70 Request timeout for icmp_seq 71 Request timeout for icmp_seq 72 Request timeout for icmp_seq 73 Request timeout for icmp_seq 74 Request timeout for icmp_seq 75 Request timeout for icmp_seq 76 64 bytes from 216.58.202.78: icmp_seq=77 ttl=115 time=17.359 ms Request timeout for icmp_seq 78 Request timeout for icmp_seq 79 Request timeout for icmp_seq 80 64 bytes from 216.58.202.78: icmp_seq=81 ttl=115 time=14.052 ms 64 bytes from 216.58.202.78: icmp_seq=82 ttl=115 time=15.224 ms 64 bytes from 216.58.202.78: icmp_seq=83 ttl=115 time=18.132 ms Request timeout for icmp_seq 84 Request timeout for icmp_seq 85 Request timeout for icmp_seq 86 Request timeout for icmp_seq 87 Request timeout for icmp_seq 88 Request timeout for icmp_seq 89 64 bytes from 216.58.202.78: icmp_seq=90 ttl=115 time=19.227 ms Request timeout for icmp_seq 91 64 bytes from 216.58.202.78: icmp_seq=92 ttl=115 time=20.637 ms Request timeout for icmp_seq 93 Request timeout for icmp_seq 94 64 bytes from 216.58.202.78: icmp_seq=95 ttl=115 time=16.125 ms Request timeout for icmp_seq 96 Request timeout for icmp_seq 97 Request timeout for icmp_seq 98 Request timeout for icmp_seq 99 Request timeout for icmp_seq 100 64 bytes from 216.58.202.78: icmp_seq=101 ttl=115 time=16.071 ms Request timeout for icmp_seq 102 64 bytes from 216.58.202.78: icmp_seq=103 ttl=115 time=17.247 ms Request timeout for icmp_seq 104 Request timeout for icmp_seq 105 Request timeout for icmp_seq 106 Request timeout for icmp_seq 107 64 bytes from 216.58.202.78: icmp_seq=108 ttl=115 time=17.836 ms
So there were some bytes-in actually but we can relay on that to tell the connection is OK. I guess you should have evaluated other ways to check the connection. I think a ping with 5 calls and getting the statistics from it and assuming 1 package lost is OK (20% package loss) the connection is OK or a wget --spider or nc.
I know the script could take longer than the actual one but could be more robust the outcome.
Thank you!
-
repo owner here it is (last line wwan2 does not exist, so I’m sendign the one for wwan1)
Sure it was my typo.
So folders/subfolders are identical in wwan0 and wwan1 - not good.
We need to find something that will distinguish these folders from each other in order to select the right wwan.
The only option at the moment, in my opinion, is to look at the content of these files/links in wwanX subdirectories, compare them and detect differences, in order to choose the right wwan.
I only have a (qmi) modem with one wwan0 and I can't do that.
So if you have the time and the inclination, I'd appreciate your help.
//EDIT: of course we have different ep_X, but I don't think it can be relied on…
-
reporter Thank you Pedro for all this support.
Here there is a good way of identifying both interfaces.
uevent
has theINTERFACE
and thePHYSDEVPATH
which is used in the WAN discoveryroot@unknown:/tmp/home/root# cat /sys/class/net/wwan0/uevent DEVTYPE=wwan PHYSDEVPATH=/devices/pci0000:00/0000:00:0b.0/usb1/1-2/1-2:1.3 PHYSDEVBUS=usb PHYSDEVDRIVER=qmi_wwan INTERFACE=wwan0 IFINDEX=36 root@unknown:/tmp/home/root# cat /sys/class/net/wwan1/uevent DEVTYPE=wwan PHYSDEVPATH=/devices/pci0000:00/0000:00:0b.0/usb1/1-2/1-2:1.4 PHYSDEVBUS=usb PHYSDEVDRIVER=qmi_wwan INTERFACE=wwan1 IFINDEX=37
-
repo owner I tried it, and it works BUT only if modem is not switched when restarting/booting the router (in this case I can easily extract below USB number, because new device appear).
Otherwise there is a problem because I need it to extract WAN (wwanX) number (to be exact: USB device number, ie. “1-2:1.2”), but to extract this number I need WAN number.
So it is a closed circle.
Is there anything else in this folders, that may indicate which one is the working WAN?
-
reporter I don’t know if I’m fully following you.
The modem is already switched when I sent this info. This same status is when switch4g first run as
switchMode
is called beforesearchWAN
I fond you can get
wwanX
and it's underlying device doingls /sys/class/net/wwan1/device/| grep usb |cut -d":" -f2
What if you save tuples
wwanx:device
, then can you override WAN and PREFIX_ifname variable with the working device when you check the --get-capabilitiesWhen you are listing WAN interfaces that use the DRIVER you build a
WANS
variable
WANS="" for WAN in $(ls $PATHWAN/ | grep -e eth -e usb -e wwan); do [ -f $PATHWAN/$WAN/uevent -a -f $PATHWAN/$WAN/device/uevent ] || continue # check if interface has our $MODULE [ "$(grep -s ^DRIVER $PATHWAN/$WAN/device/uevent | cut -d "=" -f2)" == "$MODULE" ] && { DEV=$(ls $PATHWAN/$WAN/device/| grep usb |cut -d":" -f2) WANS="$WANS $WAN:$DEV" } || { continue } done
Then when you detect the working device
} || { # it works $LOGS "4G MODEM - no other uqmi process -> running --get-capabilities ..." # TEMP updateInteface UQMIRET=$(uqmiCall "--get-capabilities") $LOGS "4G MODEM - done with -> running --get-capabilities: $UQMIRET" # TEMP case "$UQMIRET" in # final check *data_service*) break ;; esac } updateInterface(){ for W in $WANS; do IFACE=$(echo $W | cut -d":" -f1) DEVICE=$(echo $W | cut -d":" -f2) FULLDEV="/dev/${DEVICE}" if [ "${FULLDEV}" == "${DEVNR}"]; then WAN=$IFACE nvram set "$PREFIX"_ifname="$WAN" fi done }
Then
connect()
will have the right IFA and DEVNRI did’t try it, just a quick and dirty solution that came to my mind and didn’t invest too many time on it. Tonight I can test it
-
reporter Hi Pedro, I finally could test my approach. It worked! I was able to match device and interface.
Here it is an updated file with my changes… May be not the finest approach but it works for now.
Something that I have been seeing in the logs.
Jul 21 20:19:00 unknown user.notice watchdog[14844]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:20:00 unknown user.notice watchdog[16615]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:21:00 unknown user.notice watchdog[18387]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:22:00 unknown user.notice watchdog[20118]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:23:00 unknown user.notice watchdog[21889]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:24:00 unknown user.notice watchdog[23660]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:25:00 unknown user.notice watchdog[25431]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:26:00 unknown user.notice watchdog[27162]: Switch4g (wan2) script in action - Exiting ... Jul 21 20:27:00 unknown user.notice watchdog[28933]: Switch4g (wan2) script in action - Exiting ...
and the modem got disconnected and never connected again. In the ps I got
15610 root 1424 S /sbin/udhcpc -i wwan1 -b -s /sbin/dhcpc-event -p /var/run/udhcpc-wan2.pid -x hostname:unknown -O33 -O121 -O249 -m 22834 root 1456 S {watchdog} /bin/sh /usr/sbin/watchdog 22968 root 1504 S {switch4g} /bin/sh /usr/sbin/switch4g wan2 23109 nobody 1764 S dnsmasq -c 4096 --log-async 23188 root 1504 S {switch4g} /bin/sh /usr/sbin/switch4g wan2 23194 root 828 S uqmi -s -d /dev/cdc-wdm1 --get-client-id wds
last thing logged in switch4g is
Jul 21 20:18:16 unknown user.notice switch4g[13278]: 4G MODEM ready - working DIAG is (/dev/cdc-wdm1) Jul 21 20:18:16 unknown user.notice switch4g[13278]: 4G MODEM - Waiting for SIM initialization Jul 21 20:18:16 unknown user.notice switch4g[13278]: 4G MODEM - SIM ready Jul 21 20:18:16 unknown user.notice switch4g[13278]: 4G MODEM - connecting ... Jul 21 20:18:22 unknown user.notice switch4g[13278]: 4G MODEM - waiting for network registration ...
And then the process got stuck there. If I kill those processes, the next round, the watchdog does the connection OK after a while. There is something taken at kernel level in the device
Jul 22 23:10:10 unknown kern.info kernel: qmi_wwan 1-2:1.4: wwan1: unregister 'qmi_wwan' usb-0000:00:0b.0-2, WWAN/QMI device Jul 22 23:10:20 unknown kern.emerg kernel: unregister_netdevice: waiting for wwan1 to become free. Usage count = 9 Jul 22 23:10:31 unknown kern.emerg kernel: unregister_netdevice: waiting for wwan1 to become free. Usage count = 9 Jul 22 23:10:41 unknown kern.emerg kernel: unregister_netdevice: waiting for wwan1 to become free. Usage count = 9 Jul 22 23:10:51 unknown kern.emerg kernel: unregister_netdevice: waiting for wwan1 to become free. Usage count = 9
Other thing I’ve seen is there is an instance of
switch4g
running andmodprobe -r
and a--get-capabilities
(something like this)2987 root 1456 S {watchdog} /bin/sh /usr/sbin/watchdog 3167 root 1496 S {switch4g} /bin/sh /usr/sbin/switch4g wan2 2274 root 828 S uqmi -s -d /dev/cdc-wdm0 --get-capabilities 3169 root 1432 D modprobe -r qmi_wwan
Here at this point I need to power off the router from the switch. Kill -9 doesn’t work (neither for modprobe nor for --get-capabilities or switch4g wan2).
-
repo owner Remember to always test new version of switch4g with cold boot (power off - both, router and modem if you use ie. USB hub), because sometimes (well, more often than not, if something went wrong) USB modules may not be removed, and therefore also those supporting the modem, resulting in false positives.
I'll get back to you shortly.
-
repo owner OK, so try this one: it works for me on CDC, RNDIS, ETHER and QMI (but the latter of course with only one WAN): https://bitbucket.org/pedro311/freshtomato-arm/downloads/switch4g
//EDIT: and cold start, please.
-
reporter i’ve been testing it and the script looks good! thank you!
the router reboots when start routing via the failover iface (4G), but looks other stuff not this issue. After the reboot it takes a while until everything is normal. too many processes locked related with the watchdog on wan2 and get-capabilities. but after a while it gets connected to 4g
-
repo owner That’s good.
-
reporter I need to dig deeper but the router reboots when switching to 4G on failover.
- Log in to comment