Decode sigrok-iso7816-stream RST/VCC line events (GSMTAP 0x10/0x11)
Support the sigrok-iso7816-stream decoder (FX2 logic-analyzer passive SIM sniffer, github.com/anttro/sigrok_iso7816_stream) which streams GSMTAP-SIM on UDP 4729 and adds two custom sub-types for line events. - gsmtap.py: GSMTAP_SIM_RST_EVENT (0x10) / GSMTAP_SIM_VCC_EVENT (0x11). - capture.py: gsmtap_msg_type() maps 0x10→'rst', 0x11→'vcc' (shared by the listener and tests); pcap.py _SUB_TYPE_NAMES gains the same entries so PCAP re-imports of these captures preserve the events. - decode.py: decode_line_event() decodes [direction, level, reserved] into reset asserted/de-asserted or power applied/removed + level; routed through decode_sniff_msg. - database.py: reset-assert and power-removal invalidate the per-channel file selection (card-level transition); de-assert / power-on are markers only. - frontend: RST/VCC labels (RESET ASSERTED / VCC OFF, …), a detail-view branch (Event + Level + raw), and list styling (.apdu-type.rst/.vcc). README notes the custom sub-type compatibility. Tests: +8 (line-event vectors, sniff routing, subtype + PCAP round-trip mappings) — 359 total. Version 1.21.0, SW cache simtrace-analyser-v31.
This commit is contained in:
1 parent
3e21d093d9
commit
7eaf7e9b53
13 files changed
+165
-11
No files matched your search
@@ -9,7 +9,9 @@ from simtrace2_pysniff.pcap import (
|
||||
build_pcap, parse_pcap, parse_pcapng, wrap_gsmtap, extract_gsmtap,
|
||||
LINKTYPE_ETHERNET,
|
||||
)
|
||||
from simtrace2_pysniff.gsmtap import build_gsmtap_packet, GSMTAP_SIM_ATR, GSMTAP_SIM_APDU
|
||||
from simtrace2_pysniff.gsmtap import (build_gsmtap_packet, GSMTAP_SIM_ATR,
|
||||
GSMTAP_SIM_APDU, GSMTAP_SIM_RST_EVENT,
|
||||
GSMTAP_SIM_VCC_EVENT)
|
||||
|
||||
|
||||
def _gsmtap_hdr(sub_type):
|
||||
@@ -54,6 +56,19 @@ class TestParsePcap(unittest.TestCase):
|
||||
(2.5, 'tpdu', b'\x80\xf2\x00\x00\x00'),
|
||||
])
|
||||
|
||||
def test_roundtrip_line_events(self):
|
||||
# sigrok-iso7816-stream custom sub-types survive a PCAP round-trip.
|
||||
packets = [
|
||||
(_gsmtap_hdr(GSMTAP_SIM_RST_EVENT), b'\x01\x00\x00', 1.0),
|
||||
(_gsmtap_hdr(GSMTAP_SIM_VCC_EVENT), b'\x00\x00\x00', 1.5),
|
||||
]
|
||||
data = build_pcap(packets)
|
||||
parsed = [(round(ts, 1), t, payload) for ts, t, payload in parse_pcap(data)]
|
||||
self.assertEqual(parsed, [
|
||||
(1.0, 'rst', b'\x01\x00\x00'),
|
||||
(1.5, 'vcc', b'\x00\x00\x00'),
|
||||
])
|
||||
|
||||
def test_no_gsmtap(self):
|
||||
# A packet that is not GSMTAP-SIM yields nothing.
|
||||
frame = wrap_gsmtap(b'\x03' + b'\x00' * 15) # type=3, not SIM
|
||||
@@ -197,7 +212,7 @@ class TestImportEndpoint(unittest.TestCase):
|
||||
class TestVersion(unittest.TestCase):
|
||||
def test_package_version(self):
|
||||
from simtrace2_pysniff import __version__
|
||||
self.assertEqual(__version__, '1.20.2')
|
||||
self.assertEqual(__version__, '1.21.0')
|
||||
|
||||
def test_status_includes_version(self):
|
||||
import os
|
||||
|
||||
Reference in new issue
Block a user