Actions
Bug #4419
closedCardConnectionException: Failed to transmit with protocol T0. Transaction failed.
Start date:
02/27/2020
Due date:
% Done:
100%
Spec Reference:
Description
For some reason, pySim-prog.py fails to program a SIM card when using Python 3.
Using PC/SC reader (dev=0) interface Ready for Programming: Insert card now (or CTRL-C to cancel) Autodetected card type: sysmoUSIM-SJS1 Generated card parameters : > Name : Osmocom > SMSP : e1ffffffffffffffffffffffff068100095155f5ffffffffff000000 > ICCID : [REMOVED] > MCC/MNC : 901/70 > IMSI : 901700000025647 > Ki : [REMOVED] > OPC : [REMOVED] > ACC : None > ADM1(hex): [REMOVED] Programming ... Card programming failed with an execption: ---------------------8<--------------------- Traceback (most recent call last): File "./pySim-prog.py", line 751, in <module> rc = process_card(opts, first, card_handler) File "./pySim-prog.py", line 689, in process_card card.program(cp) File "/home/fixeria/osmocom/pysim/pySim/cards.py", line 602, in program data, sw = self._scc.update_binary('2fe2', enc_iccid(p['iccid'])) File "/home/fixeria/osmocom/pysim/pySim/commands.py", line 128, in update_binary self.select_file(ef) File "/home/fixeria/osmocom/pysim/pySim/commands.py", line 106, in select_file data, sw = self._tp.send_apdu_checksw(self.cla_byte + "a4" + self.sel_ctrl + "02" + i) File "/home/fixeria/osmocom/pysim/pySim/transport/__init__.py", line 93, in send_apdu_checksw rv = self.send_apdu(pdu) File "/home/fixeria/osmocom/pysim/pySim/transport/__init__.py", line 68, in send_apdu data, sw = self.send_apdu_raw(pdu) File "/home/fixeria/osmocom/pysim/pySim/transport/pcsc.py", line 76, in send_apdu_raw data, sw1, sw2 = self._con.transmit(apdu, CardConnection.T0_protocol) File "/usr/lib/python3.8/site-packages/smartcard/CardConnectionDecorator.py", line 82, in transmit return self.component.transmit(bytes, protocol) File "/usr/lib/python3.8/site-packages/smartcard/CardConnection.py", line 146, in transmit data, sw1, sw2 = self.doTransmit(bytes, protocol) File "/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 200, in doTransmit raise CardConnectionException( smartcard.Exceptions.CardConnectionException: Failed to transmit with protocol T0. Transaction failed. ---------------------8<---------------------
At the same time, reading a SIM card works just fine. Switching back to Python 2 makes pySim-prog.py work again.
I grabbed debug output of pcscd using the following command:
$ sudo LIBCCID_ifdLogLevel=0x0007 pcscd -fd | tee /tmp/pcscd.log
Please seee attached files and the difference between them.
Files
Actions