fix: select the ISD-R before the profile switch command

The switch refactor dropped the ISD-R selection that the old
_transceive/_run wrapper performed, so the STORE DATA went to whatever
application was selected (MF after a preceding ES10 call) and the card
answered 6D00 ('instruction not supported') without ever reaching the
switch flow.

- esim.switch_profile() now takes the app, selects the ISD-R before
  sending the raw STORE DATA and restores the selection in a finally,
  like the other ES10 functions.
- tests assert the selection and the restore for the 9000 and 91XX
  paths (the FakeLchan/rs already track both).
This commit is contained in:
2026-09-22 00:34:00 +03:00
parent f87f3e9841
commit f6d62c225c
3 changed files with 40 additions and 22 deletions
+1 -1
View File
@@ -3861,7 +3861,7 @@ class PysimHandler(BaseHTTPRequestHandler):
_finish_pending_menu(self.server, self.server.scc)
cursor = _PROACTIVE_ENTRY_ID
resp = esim.switch_profile(
self.server.scc._tp.send_apdu,
app, self.server.scc._tp.send_apdu,
lambda sw: _esim_refresh_chain(self.server, sw),
action, iccid=body.get('iccid'),
isdp_aid=body.get('isdp_aid'),