Hygiene: drop dead code, re-raise SystemError, resource+doc cleanup, add LICENSE
- pd.py: remove _lock_etu_from_edges (long-disabled) and the no-op while-True FIND START wrapper. - pd.py: re-raise SystemError (libsigrokdecode's clean EOF signal) in the six 'except Exception: pass' guards so put()/wait() at end-of-capture exits cleanly instead of being swallowed. - pd.py: fix _measure_clock_period docstring (averages, not robust-min); drop stale 'line 1633' comment; document the synthetic pcap UDP header (zero IP checksum / fixed loopback+ports are intentional). - signal_diagnostic.py: add --max-samples cap + document whole-capture RAM cost; fix stale '--rst/--vcc=ignore' guidance (-> --no-rst/--no-vcc). - tests: make test_valid_cla_interindustry_classes use subTest (was a no-op tuple expression). - start.sh/start.bat: note the -A multi-spec form is sigrok-cli 0.7.x. - Remove stale tests/baseline_new.txt (v1.1.3-era, ATR-included mode). - Add top-level LICENSE (GPL-2.0-or-later).
This commit is contained in:
1 parent
e6ff3a2e14
commit
e1903649a7
7 files changed
+356
-521
No files matched your search
@@ -0,0 +1,289 @@
|
||||
sigrok_iso7816_stream is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The full text of the GNU General Public License version 2 follows.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -41,6 +41,11 @@ class Ann:
|
||||
|
||||
|
||||
class pcap_udp_pkt():
|
||||
# GSMTAP-SIM wrapped in a synthetic Ethernet/IP/UDP header so the binary
|
||||
# output dissects as a UDP stream in Wireshark. The IPv4 header checksum
|
||||
# is left 0 and the endpoints are fixed loopback + the default GSMTAP
|
||||
# ports on purpose: Wireshark tolerates the zero checksum and the values
|
||||
# are only cosmetic. Field bytes are patched in set_data() below.
|
||||
# GSM TAP
|
||||
h = b''
|
||||
|
||||
@@ -779,6 +784,8 @@ class Decoder(srd.Decoder):
|
||||
wes = max(self.es, wss + 1)
|
||||
self.put(wss, wes, self.out_ann,
|
||||
[Ann.ANN_WARN, ["noisy signal"]])
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
elif errs <= 2:
|
||||
@@ -800,9 +807,9 @@ class Decoder(srd.Decoder):
|
||||
hard-coded 3× approximation and gives the correct ETU for the ATR and
|
||||
for any post-PPS speed. Returns True if a stable period was found.
|
||||
|
||||
Collects multiple CLK rising-edge spacings and picks the smallest
|
||||
recurring one (like _robust_min) so a single glitch does not skew the
|
||||
result.'''
|
||||
Collects multiple CLK rising-edge spacings and averages them, which
|
||||
handles CLK periods that alternate between samples (e.g. a 4,3,3
|
||||
pattern for ~5.33 MHz at 16 MHz sample rate).'''
|
||||
if self.sample_as_clock or self.detect_clock:
|
||||
return False
|
||||
spacings = []
|
||||
@@ -826,6 +833,8 @@ class Decoder(srd.Decoder):
|
||||
self._samples_per_clock = period
|
||||
self.log("clock period (samples):", period)
|
||||
return True
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
@@ -937,22 +946,6 @@ class Decoder(srd.Decoder):
|
||||
self._edge_read = True
|
||||
self.log("etu recovered (samples):", self.bit_samples)
|
||||
|
||||
def _lock_etu_from_edges(self, min_spacings=6):
|
||||
'''Lock the ETU from the most recent DATA edge spacings.
|
||||
|
||||
Used after the first few bytes of an ATR (which provide a clean,
|
||||
contiguous burst at the default ETU) to derive the actual bit period
|
||||
so the rest of the session is decoded at the correct speed.'''
|
||||
if len(self._edge_spacings) < min_spacings:
|
||||
return
|
||||
spacings = list(self._edge_spacings)
|
||||
etu = self._robust_min(spacings)
|
||||
if 4 <= etu <= 100000:
|
||||
self.bit_samples = etu
|
||||
self._etu_confirm_count = 3 # lock immediately
|
||||
self._etu_fail_count = 0
|
||||
self.log("ETU locked from ATR edges:", etu)
|
||||
|
||||
def _confirm_etu(self, parity_ok):
|
||||
'''Validate ETU measurement after _measure_etu. Call after each byte
|
||||
decode in _read_byte_edges. After 3 successful decodes the
|
||||
@@ -1168,6 +1161,8 @@ class Decoder(srd.Decoder):
|
||||
try:
|
||||
self.put(self.ss, self.samplenum, self.out_ann,
|
||||
[Ann.ANN_WARN, ["I/O stuck low?"]])
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
@@ -1277,6 +1272,8 @@ class Decoder(srd.Decoder):
|
||||
try:
|
||||
self.put(self.ss, self.samplenum, self.out_ann,
|
||||
[Ann.ANN_WARN, ["I/O stuck low?"]])
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
@@ -1439,6 +1436,8 @@ class Decoder(srd.Decoder):
|
||||
try:
|
||||
self.put(self.ss, self.samplenum, self.out_ann,
|
||||
[Ann.ANN_WARN, ["I/O stuck low?"]])
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
@@ -1607,12 +1606,6 @@ class Decoder(srd.Decoder):
|
||||
if t0 is None:
|
||||
return
|
||||
self.ATR.append(t0)
|
||||
# Lock ETU from the first two ATR bytes (TS + T0). The ATR is sent
|
||||
# at the default ETU, so its edge spacings are the authoritative
|
||||
# timing reference for the rest of the session (until PPS changes it).
|
||||
# Temporarily disabled: measurement is unstable on some captures.
|
||||
# if self.bit_samples is None:
|
||||
# self._lock_etu_from_edges(min_spacings=6)
|
||||
|
||||
firstT0 = t0
|
||||
|
||||
@@ -1689,7 +1682,7 @@ class Decoder(srd.Decoder):
|
||||
# averaging; reset to 372 so PPS (also at the default rate) is
|
||||
# read at the correct bit boundary.
|
||||
self.clock_skip = 372
|
||||
# Also lock bit_samples so the mid-session re-measure (line 1633)
|
||||
# Also lock bit_samples so the mid-session re-measure in decode_step
|
||||
# does not re-run and overwrite clock_skip=372 with a wrong value
|
||||
# derived from pre-ATR edge spacings. _confirm_etu() may have
|
||||
# cleared bit_samples during ATR hunt (parity failures on noise),
|
||||
@@ -1979,12 +1972,10 @@ class Decoder(srd.Decoder):
|
||||
# Find the first frame (sample-based, gating-immune) and hand it
|
||||
# to the ATR hunter. RST/VCC edges are still serviced inside
|
||||
# wait_data_falling via track_rst/track_vcc.
|
||||
while True:
|
||||
byte = self.read_first_byte()
|
||||
self.peeked_byte = byte
|
||||
self.peeked_samplenum = self.ss
|
||||
self.handle_atr(self.wait({'skip': 0}))
|
||||
break
|
||||
byte = self.read_first_byte()
|
||||
self.peeked_byte = byte
|
||||
self.peeked_samplenum = self.ss
|
||||
self.handle_atr(self.wait({'skip': 0}))
|
||||
elif self.state == 'DATA':
|
||||
packet = [];
|
||||
|
||||
@@ -2487,6 +2478,8 @@ class Decoder(srd.Decoder):
|
||||
wes = max(self.es, wss + 1)
|
||||
self.put(wss, wes, self.out_ann,
|
||||
[Ann.ANN_WARN, ["decode error, resynced"]])
|
||||
except SystemError:
|
||||
raise
|
||||
except Exception:
|
||||
pass
|
||||
self.state = 'DATA'
|
||||
|
||||
@@ -15,6 +15,7 @@ set "HOST=127.0.0.1"
|
||||
set "PORT=4729"
|
||||
set "PCAP="
|
||||
set "DEBUG="
|
||||
rem Annotation rows (multi-spec form is sigrok-cli 0.7.x syntax; pin on upgrade)
|
||||
set "ANNOT=iso7816=apdus,iso7816=warnings"
|
||||
set "PROTOCOL=T=0"
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ HOST=127.0.0.1
|
||||
PORT=4729
|
||||
PCAP=""
|
||||
DEBUG=""
|
||||
# Annotation rows to show. The comma-separated "decoder=row,decoder=row"
|
||||
# multi-spec form is sigrok-cli 0.7.x syntax (verified 0.7.2); newer
|
||||
# sigrok-cli uses a different row selector, so pin this if upgrading.
|
||||
ANNOT="iso7816=apdus,iso7816=warnings" # default: decoded APDUs + warnings only
|
||||
LOG=""
|
||||
KLOG=""
|
||||
|
||||
@@ -1,476 +0,0 @@
|
||||
=== Baseline captured 2026-09-04T22:55:20+03:00 ===
|
||||
|
||||
=== test_8 ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('Invalid TS byte 0x90 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x90 - skipped
|
||||
('Invalid TS byte 0x00 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x00 - skipped
|
||||
('Invalid TS byte 0xf7 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xf7 - skipped
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
('Invalid TS byte 0x10 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x10 - skipped
|
||||
('Invalid TS byte 0x95 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x95 - skipped
|
||||
('Invalid TS byte 0x7a (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x7a - skipped
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
('Invalid TS byte 0x10 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x10 - skipped
|
||||
('warm reset: re-arming ATR hunt',)
|
||||
CHKSUM ERROR count: 28
|
||||
reader exchanges : 37
|
||||
capture ATRs : 2
|
||||
capture APDUs : 54
|
||||
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): 9
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== test_8 mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('etu recovered (samples):', 1237)
|
||||
('warm reset: re-arming ATR hunt',)
|
||||
('Invalid TS byte 0x95 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x95 - skipped
|
||||
('Invalid TS byte 0x7a (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x7a - skipped
|
||||
(382251, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xfc (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xfc - skipped
|
||||
(7362370, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
(14335815, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
('Invalid TS byte 0xfb (pre-activation?), resyncing',)
|
||||
CHKSUM ERROR count: 38
|
||||
reader exchanges : 37
|
||||
capture ATRs : 2
|
||||
capture APDUs : 54
|
||||
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): 9
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== test_7 ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('warm reset: re-arming ATR hunt',)
|
||||
('Invalid TS byte 0x07 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x07 - skipped
|
||||
('Invalid TS byte 0x95 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x95 - skipped
|
||||
('Invalid TS byte 0x7a (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x7a - skipped
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
('Invalid TS byte 0x10 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x10 - skipped
|
||||
('Invalid TS byte 0x95 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x95 - skipped
|
||||
('Invalid TS byte 0x7a (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x7a - skipped
|
||||
(23123034, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
CHKSUM ERROR count: 166
|
||||
reader exchanges : 37
|
||||
capture ATRs : 4
|
||||
capture APDUs : 10
|
||||
byte-exact matches (LCS) : 10
|
||||
reader exchanges not in capture (pre-capture / dropped): 27
|
||||
capture APDUs not in reader log:
|
||||
- proactive/CAT (unlogged by reader SDK): 0
|
||||
- valid exchanges (reader retries/dupes): 0
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== test_7 mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('warm reset: re-arming ATR hunt',)
|
||||
('etu recovered (samples):', 1236)
|
||||
('warm reset: re-arming ATR hunt',)
|
||||
('ENDATR', b'3b9f95801fc78031e073fe21136364035b83079000f7')
|
||||
(45481390, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
(45636295, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0x9f (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x9f - skipped
|
||||
('Invalid TS byte 0x95 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x95 - skipped
|
||||
('Invalid TS byte 0x80 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x80 - skipped
|
||||
('Invalid TS byte 0x1f (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x1f - skipped
|
||||
('Invalid TS byte 0xc7 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xc7 - skipped
|
||||
('Invalid TS byte 0x80 (pre-activation?), resyncing',)
|
||||
CHKSUM ERROR count: 162
|
||||
reader exchanges : 37
|
||||
capture ATRs : 4
|
||||
capture APDUs : 10
|
||||
byte-exact matches (LCS) : 10
|
||||
reader exchanges not in capture (pre-capture / dropped): 27
|
||||
capture APDUs not in reader log:
|
||||
- proactive/CAT (unlogged by reader SDK): 0
|
||||
- valid exchanges (reader retries/dupes): 0
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== xiaomi_phone ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('Invalid TS byte 0xf4 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xf4 - skipped
|
||||
(11685168, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xff (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xff - skipped
|
||||
(11703683, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 0, 1, 0, 0, 0, 0, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 0, 1, 0, 0, 0, 0, 0]
|
||||
('Invalid TS byte 0x0b (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x0b - skipped
|
||||
('Invalid TS byte 0xe8 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xe8 - skipped
|
||||
('Invalid TS byte 0xbc (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xbc - skipped
|
||||
(11739309, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 0, 1, 1, 1, 0, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 0, 1, 1, 1, 0, 1, 0]
|
||||
('Invalid TS byte 0xb9 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xb9 - skipped
|
||||
('Invalid TS byte 0x5c (pre-activation?), resyncing',)
|
||||
CHKSUM ERROR count: 142
|
||||
reader exchanges : 0
|
||||
capture ATRs : 0
|
||||
capture APDUs : 0
|
||||
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): 0
|
||||
- valid exchanges (reader retries/dupes): 0
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== xiaomi_phone mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('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: 10140
|
||||
reader exchanges : 0
|
||||
capture ATRs : 0
|
||||
capture APDUs : 620
|
||||
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): 18
|
||||
- valid exchanges (reader retries/dupes): 602
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== samsung_phone_sample ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
(3125821, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
|
||||
('Invalid TS byte 0xfc (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xfc - skipped
|
||||
('Invalid TS byte 0x03 (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x03 - skipped
|
||||
(21909783, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 1, 1, 1, 0, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 1, 1, 1, 0, 1, 0]
|
||||
('Invalid TS byte 0xbc (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0xbc - skipped
|
||||
(21952849, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 0, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 0, 0]
|
||||
('Invalid TS byte 0x7f (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x7f - skipped
|
||||
(21969301, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 0, 0, 0, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 0, 0, 0, 1, 0]
|
||||
('Invalid TS byte 0x8f (pre-activation?), resyncing',)
|
||||
iso7816-1: Invalid TS byte 0x8f - skipped
|
||||
('Invalid TS byte 0xfe (pre-activation?), resyncing',)
|
||||
CHKSUM ERROR count: 2062
|
||||
reader exchanges : 0
|
||||
capture ATRs : 0
|
||||
capture APDUs : 2
|
||||
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): 0
|
||||
- valid exchanges (reader retries/dupes): 2
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== samsung_phone_sample mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('etu recovered (samples):', 72)
|
||||
(3272987, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 1, 1, 1, 1, 1, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 1, 1, 1, 1, 1, 1, 0]
|
||||
(3273839, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 1, 0, 1, 1, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 1, 0, 1, 1, 1, 0]
|
||||
('etu recovered (samples):', 71)
|
||||
(21919147, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||
(22026940, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||
(22831386, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 0, 0, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 0, 0, 1, 1]
|
||||
(22850665, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 0, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 0, 1, 0]
|
||||
(22853174, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 0, 1, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 0, 1, 1, 0]
|
||||
(22855060, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||
(22873632, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 1, 1, 1, 1, 1, 1, 0])
|
||||
CHKSUM ERROR count: 1514
|
||||
reader exchanges : 0
|
||||
capture ATRs : 1
|
||||
capture APDUs : 49
|
||||
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): 0
|
||||
- valid exchanges (reader retries/dupes): 44
|
||||
- GARBAGE (mis-framed/desync): 5
|
||||
GARBAGE: 00a41f04026f38ff61
|
||||
GARBAGE: 00a40004026f07ff61
|
||||
GARBAGE: 00a40004026f78ff61
|
||||
GARBAGE: 00a4000402ff6fdfff
|
||||
GARBAGE: 00a40004026fe3ff61
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 6
|
||||
in GARBAGE: 5, in retries: 1, in CAT: 0, in matched: 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: UNCLEAN - 5 mis-framed capture APDU(s)
|
||||
|
||||
=== sunrise_phone_sample ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('ENDATR', b'3b9f96801fc68031e073fe211b644127910082900037')
|
||||
CHKSUM ERROR count: 0
|
||||
reader exchanges : 0
|
||||
capture ATRs : 1
|
||||
capture APDUs : 1077
|
||||
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): 5
|
||||
- valid exchanges (reader retries/dupes): 1072
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== sunrise_phone_sample mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('etu recovered (samples):', 5723)
|
||||
(88911990, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 0, 0, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 0, 0, 1, 1]
|
||||
(92269756, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(93979892, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(94115907, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
(95206798, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(95329967, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
(95981570, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 1, 1, 0, 1, 1, 1, 0])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 1, 1, 0, 1, 1, 1, 0]
|
||||
(99228947, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(99366855, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
CHKSUM ERROR count: 1834
|
||||
reader exchanges : 0
|
||||
capture ATRs : 0
|
||||
capture APDUs : 1
|
||||
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): 0
|
||||
- valid exchanges (reader retries/dupes): 1
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== sim_turnon ATR-included ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('ENDATR', b'3b9f96801fc78031e073fe211163444d2183079000e2')
|
||||
CHKSUM ERROR count: 0
|
||||
reader exchanges : 0
|
||||
capture ATRs : 1
|
||||
capture APDUs : 1390
|
||||
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): 5
|
||||
- valid exchanges (reader retries/dupes): 1385
|
||||
- GARBAGE (mis-framed/desync): 0
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: OK - capture fully explained (reader + CAT + valid retries)
|
||||
|
||||
=== sim_turnon mid-session ===
|
||||
('iso7816 decoder v1.1.3',)
|
||||
('etu recovered (samples):', 2855)
|
||||
(108117240, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 0, 0, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 0, 0, 1, 1]
|
||||
(109877662, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(113088360, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||
(113308472, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
(113339895, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 1, 0, 1, 1, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 1, 0, 1, 1, 1, 1, 1, 1]
|
||||
(113602225, '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]
|
||||
(113954522, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 0, 0, 0, 0, 0, 1, 0, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 0, 0, 0, 0, 0, 1, 0, 1, 1]
|
||||
(113983375, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 1, 1, 0, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 1, 1, 0, 0, 1, 1, 1, 1]
|
||||
(114163147, 'CHKSUM ERROR: ', 0, 'bits: ', [0, 1, 0, 1, 1, 0, 1, 1, 1, 1])
|
||||
iso7816-1: CHKSUM ERROR bits=[0, 1, 0, 1, 1, 0, 1, 1, 1, 1]
|
||||
CHKSUM ERROR count: 5044
|
||||
reader exchanges : 0
|
||||
capture ATRs : 0
|
||||
capture APDUs : 9
|
||||
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): 0
|
||||
- valid exchanges (reader retries/dupes): 7
|
||||
- GARBAGE (mis-framed/desync): 2
|
||||
GARBAGE: 00feedc2feedeefeedeafeec00feecffe797edeafeedeafeec00feecffe797edeafeecc0fefc80e7e7e7e7e7e7e767edfafeec00feecffe797edfafeecc2f9feece6edfafeec00feecffe797edfafeecc2f9feec41fbedfafeec08feecffe797edeafeecc2f9feec02feedfafeecc2f9feec83feedfefeecc2f9feecf2edf2feecc0feec3efeedfafeecc0feec4cfbedfefeecc2f9fefc4080808080808080808088808480808080feec41feedfefeecc0feecc0ecfeec02e7e6feedeefeedeafeecc0f9feece7edfafeedeafeedeafeec82f9feedfafeec08feec18e7e7fdedfefeec8af9feedfafeec0af9feedfafeec00feec18e7e7fdedfafeec02f9feedfafeec0af9
|
||||
GARBAGE: 000667f9e7e7e7e7e7e7e7e7e7e767ec100083e7e7e7e7e7e7e7e7e7e7e7e797ec1820e7e7e7e7e7e7e7e7e7e7e7e727ec1800eae7e7e7e7e7e7e7e7e7e7e7e7e7cfedf6feec08feedeafeec0af9feec03ffe727edf6feec00feec52feedeafeec0af9feecffe7e7e7fbedf6feec80feedeafeec02f9feecffe7e7e7fbedf6feec88e6edfefeec00feedfafeec80e4edfafeec88e4edfafeec00feedfafeec08feedfafeec80feedfefeec80feedfefeec08feedfefeec00feedfafeec80e4ece4ece4edfafeec02e7e6feece23dccffec9d95dcf2edf6feec80e4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4edfafeecc2f9feedc2feedfefeedf6feec80e4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4edf2feecc0feedc6feedfafeecc0feedc27dedfeedf6feec88e4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4ece4
|
||||
|
||||
Degradation metrics:
|
||||
- BAD_FCS (desynced by decoder): 5
|
||||
in GARBAGE: 2, in retries: 3, in CAT: 0, in matched: 0
|
||||
- payload mismatches (LCS-matched, bytes differ): 0
|
||||
- suspicious CLA: 0
|
||||
|
||||
RESULT: UNCLEAN - 2 mis-framed capture APDU(s)
|
||||
|
||||
=== 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 ---
|
||||
First activity: sample 11497325
|
||||
Frequency: 5.33 MHz
|
||||
Period: 3.0 samples
|
||||
Rising edges: 12833950
|
||||
Transitions: 0
|
||||
Transitions: 78488
|
||||
--- samsung_phone_sample ---
|
||||
First activity: sample 3096536
|
||||
Frequency: 4.00 MHz
|
||||
Period: 4.0 samples
|
||||
Rising edges: 14002767
|
||||
Transitions: 38
|
||||
Transitions: 171694
|
||||
Transitions: 117098
|
||||
--- sunrise_phone_sample ---
|
||||
@@ -143,7 +143,8 @@ class TestValidateT0Apdu(unittest.TestCase):
|
||||
# messaging 0x0C, chaining 0x10, and the SM/structural 0x4x/0x5x.
|
||||
for cla in (0x01, 0x02, 0x03, 0x0C, 0x10, 0x14, 0x44, 0x50, 0x54):
|
||||
pkt = bytes([cla, 0xa4, 0x00, 0x04, 0x00, 0x90, 0x00])
|
||||
self._valid(pkt), 'CLA=0x%02x' % cla
|
||||
with self.subTest(cla=cla):
|
||||
self._valid(pkt)
|
||||
|
||||
def test_valid_cla_channel1_select_after_manage_channel(self):
|
||||
# The command that follows MANAGE CHANNEL (00 70 00 00 01) opening
|
||||
|
||||
+36
-12
@@ -3,15 +3,18 @@
|
||||
|
||||
Reads a sigrok .sr file and reports per-signal measurements:
|
||||
CLK — frequency, duration, frequency changes
|
||||
RST — transitions, stability (noisy = ignore)
|
||||
VCC — transitions, stability (noisy = ignore)
|
||||
RST — transitions, stability (noisy = drop RST tracking via --no-rst)
|
||||
VCC — transitions, stability (noisy = drop VCC tracking via --no-vcc)
|
||||
DATA — oscillations, correlation with CLK
|
||||
|
||||
Usage:
|
||||
python3 tools/signal_diagnostic.py trace.sr [--clk CLK] [--data DATA] [--rst RST] [--vcc VCC]
|
||||
python3 tools/signal_diagnostic.py trace.sr [--clk CLK] [--data DATA] [--rst RST] [--vcc VCC] [--max-samples N]
|
||||
|
||||
Channel names must match the probe names in the .sr metadata
|
||||
(e.g. CLK, DATA, RST, VCC or D0, D1, etc.).
|
||||
|
||||
The whole capture is held in memory at once (a 16 MHz capture is ~16 MB per
|
||||
second), so use --max-samples to bound RAM on large traces.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@@ -54,13 +57,26 @@ def parse_sr_metadata(path):
|
||||
return info
|
||||
|
||||
|
||||
def read_sr_all(path):
|
||||
"""Read all logic samples into a numpy uint8 array."""
|
||||
def read_sr_all(path, max_samples=None):
|
||||
"""Read logic samples into a numpy uint8 array.
|
||||
|
||||
The whole capture is held in memory at once, so a multi-hundred-MB .sr
|
||||
file costs roughly as many bytes of RAM (plus transient diff buffers).
|
||||
Pass max_samples to bound it; samples beyond the cap are discarded and
|
||||
the returned tuple's second element is True."""
|
||||
with zipfile.ZipFile(path, 'r') as zf:
|
||||
chunk_names = [n for n in zf.namelist() if n.startswith('logic-1-')]
|
||||
chunk_names.sort(key=lambda n: int(n.split('-')[-1]))
|
||||
chunks = [zf.read(c) for c in chunk_names]
|
||||
return np.frombuffer(b''.join(chunks), dtype=np.uint8)
|
||||
buf = bytearray()
|
||||
truncated = False
|
||||
for c in chunk_names:
|
||||
buf.extend(zf.read(c))
|
||||
if max_samples is not None and len(buf) >= max_samples:
|
||||
truncated = True
|
||||
break
|
||||
if max_samples is not None and len(buf) > max_samples:
|
||||
del buf[max_samples:]
|
||||
return np.frombuffer(bytes(buf), dtype=np.uint8), truncated
|
||||
|
||||
|
||||
def get_channel_bit(metadata, channel_name):
|
||||
@@ -159,7 +175,8 @@ def measure_data_fast(data_arr, clk_arr, sr):
|
||||
# Main
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def run_analysis(path, clk_name, data_name, rst_name, vcc_name):
|
||||
def run_analysis(path, clk_name, data_name, rst_name, vcc_name,
|
||||
max_samples=None):
|
||||
"""Run full signal analysis on a .sr file. Returns results dict."""
|
||||
meta = parse_sr_metadata(path)
|
||||
sr = meta['samplerate']
|
||||
@@ -169,7 +186,7 @@ def run_analysis(path, clk_name, data_name, rst_name, vcc_name):
|
||||
rst_bit = get_channel_bit(meta, rst_name)
|
||||
vcc_bit = get_channel_bit(meta, vcc_name)
|
||||
|
||||
raw = read_sr_all(path)
|
||||
raw, truncated = read_sr_all(path, max_samples)
|
||||
total_samples = len(raw)
|
||||
duration_s = total_samples / sr
|
||||
|
||||
@@ -185,6 +202,7 @@ def run_analysis(path, clk_name, data_name, rst_name, vcc_name):
|
||||
'samplerate_mhz': sr / 1e6,
|
||||
'total_samples': total_samples,
|
||||
'duration_ms': duration_s * 1000,
|
||||
'truncated': truncated,
|
||||
'channels_found': {
|
||||
'CLK': clk_name if clk_bit is not None else None,
|
||||
'DATA': data_name if data_bit is not None else None,
|
||||
@@ -240,6 +258,9 @@ def print_results(results):
|
||||
print(f" Sample rate: {results['samplerate_mhz']:.1f} MHz")
|
||||
print(f" Samples: {results['total_samples']}")
|
||||
print(f" Duration: {results['duration_ms']:.1f} ms")
|
||||
if results.get('truncated'):
|
||||
print(f" Note: capture truncated at {results['total_samples']} "
|
||||
f"samples (--max-samples)")
|
||||
found = results['channels_found']
|
||||
print(f" Channels: CLK={found['CLK']} DATA={found['DATA']} RST={found['RST']} VCC={found['VCC']}")
|
||||
if results.get('first_activity_sample', 0) > 0:
|
||||
@@ -266,7 +287,7 @@ def print_results(results):
|
||||
print(f" Transitions: {rst['transitions']}")
|
||||
print(f" Stable: {rst['stable_pct']:.1f}%")
|
||||
if rst['noisy']:
|
||||
print(f" WARNING: noisy (>{1}% transitions) — consider --rst=ignore")
|
||||
print(f" WARNING: noisy (>{1}% transitions) — consider start.sh --no-rst")
|
||||
else:
|
||||
print(f" Not present: {rst.get('reason', 'n/a')}")
|
||||
|
||||
@@ -277,7 +298,7 @@ def print_results(results):
|
||||
print(f" Transitions: {vcc['transitions']}")
|
||||
print(f" Stable: {vcc['stable_pct']:.1f}%")
|
||||
if vcc['noisy']:
|
||||
print(f" WARNING: noisy (>{1}% transitions) — consider --vcc=ignore")
|
||||
print(f" WARNING: noisy (>{1}% transitions) — consider start.sh --no-vcc")
|
||||
else:
|
||||
print(f" Not present: {vcc.get('reason', 'n/a')}")
|
||||
|
||||
@@ -300,9 +321,12 @@ def main():
|
||||
parser.add_argument('--data', default='DATA', help='DATA channel name (default: DATA)')
|
||||
parser.add_argument('--rst', default='RST', help='RST channel name (default: RST)')
|
||||
parser.add_argument('--vcc', default='VCC', help='VCC channel name (default: VCC)')
|
||||
parser.add_argument('--max-samples', type=int, default=None,
|
||||
help='cap samples read (bounds RAM on large captures)')
|
||||
args = parser.parse_args()
|
||||
|
||||
results = run_analysis(args.sr_file, args.clk, args.data, args.rst, args.vcc)
|
||||
results = run_analysis(args.sr_file, args.clk, args.data, args.rst, args.vcc,
|
||||
args.max_samples)
|
||||
print(f"Signal diagnostic: {args.sr_file}")
|
||||
print_results(results)
|
||||
|
||||
|
||||
Reference in new issue
Block a user