mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-16 18:38:32 +03:00
transport/pcsc: explicitly specify T0 protocol
From pyscard user's guide [1]: == Selecting the card communication protocol == By defaults, the connect() method of the CardConnection object will try to connect using either the T=0 or T=1 protocol. To force a connection protocol, you can pass the required protocol to the connect() method. This means that a PC/SC ifd handler may automatically choose T=1 as the highest protocol if the card indicates both in its ATR [2]. Since pySim only supports T=0, let's select it explicitly. [1] https://pyscard.sourceforge.io/user-guide.html [2] https://github.com/acshk/acsccid/issues/16#issuecomment-501101972 Change-Id: Ifed4574aab98a86c3ebbeb191f36a8282103e775
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from smartcard.CardConnection import CardConnection
|
||||
from smartcard.CardRequest import CardRequest
|
||||
from smartcard.Exceptions import NoCardException, CardRequestTimeoutException
|
||||
from smartcard.System import readers
|
||||
@@ -52,7 +53,10 @@ class PcscSimLink(LinkBase):
|
||||
|
||||
def connect(self):
|
||||
try:
|
||||
self._con.connect()
|
||||
# Explicitly select T=0 communication protocol
|
||||
self._con.connect(CardConnection.T0_protocol)
|
||||
except CardConnectionException:
|
||||
raise ProtocolError()
|
||||
except NoCardException:
|
||||
raise NoCardError()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user