Debian Codegraph @

data/dispatcher-fcc-unlock/2c7c

raw
1 #!/bin/sh
2
3 # SPDX-License-Identifier: CC0-1.0
4 # 2021 Aleksander Morgado <[email protected]>
5 # 2022 Leah Oswald <[email protected]>
6 # 2025 Jongmin Kim <[email protected]>
7 #
8 # Quectel MBIM FCC unlock mechanism
9 # EM05-G, 2c7c:030a
10 # EM05-G (GR), 2c7c:0313
11 # EM05-G (RS), 2c7c:0314
12 # RM520N, 2c7c:0801
13 # EM120, 1eac:1001
14 # RM520N (HP shipped), 1eac:1004
15 # RM520N (Lenovo shipped), 1eac:1007
16 #
17
18 # require program name and at least 2 arguments
19 [ $# -lt 2 ] && exit 1
20
21 # first argument is DBus path, not needed here
22 shift
23
24 # second and next arguments are control port names
25 for PORT in "$@"; do
26 # match port type in Linux 5.14 and newer
27 grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null ||
28 # match port name in Linux 5.13
29 echo "$PORT" | grep -qi MBIM ||
30 echo "$PORT" | grep -q cdc-wdm && {
31 MBIM_PORT="$PORT"
32 break
33 }
34 done
35
36 # fail if no MBIM port exposed
37 [ -n "$MBIM_PORT" ] || exit 2
38
39 # run mbimcli operation
40 mbimcli --device-open-proxy --device="/dev/$MBIM_PORT" --quectel-set-radio-state=on
41 exit $?