laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/32994
)
Change subject: cards.py: support ATR-based detection of sysmoISIM-SJA5
......................................................................
cards.py: support ATR-based detection of sysmoISIM-SJA5
The cards are 99% software-compatible to the SJA2, so let's just
derive the SJA5 class from the SJA2
Change-Id: I706631baaf447c49904277886bc9a3f6ba3f5532
---
M pySim/cards.py
M pySim/sysmocom_sja2.py
2 files changed, 61 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/94/32994/1
diff --git a/pySim/cards.py b/pySim/cards.py
index b48a80c..f9d8257 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -1656,11 +1656,30 @@
return
+class SysmoISIMSJA5(SysmoISIMSJA2):
+ """
+ sysmocom sysmoISIM-SJA5
+ """
+
+ name = 'sysmoISIM-SJA5'
+
+ @classmethod
+ def autodetect(kls, scc):
+ try:
+ # Try card model #1 (9FJ)
+ atr = "3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 51
CC"
+ if scc.get_atr() == toBytes(atr):
+ return kls(scc)
+ except:
+ return None
+ return None
+
# In order for autodetection ...
_cards_classes = [FakeMagicSim, SuperSim, MagicSim, GrcardSim,
SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1,
- FairwavesSIM, OpenCellsSim, WavemobileSim, SysmoISIMSJA2]
+ FairwavesSIM, OpenCellsSim, WavemobileSim, SysmoISIMSJA2,
+ SysmoISIMSJA5]
def card_detect(ctype, scc):
diff --git a/pySim/sysmocom_sja2.py b/pySim/sysmocom_sja2.py
index 4967701..f297c4b 100644
--- a/pySim/sysmocom_sja2.py
+++ b/pySim/sysmocom_sja2.py
@@ -258,3 +258,32 @@
EF_USIM_SQN(name='EF.ISIM_SQN'),
]
isim_adf.add_files(files_adf_isim)
+
+class SysmocomSJA5(CardModel):
+ _atrs = ["3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 35 75 30 35 02 51
CC"]
+
+ @classmethod
+ def add_files(cls, rs: RuntimeState):
+ """Add sysmocom SJA2 specific files to given
RuntimeState."""
+ rs.mf.add_file(DF_SYSTEM())
+ # optional USIM application
+ if 'a0000000871002' in rs.mf.applications:
+ usim_adf = rs.mf.applications['a0000000871002']
+ files_adf_usim = [
+ EF_USIM_AUTH_KEY(),
+ EF_USIM_AUTH_KEY_2G(),
+ EF_GBA_SK(),
+ EF_GBA_REC_LIST(),
+ EF_GBA_INT_KEY(),
+ EF_USIM_SQN(),
+ ]
+ usim_adf.add_files(files_adf_usim)
+ # optional ISIM application
+ if 'a0000000871004' in rs.mf.applications:
+ isim_adf = rs.mf.applications['a0000000871004']
+ files_adf_isim = [
+ EF_USIM_AUTH_KEY(name='EF.ISIM_AUTH_KEY'),
+ EF_USIM_AUTH_KEY_2G(name='EF.ISIM_AUTH_KEY_2G'),
+ EF_USIM_SQN(name='EF.ISIM_SQN'),
+ ]
+ isim_adf.add_files(files_adf_isim)
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/32994
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I706631baaf447c49904277886bc9a3f6ba3f5532
Gerrit-Change-Number: 32994
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange