[PATCH] pysim[master]: Fix select control parameter

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Mar 30 16:36:47 UTC 2017


Review at  https://gerrit.osmocom.org/2174

Fix select control parameter

sysmo-usim-sjs1 requires P2 to be set to 0x0C (request FCI) when
using the USIM application commands. The FCI is not used by pysim
anyway and might even cause problems with other cards.

This commit adds a pair of get/set methods to the SimCardCommands
class in order to set a default for the selection control
parameters (P1, P2). (Similar to the set/get methods for the class
byte)

The SysmoUSIMSJS1 class now calls the setter method for the
selection control parameters inside of its constructuor and sets
the selection control parameter default to "000C". This way we
can be sure that we only change the behaviour for sysmo-usim-sjs1
and do not break support for any other cards.

Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b
---
M pySim/cards.py
M pySim/commands.py
2 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/74/2174/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 23352a7..fafc55f 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -425,6 +425,7 @@
 	def __init__(self, ssc):
 		super(SysmoUSIMSJS1, self).__init__(ssc)
 		self._scc.cla_byte = "00"
+		self._scc.sel_ctrl = "000C"
 
 	@classmethod
 	def autodetect(kls, scc):
diff --git a/pySim/commands.py b/pySim/commands.py
index b7fb77f..d8bd8f2 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -29,6 +29,7 @@
 	def __init__(self, transport):
 		self._tp = transport;
 		self._cla_byte = "a0"
+		self._sel_ctrl = "0000"
 
 	@property
 	def cla_byte(self):
@@ -37,11 +38,17 @@
 	def cla_byte(self, value):
 		self._cla_byte = value
 
+	@property
+	def sel_ctrl(self):
+		return self._sel_ctrl
+	@sel_ctrl.setter
+	def sel_ctrl(self, value):
+		self._sel_ctrl = value
 
 	def select_file(self, dir_list):
 		rv = []
 		for i in dir_list:
-			data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4000002" + i)
+			data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4" + self._sel_ctrl + "02" + i)
 			rv.append(data)
 		return rv
 

-- 
To view, visit https://gerrit.osmocom.org/2174
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1993a267c952bf37d5de1cb4e1107f445614c17b
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list