On 1/10/22 4:32 AM, Enrico Mioso wrote:
Hello!!
So here I am at my second attempt to build a solution to enable multi-modems and
multi-bearers usage in OpenWRt, with re-connection handling for persistent
connectivity.
This doesn't do anything about multiple modems, but here's my patch for
retry. Without this, in some instances, ModemManager/netifd will simply
give up and you'll be left with a stopped state.
--- a/files/modemmanager.common 2021-05-07 13:46:57.651937479 -0400
+++ b/files/modemmanager.common 2021-07-22 13:37:30.090964033 -0400
@@ -157,7 +157,9 @@
# TODO: config max wait
local n=45
local step=5
+ local not_detected=false
+ while true; do
while [ $n -ge 0 ]; do
[ -d "${sysfspath}" ] || {
mm_log "error: ignoring modem detection request: no device at ${sysfspath}"
@@ -168,7 +170,10 @@
# Check if the modem exists at the given sysfs path
if ! mmcli -m "${sysfspath}" > /dev/null 2>&1
then
+ if ${not_detected} ; then
mm_log "error: modem not detected at sysfs path"
+ not_detected=true
+ fi
else
mm_log "modem exported successfully at ${sysfspath}"
mm_log "setting interface '${cfg}' as available"
@@ -181,6 +186,12 @@
done
mm_log "error: timed out waiting for the modem to get exported at ${sysfspath}"
+ mm_log "Restarting detection"
+ sleep 5
+ n=45
+ done
+
+
proto_set_available "${cfg}" 0
return 2
}
@@ -214,7 +225,7 @@
fi
;;
"processed")
- mm_log "already waiting for modem at sysfs path ${parent_sysfspath}"
+ #mm_log "already waiting for modem at sysfs path ${parent_sysfspath}"
;;
"ignored")
;;
@@ -277,7 +288,7 @@
esac
# Report the event
- mm_log "event reported: action=${action}, name=${name}, subsystem=${subsystem}"
+ #mm_log "event reported: action=${action}, name=${name}, subsystem=${subsystem}"
mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 1>/dev/null 2>&1 &
# Wait for added modem if a sysfspath is given