Skip to content

Commit

Permalink
fix device serial parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t authored Oct 30, 2023
1 parent 23e8941 commit cc6d439
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions rootfs/etc/templates/run
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ VDLM_BIN="/usr/local/bin/vdlm2dec"
# shellcheck disable=SC2001
FREQ_STRING=""

mapfile -t RTL_TEST_OUTPUT < <(timeout 1s rtl_test -d 0 2>&1 | grep -P '^\s+\d+:\s.*?,.*?,\s+SN:\s+.*?$' | IFS=$'\n' sed -n 's/^\s*\([^:]*\):[^,]*,[^,]*,\s*SN:\s*\(.*\)$/\1,\2/; s/\s*$//p' || true)
for RTL_TEST_OUTPUT_LINE in "${RTL_TEST_OUTPUT[@]}"; do
if [[ "${RTL_TEST_OUTPUT_LINE##*,}" == "$SERIAL" ]]; then
DEVICE_ID="${RTL_TEST_OUTPUT_LINE%%,*}"
fi
done
DEVICE_ID="$(timeout 1s rtl_test -d $((RANDOM+99)) 2>&1 | grep -P -e "SN: $SERIAL" | sed -n 's/^\s*\([0-9]\+\):.*$/\1/p')"

if [[ -z "${DEVICE_ID}" ]]; then
echo "Could not find device ID for serial '$SERIAL'"
Expand Down

0 comments on commit cc6d439

Please sign in to comment.