laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved dexter: Looks good to me, but someone else must approve
cards: Avoid exception seen with (some) GSM-R SIM cards

Some old cards are classic SIM and not based on UICCs. Such cards
do not offer the capability of selecting applications. Let's avoid
running into an exception by providing dummy methods that simply fail
for each AID selection.

Change-Id: Ib3457496380c0c5096052ad7799970ee620dee33
Closes: OS#6691
---
M pySim/cards.py
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/pySim/cards.py b/pySim/cards.py
index b7958f4..dedb2d6 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -73,6 +73,16 @@
# callers having to do hasattr('read_aids') ahead of every call.
return []

+ def adf_present(self, adf: str = "usim") -> bool:
+ # a non-UICC doesn't have any applications. Convenience helper to avoid
+ # callers having to do hasattr('adf_present') ahead of every call.
+ return False
+
+ def select_adf_by_aid(self, adf: str = "usim", scc: Optional[SimCardCommands] = None) -> Tuple[Optional[Hexstr], Optional[SwHexstr]]:
+ # a non-UICC doesn't have any applications. Convenience helper to avoid
+ # callers having to do hasattr('select_adf_by_aid') ahead of every call.
+ return (None, None)
+

class SimCardBase(CardBase):
"""Here we only add methods for commands specified in TS 51.011, without

To view, visit change 39292. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ib3457496380c0c5096052ad7799970ee620dee33
Gerrit-Change-Number: 39292
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>