laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/33569 )
Change subject: pySim-shell: Support USIM specific methods/commands on unknown UICC ......................................................................
pySim-shell: Support USIM specific methods/commands on unknown UICC
So far, if no known programmable card (like sysmoISIM) has been found, we were using the SimCard base class. However, once we detect an UICC, we should have switched to the UsimCard class, as otherwise the various methods called by USIM/ISIM specific commands don't exist and we get weird 'SimCard' object has no attribute 'update_ust' execptions.
The entire auto-detection and the legacy SimCard / UsimCard classes are showing the legacy of the code base and should probably be re-architected. However, let's fix the apparent bug for now.
Change-Id: I5a863198084250458693f060ca10b268a58550a1 Closes: OS#6055 --- M pySim-shell.py 1 file changed, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/33569/1
diff --git a/pySim-shell.py b/pySim-shell.py index e5cc0c3..3161844 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -49,7 +49,7 @@ from pySim.exceptions import * from pySim.commands import SimCardCommands from pySim.transport import init_reader, ApduTracer, argparse_add_reader_args, ProactiveHandler -from pySim.cards import card_detect, SimCard +from pySim.cards import card_detect, SimCard, UsimCard from pySim.utils import h2b, b2h, i2h, swap_nibbles, rpad, JsonEncoder, bertlv_parse_one, sw_match from pySim.utils import sanitize_pin_adm, tabulate_str_list, boxed_heading_str, Hexstr from pySim.card_handler import CardHandler, CardHandlerAuto @@ -127,6 +127,12 @@ profile.add_application(CardApplicationHPSIM()) profile.add_application(CardApplicationARAM()) profile.add_application(CardApplicationISD()) + # We have chosen SimCard() above, but we now know it actually is an UICC + # so it's safe to assume it supports USIM application (which we're adding above). + # IF we don't do this, we will have a SimCard but try USIM specific commands like + # the update_ust method (see https://osmocom.org/issues/6055) + if generic_card: + card = UsimCard(scc)
# Create runtime state with card profile rs = RuntimeState(card, profile)