diff --git a/README.md b/README.md index d7701d2..1cc6232 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,10 @@ Override via args: ./start.sh --no-rst --no-vcc # CLK+I/O only ./start.sh --host=10.0.28.7 # stream to a remote analyser ./start.sh --pcap=session.pcap # also record decoded events to PCAP -./start.sh --debug # verbose libsigrokdecode logging +./start.sh --debug # full decoder + sigrok output (all + # annotation rows + libsigrok -l 4); + # by default only decoded APDUs and + # decoder warnings/errors are shown ``` ### Detecting the wiring (`tools/detect_pins.py`) @@ -192,7 +195,9 @@ is the usual suspect. ./start.sh --pcap=s.pcap --log=s.log # also record decoded events, log rc= ./start.sh ... --samplerate=24M # more timing headroom if needed ./start.sh ... --klog # also record kernel journal -./start.sh ... --debug # libsigrok internals at -l 4 +./start.sh ... --debug # full output: all annotation rows + # + libsigrok internals at -l 4 + # (default: APDUs + warnings only) ``` `start.sh` captures a continuous stream at the configured rate (default 16 diff --git a/start.bat b/start.bat index 3d5ab45..d065249 100644 --- a/start.bat +++ b/start.bat @@ -14,6 +14,7 @@ set "HOST=127.0.0.1" set "PORT=4729" set "PCAP=" set "DEBUG=" +set "ANNOT=iso7816=apdus,iso7816=warnings" :argloop if "%~1"=="" goto :argsdone @@ -26,7 +27,7 @@ if /i "%~1"=="--clock" ( set "CLOCK=%~2" & shift & shift & goto :arg if /i "%~1"=="--host" ( set "HOST=%~2" & shift & shift & goto :argloop ) if /i "%~1"=="--port" ( set "PORT=%~2" & shift & shift & goto :argloop ) if /i "%~1"=="--pcap" ( set "PCAP=%~2" & shift & shift & goto :argloop ) -if /i "%~1"=="--debug" ( set "DEBUG=1" & shift & goto :argloop ) +if /i "%~1"=="--debug" ( set "DEBUG=1" & set "ANNOT=iso7816" & shift & goto :argloop ) if /i "%~1"=="--no-rst" ( set "RST=" & shift & goto :argloop ) if /i "%~1"=="--no-vcc" ( set "VCC=" & shift & goto :argloop ) if /i "%~1"=="-h" ( goto :usage ) @@ -45,7 +46,9 @@ echo --clock=MODE native/detect/sample_as_clock echo --host=IP GSMTAP destination default: 127.0.0.1 echo --port=N GSMTAP port default: 4729 echo --pcap=FILE Also write decoded events to FILE (no spaces in path) -echo --debug Verbose libsigrokdecode logging (-l 4) +echo --debug Full decoder + sigrok output (all annotation rows + -l 4). +echo +echo By default only decoded APDUs and decoder warnings/errors are shown. echo --no-rst Disable RST tracking echo --no-vcc Disable VCC tracking echo. @@ -87,7 +90,7 @@ if defined PCAP set "OPTS=%OPTS%:pcap_file=%PCAP%" set "CMDLINE=sigrok-cli -d fx2lafw --config samplerate=%SAMPLERATE% --continuous -C D0,D1,D2,D3,D4,D5,D6,D7" if defined DEBUG set "CMDLINE=%CMDLINE% -l 4" -set "CMDLINE=%CMDLINE% -P iso7816:%OPTS% -A iso7816" +set "CMDLINE=%CMDLINE% -P iso7816:%OPTS% -A %ANNOT%" echo ISO 7816 streamer - clk=%CLK% data=%DATA% clock=%CLOCK% if defined RST echo RST tracking on channel %RST% diff --git a/start.sh b/start.sh index 677c698..12872dc 100755 --- a/start.sh +++ b/start.sh @@ -12,6 +12,7 @@ HOST=127.0.0.1 PORT=4729 PCAP="" DEBUG="" +ANNOT="iso7816=apdus,iso7816=warnings" # default: decoded APDUs + warnings only LOG="" KLOG="" LOOP=0 # --loop: restart on rc=0 (device stopped streaming) @@ -52,7 +53,9 @@ Options: --host=IP GSMTAP destination (default: ${HOST}) --port=N GSMTAP port (default: ${PORT}) --pcap=FILE Also write decoded events to FILE (offline analysis) - --debug Verbose libsigrokdecode logging (-l 4) + --debug Full decoder + sigrok output: all annotation rows and + verbose libsigrokdecode logging (-l 4). By default only + decoded APDUs and decoder warnings/errors are shown. --log=FILE Tee all output into FILE (postmortem / exit diagnosis) --klog[=FILE] Also record the kernel journal (journalctl -kf) to FILE (default: klog.log) -- needs journal read @@ -106,7 +109,7 @@ for arg in "$@"; do --host=*) HOST="${arg#*=}" ;; --port=*) PORT="${arg#*=}" ;; --pcap=*) PCAP="${arg#*=}" ;; - --debug) DEBUG=1 ;; + --debug) DEBUG=1; ANNOT="iso7816" ;; --log=*) LOG="${arg#*=}" ;; --klog) KLOG="klog.log" ;; --klog=*) KLOG="${arg#*=}" ;; @@ -250,7 +253,7 @@ run_once() { -C 'D0,D1,D2,D3,D4,D5,D6,D7' \ ${DEBUG:+-l 4} \ -P "iso7816:${OPTS}${pcap_opt}" \ - -A iso7816 < "${FIFO}" | tee "${ANNOT_TMP}" + -A "${ANNOT}" < "${FIFO}" | tee "${ANNOT_TMP}" local rc=${PIPESTATUS[0]} kill "${FIFO_PID}" 2>/dev/null || true rm -f "${FIFO}" 2>/dev/null || true