dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/38194?usp=email )
Change subject: pySim-shell: improve command "desc"
......................................................................
pySim-shell: improve command "desc"
The "desc" command displays a string with a file description, let's also
display some size information as part of the description as well.
Related: OS#5714
Change-Id: I98e139ba2bf35df5524245cdd96f5c52cf09b986
---
M pySim-shell.py
1 file changed, 15 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/94/38194/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 7db77f0..cabe2aa 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -56,7 +56,7 @@
from pySim.utils import sanitize_pin_adm, tabulate_str_list, boxed_heading_str,
dec_iccid, sw_match
from pySim.card_handler import CardHandler, CardHandlerAuto
-from pySim.filesystem import CardMF, CardEF, CardDF, CardADF
+from pySim.filesystem import CardMF, CardEF, CardDF, CardADF, LinFixedEF, TransparentEF
from pySim.ts_102_221 import pin_names
from pySim.ts_102_222 import Ts102222Commands
from pySim.gsm_r import DF_EIRENE
@@ -766,9 +766,21 @@
"""Display human readable file description for the currently
selected file"""
desc = self._cmd.lchan.selected_file.desc
if desc:
- self._cmd.poutput(desc)
+ self._cmd.poutput("%s: %s" % (self._cmd.lchan.selected_file,
desc))
else:
- self._cmd.poutput("no description available")
+ self._cmd.poutput("%s: no description available" %
self._cmd.lchan.selected_file)
+ self._cmd.poutput(" file structure: %s" %
self._cmd.lchan.selected_file_structure())
+ if isinstance(self._cmd.lchan.selected_file, LinFixedEF):
+ self._cmd.poutput(" record length:")
+ self._cmd.poutput(" minimum_length: %s" %
str(self._cmd.lchan.selected_file.rec_len[0]))
+ self._cmd.poutput(" recommended_length: %s" %
str(self._cmd.lchan.selected_file.rec_len[1]))
+ self._cmd.poutput(" actual_length: %s" %
str(self._cmd.lchan.selected_file_record_len()))
+ self._cmd.poutput(" number of records: %s" %
str(self._cmd.lchan.selected_file_num_of_rec()))
+ elif isinstance(self._cmd.lchan.selected_file, TransparentEF):
+ self._cmd.poutput(" file size:")
+ self._cmd.poutput(" minimum_size: %s" %
str(self._cmd.lchan.selected_file.size[0]))
+ self._cmd.poutput(" recommended_size: %s" %
str(self._cmd.lchan.selected_file.size[1]))
+ self._cmd.poutput(" actual_size: %s" %
str(self._cmd.lchan.selected_file_size()))
verify_adm_parser = argparse.ArgumentParser()
verify_adm_parser.add_argument('--pin-is-hex', action='store_true',
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/38194?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I98e139ba2bf35df5524245cdd96f5c52cf09b986
Gerrit-Change-Number: 38194
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>