equip/init: read the selected EF directly, bound the startup drain
pySim's scc.read_binary/read_record call select_path(ef) first, so the ICCID, network-state, EF.ARR and EF.PBR readers - which had already made a parent-scoped selection and hold its FCP - sent a second SELECT per file and per record. _read_selected_ef() issues READ BINARY (chunked at max_cmd_len from the FCP file size) / READ RECORD (b2<rec>04<len> at the FCP record length) directly; the pySim helpers stay as the fallback when the FCP lacks the value. The startup TERMINAL PROFILE drain now breaks on the chain's idle SW instead of polling STATUS once more. Measured on the last startup: ~3.4 s traced init (netstate/ARR/PBR 271 APDUs / 1.26 s incl. 169 SELECTs; the card's own TP processing 1.58 s); the change removes ~0.7-0.8 s of the read phase without touching any data or the TP. v3.38.1; tests: tests/test_read_selected.py (direct reads, chunking, the fallback and the drain source pin) and the ARR/PBR/ICCID/netstate fakes. 1067 Python + 1075 frontend. sw cache simple-v482.
This commit is contained in:
1 parent
80cbd8e935
commit
0231df905c
11 files changed
+252
-20
No files matched your search
@@ -32,6 +32,21 @@ class FakeFile:
|
||||
self.applications = {}
|
||||
|
||||
|
||||
class FakeScc:
|
||||
cla_byte = '00'
|
||||
max_cmd_len = 255
|
||||
|
||||
def __init__(self, lchan):
|
||||
self.lchan = lchan
|
||||
self.sent = []
|
||||
|
||||
def send_apdu_checksw(self, pdu):
|
||||
self.sent.append(pdu)
|
||||
if self.lchan.error:
|
||||
raise self.lchan.error
|
||||
return self.lchan.data, '9000'
|
||||
|
||||
|
||||
class FakeLchan:
|
||||
def __init__(self, mf, data=None, error=None):
|
||||
self.selected_file = mf
|
||||
@@ -39,6 +54,10 @@ class FakeLchan:
|
||||
self.error = error
|
||||
self.selects = []
|
||||
self.probes = []
|
||||
self.scc = FakeScc(self)
|
||||
|
||||
def selected_file_size(self):
|
||||
return len(self.data or '') // 2
|
||||
|
||||
def select_file(self, f, app=None):
|
||||
self.selected_file = f
|
||||
@@ -94,6 +113,8 @@ class ReadIccidTest(unittest.TestCase):
|
||||
self.assertIs(lchan.selected_file, iccid)
|
||||
self.assertEqual([f.name for f in lchan.selects], ['MF', 'EF.ICCID'])
|
||||
self.assertEqual(lchan.probes, [])
|
||||
# one READ BINARY, no second SELECT (v3.38.1)
|
||||
self.assertEqual(lchan.scc.sent, ['00b000000a'])
|
||||
|
||||
def test_missing_model_entry_is_probed_and_detached(self):
|
||||
app, lchan, mf, _ = make_app(with_iccid=False)
|
||||
|
||||
Reference in new issue
Block a user