From 8e9c844130f5746dd149ba1a91d8eae07d4ef8d0 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 24 Jul 2022 11:55:04 +0200 Subject: [PATCH] apdu/ts_102_221: Fix SELECT of 3f00 In order to be able to explicitly select the MF via 3f00, we need to pass the 'MF' to get_selectables(), so the record is included in the list of selectable files from the current working directory. Change-Id: I27085896142fe547a6e93e01e63e59bbc65c8b8a --- pySim/apdu/ts_102_221.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pySim/apdu/ts_102_221.py b/pySim/apdu/ts_102_221.py index 0ca67029..3597db85 100644 --- a/pySim/apdu/ts_102_221.py +++ b/pySim/apdu/ts_102_221.py @@ -63,9 +63,10 @@ class UiccSelect(ApduCommand, n='SELECT', ins=0xA4, cla=['0X', '4X', '6X']): lchan.selected_adf = sels['ADF.USIM'] lchan.selected_file = lchan.selected_adf #print("\tSELECT CUR_ADF %s" % lchan.selected_file) + # iterate to next element in path continue else: - sels = lchan.selected_file.get_selectables(['FIDS']) + sels = lchan.selected_file.get_selectables(['FIDS','MF']) if file_hex in sels: if self.successful: #print("\tSELECT %s" % sels[file_hex]) @@ -73,12 +74,13 @@ class UiccSelect(ApduCommand, n='SELECT', ins=0xA4, cla=['0X', '4X', '6X']): else: #print("\tSELECT %s FAILED" % sels[file_hex]) pass + # iterate to next element in path continue logger.warning('SELECT UNKNOWN FID %s (%s)' % (file_hex, '/'.join([b2h(x) for x in path]))) elif mode == 'df_ef_or_mf_by_file_id': if len(self.cmd_data) != 2: raise ValueError('Expecting a 2-byte FID') - sels = lchan.selected_file.get_selectables(['FIDS']) + sels = lchan.selected_file.get_selectables(['FIDS','MF']) file_hex = b2h(self.cmd_data) if file_hex in sels: if self.successful: