Skip to content

Commit 2e3d558

Browse files
committed
app: scripts: Prefer to use socat instead of DD for serial capture
The DD utility is written only for block devices, not character devices, so it might stop when reaching EOF. Socat is a tool that is supposed to work on this job, but not always installed. Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
1 parent 255f6b1 commit 2e3d558

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

app/scripts/sm_start_ppp.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,15 @@ test -c $AT_CMUX
239239

240240
if [ $TRACE -gt 0 ]; then
241241
echo "Starting trace collection..."
242-
start-stop-daemon --start --pidfile $TRACE_PID_FILE --make-pidfile \
243-
--background --exec /bin/dd -- if=$MT_CMUX of=$MODEM_TRACE_FILE bs=1024
242+
# Prefer to use socat, if installed.
243+
if command -v socat >/dev/null 2>&1; then
244+
start-stop-daemon --start --pidfile $TRACE_PID_FILE --make-pidfile \
245+
--background --exec $(command -v socat) -- -u $MT_CMUX,cfmakeraw,clocal=1 \
246+
CREATE:$MODEM_TRACE_FILE
247+
else
248+
start-stop-daemon --start --pidfile $TRACE_PID_FILE --make-pidfile \
249+
--background --exec /bin/dd -- if=$MT_CMUX of=$MODEM_TRACE_FILE bs=1024
250+
fi
244251
fi
245252
echo "Connect and wait for PPP link..."
246253

0 commit comments

Comments
 (0)