aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-03-09 02:57:05 +0000
committerDan Williams <dan@ioncontrol.co>2025-03-09 02:57:05 +0000
commite6a7be2e4c21680383bb9362c583c41eed552a58 (patch)
tree2e5ea3d0d71d38e8110ff2001c61b06114f641cb
parent0ce457ba715c773a658c66b89c558c80724635d0 (diff)
parente1ab6e6c372669a2991246bfef169a37eafc3b70 (diff)
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
-rw-r--r--data/dispatcher-fcc-unlock/105b9
-rwxr-xr-xdata/dispatcher-fcc-unlock/14c311
2 files changed, 7 insertions, 13 deletions
diff --git a/data/dispatcher-fcc-unlock/105b b/data/dispatcher-fcc-unlock/105b
index aa88261f..ed92e6a8 100644
--- a/data/dispatcher-fcc-unlock/105b
+++ b/data/dispatcher-fcc-unlock/105b
@@ -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
diff --git a/data/dispatcher-fcc-unlock/14c3 b/data/dispatcher-fcc-unlock/14c3
index 51217f4d..f4d2f0b4 100755
--- a/data/dispatcher-fcc-unlock/14c3
+++ b/data/dispatcher-fcc-unlock/14c3
@@ -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"