ims-pdn-up: an empty profile list is the modem coming up, not a modem without ims

On a cold boot the profile-list query can succeed while ModemManager is
still enabling the modem and return no profiles at all; the lookup then
read "no ims profile" and fell back to the APN-string request, the one a
walled carrier refuses (Fairphone 6, index 2 present a minute later).
Treat a list without any profile entry like a failed lookup and retry it
after the registration wait; a list with entries but no ims APN still
falls back to the APN string.
This commit is contained in:
Jorijn van der Graaf 2026-09-20 16:58:43 +02:00
commit 8cce77bc7d
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB

View file

@ -72,6 +72,13 @@ fi
lookup_profile() { # $1 = log suffix; sets PROFILE_ID, LOOKUP=done on a usable list lookup_profile() { # $1 = log suffix; sets PROFILE_ID, LOOKUP=done on a usable list
[ "$LOOKUP" = done ] && return 0 [ "$LOOKUP" = done ] && return 0
if OUT=$(qmicli -d qrtr://0 --wds-get-profile-list=3gpp 2>&1); then if OUT=$(qmicli -d qrtr://0 --wds-get-profile-list=3gpp 2>&1); then
# a list with no profiles at all is the modem still coming up, not
# a modem without an ims profile (dev phone cold boot 2026-09-20
# 16:47: exit 0, no entries, index 2 present a minute later)
if ! printf '%s\n' "$OUT" | grep -q -E '^[[:space:]]*\[[0-9]+\] 3gpp'; then
log "ims profile lookup returned no profiles$1"
return 0
fi
PROFILE_ID=$(printf '%s\n' "$OUT" | awk -v apn="$IMS_APN" ' PROFILE_ID=$(printf '%s\n' "$OUT" | awk -v apn="$IMS_APN" '
/^[ \t]*\[[0-9]+\] 3gpp/ { idx = $1; gsub(/[^0-9]/, "", idx) } /^[ \t]*\[[0-9]+\] 3gpp/ { idx = $1; gsub(/[^0-9]/, "", idx) }
/APN:/ { a = $0; sub(/.*APN: '"'"'/, "", a); sub(/'"'"'.*/, "", a); /APN:/ { a = $0; sub(/.*APN: '"'"'/, "", a); sub(/'"'"'.*/, "", a);