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
@@ -2307,5 +2307,44 @@ class TestClaDecode(unittest.TestCase):
|
||||
self.assertEqual(r['interclass'], 'ETSI-defined (SIM/GSM)')
|
||||
|
||||
|
||||
class TestLineEvents(unittest.TestCase):
|
||||
"""sigrok-iso7816-stream RST/VCC line events (GSMTAP 0x10/0x11)."""
|
||||
|
||||
def _dec(self, kind, payload):
|
||||
from simtrace2_pysniff.server.decode import decode_line_event
|
||||
return decode_line_event(bytes.fromhex(payload), kind)
|
||||
|
||||
def test_rst_asserted(self):
|
||||
r = self._dec('rst', '010000')
|
||||
self.assertEqual(r['type'], 'rst')
|
||||
self.assertEqual(r['event'], 'reset asserted')
|
||||
self.assertEqual(r['level'], 'low')
|
||||
|
||||
def test_rst_deasserted(self):
|
||||
r = self._dec('rst', '000100')
|
||||
self.assertEqual(r['event'], 'reset de-asserted')
|
||||
self.assertEqual(r['level'], 'high')
|
||||
|
||||
def test_vcc_on(self):
|
||||
r = self._dec('vcc', '010100')
|
||||
self.assertEqual(r['event'], 'power applied')
|
||||
self.assertEqual(r['level'], 'high')
|
||||
|
||||
def test_vcc_off(self):
|
||||
r = self._dec('vcc', '000000')
|
||||
self.assertEqual(r['event'], 'power removed')
|
||||
self.assertEqual(r['level'], 'low')
|
||||
|
||||
def test_sniff_routing(self):
|
||||
from simtrace2_pysniff.server.decode import decode_sniff_msg
|
||||
self.assertEqual(decode_sniff_msg(b'\x01\x00\x00', 'rst')['type'], 'rst')
|
||||
self.assertEqual(decode_sniff_msg(b'\x00\x01\x00', 'vcc')['type'], 'vcc')
|
||||
|
||||
def test_short_payload(self):
|
||||
r = self._dec('rst', '01')
|
||||
self.assertEqual(r['type'], 'rst')
|
||||
self.assertNotIn('event', r)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user