I want to initialize the lte module using libqmi and networkd-dispatcher. What I got so far is a shell script which is located at /etc/networkd-dispatcher/degraded.d/01-wwan.sh
#!/bin/bash
interface="${IFACE}"
if [[ "$interface" == *"wwan"* ]]; then
device="/dev/cdc-wdm${interface: -1}"
is_wwan="y"
fi
if [[ "$is_wwan" == "y" ]]; then
ip link set dev "${interface}" down
echo "Y" > "/sys/class/net/${interface}/qmi/raw_ip"
qmi-network "${device}" start || true
qmicli -p -d "${device}" --wds-set-autoconnect-settings=enabled || true
ip link set dev "${interface}" up
fi
My problem now is that this script is called over and over again sometimes after an reboot and takes some time to be stable. I thought if I add a sleep 10s after taking it link up it solves the issue, but it doesn't. Any suggestions how to fix this?