This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
herlesupreeth gerrit-no-reply at lists.osmocom.orgherlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/17520 ) Change subject: pySim-read.py: Added card detection function like in pySim-prog.py ...................................................................... pySim-read.py: Added card detection function like in pySim-prog.py This function is introduced to make use of Card class/Card subclasses in pySim-read.py. Also, an initial step towards refactoring of code. Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f --- M pySim-read.py 1 file changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/20/17520/1 diff --git a/pySim-read.py b/pySim-read.py index 55b43d7..1ee3c26 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -31,8 +31,27 @@ from pySim.ts_51_011 import EF, DF from pySim.commands import SimCardCommands +from pySim.cards import Card, _cards_classes from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn, format_xplmn_w_act, dec_spn +def card_detect(scc): + + # Detect type if needed + card = None + ctypes = dict([(kls.name, kls) for kls in _cards_classes]) + + for kls in _cards_classes: + card = kls.autodetect(scc) + if card: + print("Autodetected card type: %s" % card.name) + card.reset() + break + + if card is None: + print("Autodetection failed") + + return card + def parse_options(): @@ -94,6 +113,9 @@ # Program the card print("Reading ...") + # Initialize Card object + card = card_detect(scc) or Card(scc) + # EF.ICCID (res, sw) = scc.read_binary(EF['ICCID']) if sw == '9000': -- To view, visit https://gerrit.osmocom.org/c/pysim/+/17520 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f Gerrit-Change-Number: 17520 Gerrit-PatchSet: 1 Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200318/6318ccc1/attachment.htm>