From 498361f3b535933a65d30cedd0775d92a93a83e6 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 24 Jul 2022 11:39:07 +0200 Subject: [PATCH] apdu/ts_102_221: Implement SELECT case "df_ef_or_mf_by_file_id" This was [sadly] simply missing from the implementation so far. Change-Id: I7bbd13ce29f5adc1ca3ca01bffabbe02dd17db20 --- pySim/apdu/ts_102_221.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pySim/apdu/ts_102_221.py b/pySim/apdu/ts_102_221.py index e5455d03..0ca67029 100644 --- a/pySim/apdu/ts_102_221.py +++ b/pySim/apdu/ts_102_221.py @@ -78,6 +78,17 @@ class UiccSelect(ApduCommand, n='SELECT', ins=0xA4, cla=['0X', '4X', '6X']): 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']) + file_hex = b2h(self.cmd_data) + if file_hex in sels: + if self.successful: + #print("\tSELECT %s" % sels[file_hex]) + lchan.selected_file = sels[file_hex] + else: + #print("\tSELECT %s FAILED" % sels[file_hex]) + pass + else: + logger.warning('SELECT UNKNOWN FID %s' % (file_hex)) elif mode == 'df_name': # Select by AID (can be sub-string!) aid = self.cmd_dict['body']