shell: Fix activate_file + deactivate_file commands

We cannot re-activate a deactivated file after we have selected somethng
else, as SELECT will fail on the deactivated file.  Hence, the
deactivate_file command needs to be used with a file name as argument.

Change-Id: Ief4d2bf8ea90497a8f25d1986aeea935c615f9bb
This commit is contained in:
Harald Welte
2021-05-25 22:21:44 +02:00
parent 34b05d3707
commit 485692bc77
3 changed files with 18 additions and 7 deletions

View File

@@ -1150,6 +1150,13 @@ class RuntimeState(object):
(data, sw) = self.card._scc.status()
return self.selected_file.decode_select_response(data)
def activate_file(self, name:str):
"""Request ACTIVATE FILE of specified file."""
sels = self.selected_file.get_selectables()
f = sels[name]
data, sw = self.card._scc.activate_file(f.fid)
return data, sw
def read_binary(self, length:int=None, offset:int=0):
"""Read [part of] a transparent EF binary data.