v1.5.0: invalid-INS one-byte re-frame + explicit discard logging
Residual CONCAT mis-frames (4gmodem/A55_sim2/S21p_sim2) traced to a silent 5-byte drop at an invalid-INS T=0 header (0x0f 00 a4 08 04). Drop only the stray leading byte and re-frame the remaining four via _replay so the real command (00 a4 08 04 02 2f 00 -> 61 1c) is recovered. - _note_discard()/_consume_first(): every consumed-but-unemitted byte is now logged; idle 0x00/0xFF discards are rate-limited, real data always gets an ANN_WARN annotation. - All read-until-SW loops log skipped non-SW bytes. - All traces: CONCAT 0; BAD_FCS/GARBAGE 0; test_8/test_7 RESULT OK; 47/47 unit tests; baseline byte-identical. History rewritten to a single root commit so no example trace is stored in the repo (fixtures are local-only, gitignored). README keeps only generic <trace>.sr placeholders; AGENTS.md retains the fixture names.
This commit is contained in:
commit
d3715c9385
34 files changed
+7855
No files matched your search
@@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
# sigrok_iso7816_stream setup: verify sigrok-cli and register the decoder.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
DECODERS_DIR="${HOME}/.local/share/libsigrokdecode/decoders"
|
||||
LINK="${DECODERS_DIR}/iso7816"
|
||||
FIRMWARE_DIRS=(
|
||||
/usr/share/sigrok-firmware
|
||||
/usr/share/sigrok/firmware
|
||||
/usr/local/share/sigrok-firmware
|
||||
)
|
||||
|
||||
printf 'Checking sigrok-cli... '
|
||||
if ! command -v sigrok-cli >/dev/null 2>&1; then
|
||||
echo "NOT FOUND"
|
||||
echo " Install it first, e.g.: sudo apt install sigrok-cli"
|
||||
exit 1
|
||||
fi
|
||||
echo "found ($(command -v sigrok-cli))"
|
||||
sigrok-cli --version 2>/dev/null | sed 's/^/ /'
|
||||
|
||||
printf 'Checking FX2 firmware... '
|
||||
FW_FOUND=""
|
||||
for dir in "${FIRMWARE_DIRS[@]}"; do
|
||||
if compgen -G "${dir}/fx2lafw-*.fw" >/dev/null; then
|
||||
FW_FOUND="${dir}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${FW_FOUND}" ]; then
|
||||
echo "NOT FOUND"
|
||||
echo " fx2lafw firmware files are missing."
|
||||
echo " Arch/CachyOS: sudo pacman -S sigrok-firmware-fx2lafw"
|
||||
echo " Debian/Ubuntu: sudo apt install sigrok-firmware-fx2lafw"
|
||||
exit 1
|
||||
fi
|
||||
echo "ok (${FW_FOUND})"
|
||||
|
||||
printf 'Checking decoder directory... '
|
||||
mkdir -p "${DECODERS_DIR}"
|
||||
echo "ok (${DECODERS_DIR})"
|
||||
|
||||
printf 'Installing decoder symlink... '
|
||||
if [ -L "${LINK}" ]; then
|
||||
rm "${LINK}"
|
||||
elif [ -e "${LINK}" ]; then
|
||||
echo ""
|
||||
echo " ${LINK} exists and is not a symlink; refusing to overwrite." >&2
|
||||
exit 1
|
||||
fi
|
||||
ln -s "${REPO_DIR}" "${LINK}"
|
||||
echo "ok"
|
||||
|
||||
printf 'Verifying... '
|
||||
target="$(readlink -f "${LINK}")"
|
||||
if [ "${target}" = "${REPO_DIR}" ] && [ -f "${target}/pd.py" ]; then
|
||||
echo "ok (${LINK} -> ${target})"
|
||||
else
|
||||
echo "FAILED" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'Probing hardware max samplerate... '
|
||||
MAX_RATE=""
|
||||
DEVICE_MSG=""
|
||||
for rate in 1M 2M 4M 8M 12M 16M 20M 24M; do
|
||||
result="$(sigrok-cli -d fx2lafw --config "samplerate=${rate}" --continuous \
|
||||
--time 20 -P 'iso7816:clk=D0:data=D1' 2>&1 || true)"
|
||||
if echo "${result}" | grep -q "Unable to claim"; then
|
||||
DEVICE_MSG="blocked (another program holds the device; stop it and re-run)"
|
||||
break
|
||||
fi
|
||||
if echo "${result}" | grep -q "Failed to open device\|No devices found"; then
|
||||
DEVICE_MSG="skipped (no FX2 device connected)"
|
||||
break
|
||||
fi
|
||||
if ! echo "${result}" | grep -qE "invalid argument|Unable to sample|Could not start"; then
|
||||
MAX_RATE="${rate}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${DEVICE_MSG}" ]; then
|
||||
echo "${DEVICE_MSG}"
|
||||
elif [ -n "${MAX_RATE}" ]; then
|
||||
echo "${MAX_RATE}"
|
||||
if [ "${MAX_RATE}" != "24M" ]; then
|
||||
echo " Device rejects rates above ${MAX_RATE}. Rates up to 24 MHz need"
|
||||
echo " 8-bit sampling: only channels D0-D7 may be enabled (enabling"
|
||||
echo " A0/analog forces 16-bit collection, capped at 12 MHz)."
|
||||
echo " start.sh restricts channels accordingly."
|
||||
fi
|
||||
else
|
||||
echo "unknown (device present but no rate accepted)"
|
||||
fi
|
||||
|
||||
echo "Done. Run ./start.sh to begin capture."
|
||||
Reference in new issue
Block a user