Files
sigrok_iso7816_stream/tests/baseline.txt
T
catarrh d3715c9385 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.
2026-09-09 15:51:09 +03:00

404 lines
17 KiB
Plaintext

=== Baseline captured 2026-09-09T14:15:00+03:00 ===
=== test_8 ===
('=== iso7816 decoder v1.5.0 ===',)
('etu recovered (samples):', 1237)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 37
capture ATRs : 3
capture APDUs : 56
byte-exact matches (LCS) : 28
reader exchanges not in capture (pre-capture / dropped): 9
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 17
- valid exchanges (reader retries/dupes): 11
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== test_7 ===
('=== iso7816 decoder v1.5.0 ===',)
('etu recovered (samples):', 1236)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
iso7816-1: RST deasserted
('RST deasserted',)
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 37
capture ATRs : 8
capture APDUs : 65
byte-exact matches (LCS) : 37
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 17
- valid exchanges (reader retries/dupes): 11
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== xiaomi_phone_sample ===
('=== iso7816 decoder v1.5.0 ===',)
('etu recovered (samples):', 53)
(11673977, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 0, 0, 1, 1, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 0, 0, 1, 1, 1, 1]
(11695589, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
(11697509, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 1, 1]
(11698149, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
(11698789, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 0, 0, 0, 0, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 0, 0, 0, 0, 1, 1]
(11699429, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 1, 1]
(11701349, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
(11701989, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 1, 0, 0, 1, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 1, 0, 0, 1, 0, 0]
(11709030, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
CHKSUM ERROR count: 7698
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 0
capture APDUs : 640
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 20
- valid exchanges (reader retries/dupes): 620
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== xiaomi_mi_a1_coldboot ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f96801fc78031e073fe2117574a3382033339001e')
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 473
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 10
- valid exchanges (reader retries/dupes): 463
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== 4gmodem_coldboot ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f96801fc78031e073fe2117574a3382033339001e')
(10083201, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
(10084089, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
(32207790, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 0, 0, 1, 1, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 0, 0, 1, 1, 0, 0]
(32214835, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 1, 0, 1, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 1, 0, 1, 0, 0, 0]
(32216580, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 0, 0, 0, 0, 1, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 0, 0, 0, 0, 1, 1, 1]
(32219038, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 1, 1])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 1, 1]
(32219857, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
CHKSUM ERROR count: 7218
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 327
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 9
- valid exchanges (reader retries/dupes): 318
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== samsung_A55_coldboot_new_cable ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 407
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 24
- valid exchanges (reader retries/dupes): 383
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== samsung_A55_coldboot_new_cable_sim2 ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f96801fc78031e073fe2117574a3382033339001e')
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 395
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 24
- valid exchanges (reader retries/dupes): 371
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== samsung_S21p_coldboot_new_cable ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
CHKSUM ERROR count: 0
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 399
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 24
- valid exchanges (reader retries/dupes): 375
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== samsung_S21p_coldboot_new_cable_sim2 ===
('=== iso7816 decoder v1.5.0 ===',)
('RST low at start: expecting cold-boot ATR',)
iso7816-1: RST deasserted
('RST deasserted',)
('RST deasserted (hunt/ATR already in progress)',)
('ENDATR', b'3b9f96801fc78031e073fe2117574a3382033339001e')
(72333388, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 1, 0, 1, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 1, 0, 1, 0, 0, 0]
(72394723, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
(72424969, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
(72429512, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 0, 1, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 0, 1, 0, 0, 0]
(72487445, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
(72631364, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 0, 1, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
(98955516, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
CHKSUM ERROR count: 394
CONCAT APDU count: 0
reader exchanges : 0
capture ATRs : 1
capture APDUs : 375
byte-exact matches (LCS) : 0
reader exchanges not in capture (pre-capture / dropped): 0
capture APDUs not in reader log:
- proactive/CAT (unlogged by reader SDK): 21
- valid exchanges (reader retries/dupes): 354
- GARBAGE (mis-framed/desync): 0
Degradation metrics:
- BAD_FCS (desynced by decoder): 0
- CONCAT (multi-exchange swallowed in one packet): 0
- payload mismatches (LCS-matched, bytes differ): 0
- suspicious CLA: 0
RESULT: OK - capture fully explained (reader + CAT + valid retries)
=== signal diagnostics ===
--- test_8 ---
First activity: sample 1
Frequency: 5.33 MHz
Period: 3.0 samples
Rising edges: 71858170
Transitions: 6
Transitions: 168
Transitions: 7423
--- test_7 ---
First activity: sample 2
Frequency: 5.33 MHz
Period: 3.0 samples
Rising edges: 71428947
Transitions: 16
Transitions: 444
Transitions: 8998
--- xiaomi_phone_sample ---
First activity: sample 11497325
Frequency: 5.33 MHz
Period: 3.0 samples
Rising edges: 12833950
Transitions: 0
Transitions: 78488
--- samsung_A55_coldboot_new_cable ---
First activity: sample 46045778
Frequency: 4.00 MHz
Period: 4.0 samples
Rising edges: 29683152
Transitions: 1
Transitions: 1
Transitions: 46003
--- samsung_S21p_coldboot_new_cable ---
First activity: sample 44024869
Frequency: 4.00 MHz
Period: 4.0 samples
Rising edges: 30172749
Transitions: 1
Transitions: 3
Transitions: 47161
=== unit tests ===
test_glitch_low_pulse_removed (__main__.TestDeglitchEdges.test_glitch_low_pulse_removed) ... ok
test_no_edges (__main__.TestDeglitchEdges.test_no_edges) ... ok
test_real_pulses_preserved (__main__.TestDeglitchEdges.test_real_pulses_preserved) ... ok
test_short_pulse_start_edge_preserved (__main__.TestDeglitchEdges.test_short_pulse_start_edge_preserved) ... ok
test_is_desynced_all_zero_is_not_desync (__main__.TestDesyncHelpers.test_is_desynced_all_zero_is_not_desync) ... ok
test_is_desynced_bad_sw (__main__.TestDesyncHelpers.test_is_desynced_bad_sw) ... ok
test_is_desynced_clean_packets (__main__.TestDesyncHelpers.test_is_desynced_clean_packets) ... ok
test_is_desynced_oversized (__main__.TestDesyncHelpers.test_is_desynced_oversized) ... ok
test_is_desynced_short_fragment (__main__.TestDesyncHelpers.test_is_desynced_short_fragment) ... ok
test_max_tpdu_len (__main__.TestDesyncHelpers.test_max_tpdu_len) ... ok
test_plausible_sw_accepts_valid_classes (__main__.TestDesyncHelpers.test_plausible_sw_accepts_valid_classes) ... ok
test_plausible_sw_rejects_garbage (__main__.TestDesyncHelpers.test_plausible_sw_rejects_garbage) ... ok
test_a55_u1_concat (__main__.TestEmbeddedExchanges.test_a55_u1_concat) ... ok
test_a55_u4_mega_concat (__main__.TestEmbeddedExchanges.test_a55_u4_mega_concat) ... ok
test_channel1_select_after_manage_channel_swallow (__main__.TestEmbeddedExchanges.test_channel1_select_after_manage_channel_swallow) ... ok
test_clean_atr_fragment_select (__main__.TestEmbeddedExchanges.test_clean_atr_fragment_select) ... ok
test_clean_channel1_select_after_manage_channel (__main__.TestEmbeddedExchanges.test_clean_channel1_select_after_manage_channel) ... ok
test_clean_get_response_fcp (__main__.TestEmbeddedExchanges.test_clean_get_response_fcp) ... ok
test_clean_read_record_ff_run (__main__.TestEmbeddedExchanges.test_clean_read_record_ff_run) ... ok
test_clean_select_611e (__main__.TestEmbeddedExchanges.test_clean_select_611e) ... ok
test_clean_select_6a82 (__main__.TestEmbeddedExchanges.test_clean_select_6a82) ... ok
test_concat_packets_are_not_is_desynced (__main__.TestEmbeddedExchanges.test_concat_packets_are_not_is_desynced) ... ok
test_samsung_record_burst_concat (__main__.TestEmbeddedExchanges.test_samsung_record_burst_concat) ... ok
test_xiaomi_select_getresp_swallow (__main__.TestEmbeddedExchanges.test_xiaomi_select_getresp_swallow) ... ok
test_build_packet_bad_fcs_flag (__main__.TestGsmtapFlags.test_build_packet_bad_fcs_flag) ... ok
test_build_packet_payload_passthrough (__main__.TestGsmtapFlags.test_build_packet_payload_passthrough) ... ok
test_build_packet_plain_res_zero (__main__.TestGsmtapFlags.test_build_packet_plain_res_zero) ... ok
test_flag_constant_value (__main__.TestGsmtapFlags.test_flag_constant_value) ... ok
test_accepts_full_hold_fall (__main__.TestNextStartFall.test_accepts_full_hold_fall) ... ok
test_finds_fall_after_threshold (__main__.TestNextStartFall.test_finds_fall_after_threshold) ... ok
test_finds_fall_exactly_at_threshold (__main__.TestNextStartFall.test_finds_fall_exactly_at_threshold)
Regression test for Samsung 16 CLK/ETU concatenation. ... ok
test_rejects_phantom_sub_etu_fall (__main__.TestNextStartFall.test_rejects_phantom_sub_etu_fall) ... ok
test_returns_none_when_no_fall (__main__.TestNextStartFall.test_returns_none_when_no_fall) ... ok
test_invalid_cla (__main__.TestValidateT0Apdu.test_invalid_cla) ... ok
test_invalid_cla_proprietary_unseen (__main__.TestValidateT0Apdu.test_invalid_cla_proprietary_unseen) ... ok
test_invalid_ins_lsb_odd (__main__.TestValidateT0Apdu.test_invalid_ins_lsb_odd) ... ok
test_invalid_ins_sw_collision (__main__.TestValidateT0Apdu.test_invalid_ins_sw_collision) ... ok
test_invalid_ins_zero (__main__.TestValidateT0Apdu.test_invalid_ins_zero) ... ok
test_invalid_oversized (__main__.TestValidateT0Apdu.test_invalid_oversized) ... ok
test_invalid_sw1 (__main__.TestValidateT0Apdu.test_invalid_sw1) ... ok
test_invalid_too_short (__main__.TestValidateT0Apdu.test_invalid_too_short) ... ok
test_valid_case1_direct_sw (__main__.TestValidateT0Apdu.test_valid_case1_direct_sw) ... ok
test_valid_case2_with_response (__main__.TestValidateT0Apdu.test_valid_case2_with_response) ... ok
test_valid_case3_with_command_data (__main__.TestValidateT0Apdu.test_valid_case3_with_command_data) ... ok
test_valid_cla_channel1_select_after_manage_channel (__main__.TestValidateT0Apdu.test_valid_cla_channel1_select_after_manage_channel) ... ok
test_valid_cla_interindustry_classes (__main__.TestValidateT0Apdu.test_valid_cla_interindustry_classes) ... ok
test_valid_direct_sw_with_p3_nonzero (__main__.TestValidateT0Apdu.test_valid_direct_sw_with_p3_nonzero) ... ok
----------------------------------------------------------------------
Ran 47 tests in 0.017s
OK