@@ -47,6 +47,66 @@ STOP_TO="${STOP_TO:-10}"
4747START_TO=" ${START_TO:- 10} "
4848POLL_I=" ${POLL_I:- 1} "
4949
50+ # --- CLI ----------------------------------------------------------------------
51+ # Default: do NOT do SSR (stop/start). Enable explicitly with --ssr
52+ DO_SSR=0
53+
54+ usage () {
55+ echo " Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
56+ echo " --ssr Perform WPSS stop/start (SSR). Default: OFF" >&2
57+ echo " --stop-to SEC Stop timeout (default: $STOP_TO )" >&2
58+ echo " --start-to SEC Start timeout (default: $START_TO )" >&2
59+ echo " --poll-i SEC Poll interval (default: $POLL_I )" >&2
60+ }
61+
62+ while [ $# -gt 0 ]; do
63+ case " $1 " in
64+ --ssr)
65+ DO_SSR=1
66+ shift
67+ ;;
68+ --stop-to)
69+ if [ $# -lt 2 ]; then
70+ log_fail " Missing value for --stop-to"
71+ usage
72+ exit 2
73+ fi
74+ STOP_TO=" $2 "
75+ shift 2
76+ ;;
77+ --start-to)
78+ if [ $# -lt 2 ]; then
79+ log_fail " Missing value for --start-to"
80+ usage
81+ exit 2
82+ fi
83+ START_TO=" $2 "
84+ shift 2
85+ ;;
86+ --poll-i)
87+ if [ $# -lt 2 ]; then
88+ log_fail " Missing value for --poll-i"
89+ usage
90+ exit 2
91+ fi
92+ POLL_I=" $2 "
93+ shift 2
94+ ;;
95+ -h|--help)
96+ usage
97+ exit 0
98+ ;;
99+ * )
100+ log_warn " Unknown argument: $1 "
101+ usage
102+ exit 2
103+ ;;
104+ esac
105+ done
106+
107+ log_info " Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I "
108+ log_info " SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)"
109+
50110# ---------- Try remoteproc path ----------
51111rp_entries=" "
52112dt_says_present=0
@@ -91,43 +151,49 @@ if [ -n "$rp_entries" ]; then
91151 continue
92152 fi
93153
94- # Stop
95- dump_rproc_logs " $rpath " before-stop
96- t0=$( date +%s)
97- log_info " $inst : stopping"
98- if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
99- t1=$( date +%s)
100- log_pass " $inst : stop PASS ($(( t1 - t0 )) s)"
101- stop_res=" PASS"
102- else
103- dump_rproc_logs " $rpath " after-stop-fail
104- log_fail " $inst : stop FAIL"
105- stop_res=" FAIL"
106- inst_fail=$(( inst_fail + 1 ))
107- RESULT_LINES=" $RESULT_LINES
154+ if [ " $DO_SSR " -eq 1 ]; then
155+ # Stop
156+ dump_rproc_logs " $rpath " before-stop
157+ t0=$( date +%s)
158+ log_info " $inst : stopping"
159+ if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
160+ t1=$( date +%s)
161+ log_pass " $inst : stop PASS ($(( t1 - t0 )) s)"
162+ stop_res=" PASS"
163+ else
164+ dump_rproc_logs " $rpath " after-stop-fail
165+ log_fail " $inst : stop FAIL"
166+ stop_res=" FAIL"
167+ inst_fail=$(( inst_fail + 1 ))
168+ RESULT_LINES=" $RESULT_LINES
108169 $inst : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
109- continue
110- fi
111- dump_rproc_logs " $rpath " after-stop
112-
113- # Start
114- dump_rproc_logs " $rpath " before-start
115- t2=$( date +%s)
116- log_info " $inst : starting"
117- if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
118- t3=$( date +%s)
119- log_pass " $inst : start PASS ($(( t3 - t2 )) s)"
120- start_res=" PASS"
121- else
122- dump_rproc_logs " $rpath " after-start-fail
123- log_fail " $inst : start FAIL"
124- start_res=" FAIL"
125- inst_fail=$(( inst_fail + 1 ))
126- RESULT_LINES=" $RESULT_LINES
170+ continue
171+ fi
172+ dump_rproc_logs " $rpath " after-stop
173+
174+ # Start
175+ dump_rproc_logs " $rpath " before-start
176+ t2=$( date +%s)
177+ log_info " $inst : starting"
178+ if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
179+ t3=$( date +%s)
180+ log_pass " $inst : start PASS ($(( t3 - t2 )) s)"
181+ start_res=" PASS"
182+ else
183+ dump_rproc_logs " $rpath " after-start-fail
184+ log_fail " $inst : start FAIL"
185+ start_res=" FAIL"
186+ inst_fail=$(( inst_fail + 1 ))
187+ RESULT_LINES=" $RESULT_LINES
127188 $inst : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
128- continue
189+ continue
190+ fi
191+ dump_rproc_logs " $rpath " after-start
192+ else
193+ log_info " $inst : SSR disabled (--ssr not set). Skipping stop/start."
194+ stop_res=" SKIPPED"
195+ start_res=" SKIPPED"
129196 fi
130- dump_rproc_logs " $rpath " after-start
131197
132198 # RPMsg ping (optional)
133199 if CTRL_DEV=$( find_rpmsg_ctrl_for " $FW " ) ; then
@@ -202,7 +268,7 @@ scan_dmesg_errors "ath11k|wpss" "." "crash|timeout|fail" "fw_version|firmware"
202268# (Return codes from scan_dmesg_errors are informational; it logs itself)
203269
204270# Net interface presence is informative
205- set -- /sys/class/net/wlan[0-9]* 2> /dev/null
271+ set -- /sys/class/net/wlan[0-9]*
206272if [ -e " $1 " ]; then
207273 log_info " wlan interface present (ath11k up)"
208274else
0 commit comments