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/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/26204 ) Change subject: pySim-shell: guess number of records when not specified ...................................................................... pySim-shell: guess number of records when not specified The select response of an UICC will always return the number of records of a file. However, older SIM will not include the number of records in the select response. In those cases, simply guess the number of records by reading until the first empty record is hit. This works because unused records are still initialized with 'fffff....', so an empty record will clearly mark the end of the file. Related: OS#5274 Change-Id: Ib480797d881b9ec607ec6a86b73d452449f8cf87 --- M pySim-shell.py 1 file changed, 17 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/04/26204/1 diff --git a/pySim-shell.py b/pySim-shell.py index 72ed213..db72d2d 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -516,10 +516,23 @@ result = self._cmd.rs.read_binary() self._cmd.poutput("update_binary " + str(result[0])) elif structure == 'cyclic' or structure == 'linear_fixed': - num_of_rec = fd['num_of_rec'] - for r in range(1, num_of_rec + 1): - result = self._cmd.rs.read_record(r) - self._cmd.poutput("update_record %d %s" % (r, str(result[0]))) + # Use number of records specified in select response + if 'num_of_rec' in fd: + num_of_rec = fd['num_of_rec'] + for r in range(1, num_of_rec + 1): + result = self._cmd.rs.read_record(r) + self._cmd.poutput("update_record %d %s" % (r, str(result[0]))) + # When the select response does not return the number of records, read until we hit the + # first empty record. + else: + r = 1 + while True: + result = self._cmd.rs.read_record(r) + if len(result[0]) > 0: + self._cmd.poutput("update_record %d %s" % (r, str(result[0]))) + r = r + 1 + else: + break elif structure == 'ber_tlv': tags = self._cmd.rs.retrieve_tags() for t in tags: -- To view, visit https://gerrit.osmocom.org/c/pysim/+/26204 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ib480797d881b9ec607ec6a86b73d452449f8cf87 Gerrit-Change-Number: 26204 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211110/d12a6151/attachment.htm>