Merge request !1312 from 'fcc-unlock-grep-qi'

fcc-unlock: Case-insensitive grep for for 105b (MBIM) and 14c3 (AT)

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1312
This commit is contained in:
Dan Williams
2025-03-09 02:57:05 +00:00
2 changed files with 7 additions and 13 deletions
+3 -6
View File
@@ -20,13 +20,10 @@ shift
# second and next arguments are control port names
for PORT in "$@"; do
# match port type in Linux 5.14 and newer
grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null && {
MBIM_PORT=$PORT
break
}
grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null ||
# match port name in Linux 5.13
echo "$PORT" | grep -q MBIM && {
MBIM_PORT=$PORT
echo "$PORT" | grep -qi MBIM && {
MBIM_PORT="$PORT"
break
}
done
+4 -7
View File
@@ -20,13 +20,10 @@ shift
# second and next arguments are control port names
for PORT in "$@"; do
# match port type in Linux 5.14 and newer
grep -q AT "/sys/class/wwan/$PORT/type" 2>/dev/null && {
AT_PORT=$PORT
break
}
grep -q AT "/sys/class/wwan/$PORT/type" 2>/dev/null ||
# match port name in Linux 5.13
echo "$PORT" | grep -q AT && {
AT_PORT=$PORT
echo "$PORT" | grep -qi AT && {
AT_PORT="$PORT"
break
}
done
@@ -34,7 +31,7 @@ done
# fail if no AT port exposed
[ -n "$AT_PORT" ] || exit 2
DEVICE=/dev/${AT_PORT}
DEVICE="/dev/$AT_PORT"
at_command() {
exec 99<>"$DEVICE"