mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-31 10:36:29 +03:00
filesystem: allow dumping multiple records of a file
At the moment we can only request pySim-shell to dump a specific record of a file. However, it may be useful to dump multiple records of a record oriented file at once. Change-Id: Id62db2cba4e3dfb6a7b3e6be8b892c16d11a8e3e Related: OS#4963
This commit is contained in:
@@ -378,11 +378,18 @@ class LinFixedEF(CardEF):
|
|||||||
|
|
||||||
read_rec_parser = argparse.ArgumentParser()
|
read_rec_parser = argparse.ArgumentParser()
|
||||||
read_rec_parser.add_argument('record_nr', type=int, help='Number of record to be read')
|
read_rec_parser.add_argument('record_nr', type=int, help='Number of record to be read')
|
||||||
|
read_rec_parser.add_argument('--count', type=int, default=1, help='Number of records to be read, beginning at record_nr')
|
||||||
@cmd2.with_argparser(read_rec_parser)
|
@cmd2.with_argparser(read_rec_parser)
|
||||||
def do_read_record(self, opts):
|
def do_read_record(self, opts):
|
||||||
"""Read a record from a record-oriented EF"""
|
"""Read one or multiple records from a record-oriented EF"""
|
||||||
(data, sw) = self._cmd.rs.read_record(opts.record_nr)
|
for r in range(opts.count):
|
||||||
self._cmd.poutput(data)
|
recnr = opts.record_nr + r
|
||||||
|
(data, sw) = self._cmd.rs.read_record(recnr)
|
||||||
|
if (len(data) > 0):
|
||||||
|
recstr = str(data)
|
||||||
|
else:
|
||||||
|
recstr = "(empty)"
|
||||||
|
self._cmd.poutput("%03d %s" % (recnr, recstr))
|
||||||
|
|
||||||
read_rec_dec_parser = argparse.ArgumentParser()
|
read_rec_dec_parser = argparse.ArgumentParser()
|
||||||
read_rec_dec_parser.add_argument('record_nr', type=int, help='Number of record to be read')
|
read_rec_dec_parser.add_argument('record_nr', type=int, help='Number of record to be read')
|
||||||
|
|||||||
Reference in New Issue
Block a user