qmi-network@.service

There seems to be a sweet-spot for devices with regards to timings. Too slow and you get failures, too fast & you also get failures!!
This commit is contained in:
mpmc 2022-10-01 23:07:55 +01:00
parent 09e2ad8890
commit dc7ce66aac
1 changed files with 7 additions and 20 deletions

View File

@ -10,26 +10,13 @@ Description=qmi-network for cdc-wdm%i device
Before=freepbx.service
Before=asterisk.service
After=sys-subsystem-net-devices-wwan%i.device
Wants=sys-subsystem-net-devices-wwan%i.device
Requires=sys-subsystem-net-devices-wwan%i.device
[Service]
Type=simple
Restart=always
TimeoutSec=300s
# Leave the following blank/as-is for auto-detection.
# Internet APN.
Environment=APN=""
# APN Username.
Environment=APN_USER=""
# APN Password.
Environment=APN_PASS=""
# IP type is usually 4, 6 or 4|6.
Environment=IP_TYPE="4|6"
# Change to yes to use qmi proxy.
Environment=PROXY="no"
# Make sure the state is cleared before starting.
ExecStartPre=-rm /tmp/qmi-network-state-cdc-wdm%i
@ -39,17 +26,17 @@ ExecStartPre=networkctl down wwan%i
# Raw IP must be enabled.
ExecStartPre=sh -c "echo 'Y' | tee /sys/class/net/wwan%i/qmi/raw_ip"
# Start the network via qmi-network scripts.
# As some networks and/or devices take a long time to connect we should
# give it some time to be ready before starting the connection process.
ExecStartPre=-sh -e -c "sleep 60; qmi-network /dev/cdc-wdm%i start"
# Bring up the network.
ExecStartPre=networkctl up wwan%i
# Start the network via qmi-network scripts.
# As some networks and/or devices take a long time to connect we should
# give it some time to be ready before starting the connection process.
ExecStartPre=-sh -e -c "sleep 5; qmi-network /dev/cdc-wdm%i start && sleep 5;"
# Small loop as the main process to watchdog the connection.
# (NOTE: DHCP must be given a little time to settle before pinging).
ExecStart=sh -e -c "sleep 10; while true; do ping -w 120 -I wwan%i -c 5 one.one.one.one; sleep 300; done;"
ExecStart=sh -e -c "while true; do ping -w 60 -I wwan%i -c 5 one.one.one.one; sleep 60; done;"
# Stop.. DOWN TIME!
ExecStop=networkctl down wwan%i