blob: d911d54ce4515d722b47d86f2e8947c2387bafed [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001From ddf634b92bf96b35f521db6da329628b4525c2eb Mon Sep 17 00:00:00 2001
2From: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
3Date: Fri, 25 Feb 2022 21:37:13 +0100
4Subject: [PATCH 2/2] fcc-unlock: Make scripts POSIX shell compatible
5
6This allows us to not rely on bash which may not be available on
7constrained systems, e.g. Yocto-built embedded systems. The scripts now
8pass shellcheck.
9
10Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
11---
12 data/fcc-unlock/105b | 8 ++++----
13 data/fcc-unlock/1199 | 6 +++---
14 data/fcc-unlock/1eac | 8 ++++----
15 3 files changed, 11 insertions(+), 11 deletions(-)
16
17diff --git a/data/fcc-unlock/105b b/data/fcc-unlock/105b
18index f276050f..772c90f4 100644
19--- a/data/fcc-unlock/105b
20+++ b/data/fcc-unlock/105b
21@@ -15,20 +15,20 @@ shift
22 # second and next arguments are control port names
23 for PORT in "$@"; do
24 # match port type in Linux 5.14 and newer
25- grep -q MBIM /sys/class/wwan/${PORT}/type 2>/dev/null && {
26+ grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null && {
27 MBIM_PORT=$PORT
28 break
29 }
30 # match port name in Linux 5.13
31- [[ $PORT == *"MBIM"* ]] && {
32+ echo "$PORT" | grep -q MBIM && {
33 MBIM_PORT=$PORT
34 break
35 }
36 done
37
38 # fail if no MBIM port exposed
39-[ -n "${MBIM_PORT}" ] || exit 2
40+[ -n "$MBIM_PORT" ] || exit 2
41
42 # run qmicli operation over MBIM
43-qmicli --device-open-proxy --device=/dev/${MBIM_PORT} --dms-foxconn-set-fcc-authentication=0
44+qmicli --device-open-proxy --device="/dev/$MBIM_PORT" --dms-foxconn-set-fcc-authentication=0
45 exit $?
46diff --git a/data/fcc-unlock/1199 b/data/fcc-unlock/1199
47index e1d3804c..6dbf8d1b 100644
48--- a/data/fcc-unlock/1199
49+++ b/data/fcc-unlock/1199
50@@ -19,15 +19,15 @@ shift
51 # second and next arguments are control port names
52 for PORT in "$@"; do
53 # match port name
54- [[ $PORT == *"cdc-wdm"* ]] && {
55+ echo "$PORT" | grep -q cdc-wdm && {
56 CDC_WDM_PORT=$PORT
57 break
58 }
59 done
60
61 # fail if no cdc-wdm port exposed
62-[ -n "${CDC_WDM_PORT}" ] || exit 2
63+[ -n "$CDC_WDM_PORT" ] || exit 2
64
65 # run qmicli operation
66-qmicli --device-open-proxy --device=/dev/${CDC_WDM_PORT} --dms-set-fcc-authentication
67+qmicli --device-open-proxy --device="/dev/$CDC_WDM_PORT" --dms-set-fcc-authentication
68 exit $?
69diff --git a/data/fcc-unlock/1eac b/data/fcc-unlock/1eac
70index d9342852..44ce46d7 100644
71--- a/data/fcc-unlock/1eac
72+++ b/data/fcc-unlock/1eac
73@@ -15,20 +15,20 @@ shift
74 # second and next arguments are control port names
75 for PORT in "$@"; do
76 # match port type in Linux 5.14 and newer
77- grep -q MBIM /sys/class/wwan/${PORT}/type 2>/dev/null && {
78+ grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null && {
79 MBIM_PORT=$PORT
80 break
81 }
82 # match port name in Linux 5.13
83- [[ $PORT == *"MBIM"* ]] && {
84+ echo "$PORT" | grep -q MBIM && {
85 MBIM_PORT=$PORT
86 break
87 }
88 done
89
90 # fail if no MBIM port exposed
91-[ -n "${MBIM_PORT}" ] || exit 2
92+[ -n "$MBIM_PORT" ] || exit 2
93
94 # run mbimcli operation
95-mbimcli --device-open-proxy --device=/dev/${MBIM_PORT} --quectel-set-radio-state=on
96+mbimcli --device-open-proxy --device="/dev/$MBIM_PORT" --quectel-set-radio-state=on
97 exit $?
98--
992.34.1
100