aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-02-13 15:10:15 +0100
committerHarald Welte <laforge@osmocom.org>2022-02-15 15:35:36 +0100
commitee670bc1c6dcbd56da0b203dea19e690450b21ed (patch)
tree38940048e85c28e4459aabe21dd91ca28406d33a
parent226b866f51b37a20fd8adc49ce7b49ea82492417 (diff)
pySim-shell: Allow selecting of deep paths like DF.GSM/EF.IMSI
With this patch applied, users can directly enter commands like select DF.GSM/EF.IMSI or select ADF.USIM/DF.5GS/EF.5GAUTHKEYS This feature doesn't have tabl completion, so it's mostly useful for when you know what to select, or for use within scripts. Change-Id: I681a132eb2df4b2aba4c2ccbdd21c6d5b88443e3
-rw-r--r--pySim/filesystem.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index d1c3e1f..bef9005 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -1411,6 +1411,22 @@ class RuntimeState(object):
name : Name of file to select
cmd_app : Command Application State (for unregistering old file commands)
"""
+ # handling of entire paths with multiple directories/elements
+ if '/' in name:
+ prev_sel_file = self.selected_file
+ pathlist = name.split('/')
+ # treat /DF.GSM/foo like MF/DF.GSM/foo
+ if pathlist[0] == '':
+ pathlist[0] = 'MF'
+ try:
+ for p in pathlist:
+ self.select(p, cmd_app)
+ return
+ except Exception as e:
+ # if any intermediate step fails, go back to where we were
+ self.select_file(prev_sel_file, cmd_app)
+ raise e
+
sels = self.selected_file.get_selectables()
if is_hex(name):
name = name.lower()