From 13fce479b33eb093905483ffaa1c1f32ec9c73ca Mon Sep 17 00:00:00 2001 From: Jongmin Kim Date: Tue, 4 Mar 2025 13:59:15 +0900 Subject: [PATCH] fcc-unlock: combine Quectel FCC unlock scripts for 1eac and 2c7c Both scripts control MBIM ports and can be merged into a single script. Signed-off-by: Jongmin Kim --- data/dispatcher-fcc-unlock/1eac | 34 -------------------------- data/dispatcher-fcc-unlock/2c7c | 21 +++++++++++----- data/dispatcher-fcc-unlock/meson.build | 3 +-- 3 files changed, 16 insertions(+), 42 deletions(-) delete mode 100644 data/dispatcher-fcc-unlock/1eac diff --git a/data/dispatcher-fcc-unlock/1eac b/data/dispatcher-fcc-unlock/1eac deleted file mode 100644 index 44ce46d7..00000000 --- a/data/dispatcher-fcc-unlock/1eac +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# SPDX-License-Identifier: CC0-1.0 -# 2021 Aleksander Morgado -# -# Quectel EM120 FCC unlock operation -# - -# require program name and at least 2 arguments -[ $# -lt 2 ] && exit 1 - -# first argument is DBus path, not needed here -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 - } - # match port name in Linux 5.13 - echo "$PORT" | grep -q MBIM && { - MBIM_PORT=$PORT - break - } -done - -# fail if no MBIM port exposed -[ -n "$MBIM_PORT" ] || exit 2 - -# run mbimcli operation -mbimcli --device-open-proxy --device="/dev/$MBIM_PORT" --quectel-set-radio-state=on -exit $? diff --git a/data/dispatcher-fcc-unlock/2c7c b/data/dispatcher-fcc-unlock/2c7c index fa372927..a5e0bccc 100644 --- a/data/dispatcher-fcc-unlock/2c7c +++ b/data/dispatcher-fcc-unlock/2c7c @@ -1,9 +1,15 @@ #!/bin/sh # SPDX-License-Identifier: CC0-1.0 +# 2021 Aleksander Morgado # 2022 Leah Oswald +# 2025 Jongmin Kim # -# Queltec EM05-G FCC unlock mechanism +# Quectel MBIM FCC unlock mechanism +# EM05-G, 2c7c:030a +# EM05-G (GR), 2c7c:0313 +# EM05-G (RS), 2c7c:0314 +# EM120, 1eac:1001 # # require program name and at least 2 arguments @@ -14,16 +20,19 @@ shift # second and next arguments are control port names for PORT in "$@"; do - # match port name + # match port type in Linux 5.14 and newer + grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null || + # match port name in Linux 5.13 + echo "$PORT" | grep -q MBIM || echo "$PORT" | grep -q cdc-wdm && { - CDC_WDM_PORT=$PORT + MBIM_PORT="$PORT" break } done -# fail if no cdc-wdm port exposed -[ -n "$CDC_WDM_PORT" ] || exit 2 +# fail if no MBIM port exposed +[ -n "$MBIM_PORT" ] || exit 2 # run mbimcli operation -mbimcli --device-open-proxy --device="/dev/$CDC_WDM_PORT" --quectel-set-radio-state=on +mbimcli --device-open-proxy --device="/dev/$MBIM_PORT" --quectel-set-radio-state=on exit $? diff --git a/data/dispatcher-fcc-unlock/meson.build b/data/dispatcher-fcc-unlock/meson.build index d2f0d118..fe497875 100644 --- a/data/dispatcher-fcc-unlock/meson.build +++ b/data/dispatcher-fcc-unlock/meson.build @@ -14,7 +14,6 @@ examples = files( '105b', '1199', '14c3', - '1eac', '2c7c', ) @@ -32,7 +31,7 @@ vidpids = { '413c:81a3': '1199', '413c:81a8': '1199', '14c3:4d75': '14c3', - '1eac:1001': '1eac', + '1eac:1001': '2c7c', '2c7c:030a': '2c7c', '2c7c:0313': '2c7c', '2c7c:0314': '2c7c',