03.12.2020 dátummal, 0:16 időpontban Chunlin Yang <chliny2016@gmail.com> írta:
Thanks Domonkos.It does not give me helpful info.only code relevant to my issue is as below:<image.png>but my issue is as below:Programming ...
Card programming failed with an execption:
---------------------8<---------------------
Traceback (most recent call last):
File "./pySim-prog.py", line 719, in <module>
rc = process_card(opts, first, card_handler)
File "./pySim-prog.py", line 671, in process_card
card.program(cp)
File "/home/support/pysim/pySim/cards.py", line 713, in program
self._scc.verify_chv(0x0A, h2b(p['pin_adm']))
File "/home/support/pysim/pySim/commands.py", line 206, in verify_chv
return self._tp.send_apdu_checksw(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc)
File "/home/support/pysim/pySim/transport/__init__.py", line 104, in send_apdu_checksw
raise RuntimeError("SW match failed! Expected %s and got %s." % (sw.lower(), rv[1]))
RuntimeError: SW match failed! Expected 9000 and got 63c8.
I'm flashing this SIM card for a 5G project at https://github.com/free5gc/free5gc
Does this SIM card SW supports 5G?
Thanks.
Br,
Chunlin
On Tue, Dec 1, 2020 at 2:30 AM Tomcsányi, Domonkos <domi@tomcsanyi.net> wrote:Hi Andrew,
Have a look at this list for example for APDU response codes to
understand better what is going on.
https://www.eftlab.com/knowledge-base/complete-list-of-apdu-responses/
Kind regards,
Domi
On Tue, Dec 1, 2020 at 10:24 AM Chunlin Yang <chliny2016@gmail.com> wrote:
>
> Hi Vadim and all,
>
> pyProg.py fails with an error, could you help (btw, I change all real info to xxx :)):
>
> support@S2600WFT:~/pysim$ python ./pySim-prog.py -p 0 -x 208 -y 93 -t sysmoUSIM-SJS1 -i 208930000000003 --op=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -k xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -s xxxxxxxxxxxxxxxxxxxxx -a xxxxxxxx
> Using PC/SC reader interface
> Ready for Programming: Insert card now (or CTRL-C to cancel)
> Generated card parameters :
> > Name : Magic
> > SMSP : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > ICCID : xxxxxxxxxxxxxxxxxxxx
> > MCC/MNC : 208/93
> > IMSI : xxxxxxxxxxxxxxx
> > Ki : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > OPC : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > ACC : None
> > ADM1(hex): xxxxxxxxxxxxxxxx
> Programming ...
>
> Card programming failed with an execption:
> ---------------------8<---------------------
> Traceback (most recent call last):
> File "./pySim-prog.py", line 719, in <module>
> rc = process_card(opts, first, card_handler)
> File "./pySim-prog.py", line 671, in process_card
> card.program(cp)
> File "/home/support/pysim/pySim/cards.py", line 713, in program
> self._scc.verify_chv(0x0A, h2b(p['pin_adm']))
> File "/home/support/pysim/pySim/commands.py", line 206, in verify_chv
> return self._tp.send_apdu_checksw(self.cla_byte + '2000' + ('%02X' % chv_no) + '08' + fc)
> File "/home/support/pysim/pySim/transport/__init__.py", line 104, in send_apdu_checksw
> raise RuntimeError("SW match failed! Expected %s and got %s." % (sw.lower(), rv[1]))
> RuntimeError: SW match failed! Expected 9000 and got 63c9.
> ---------------------8<---------------------
>
> Programming failed: Remove card from reader
>
> Thanks.
> Br,
> Andrew
>
> On Tue, Dec 1, 2020 at 1:07 AM Chunlin Yang <chliny2016@gmail.com> wrote:
>>
>> Thanks a lot Vadim!
>> I have thought it might be an issue between python3 and python2. So I have tried on both versions.
>> on Python3, I got same error.
>> But now with this command 'python ./pySim-read.py -p0', it works. I used to use this command './pySim-read.py -p0' and it gave me the same error.
>>
>> But although 'python ./pySim-read.py -p0' works (reads out the content of the SIM, it gives me an error/prompt at the end:
>> Traceback (most recent call last):
>> File "./pySim-read.py", line 255, in <module>
>> (res, sw) = card.read_ehplmn()
>> AttributeError: 'OpenCellsSim' object has no attribute 'read_ehplmn'
>>
>> maybe I can just ignore this prompt as I don't need ehplmn.
>>
>> Br,
>> Andrew
>>
>> On Tue, Dec 1, 2020 at 12:45 AM Vadim Yanitskiy <vyanitskiy@sysmocom.de> wrote:
>>>
>>> On 12/1/20 2:17 AM, Chunlin Yang wrote:
>>> > ModuleNotFoundError: No module named 'smartcard'
>>> >
>>> > BTW, I have manually imported smartcard in python, and it's successful.
>>>
>>> I guess you have two Python versions (2.7 and 3.x), so it could be that
>>> you've installed smartcard for 3.x and in works in the shell.
>>> Unfortunately, pySim has not been completely migrated to 3.x yet, so it
>>> starts under 2.7 by default. You can try to run it under 3.x:
>>>
>>> python3 ./pySim-read.py -p0
>>>
>>> or install the 'smartcard' module for Python 2.7.
>>>
>>> Best regards,
>>> Vadim.
>>>
>>> --
>>> - Vadim Yanitskiy <vyanitskiy at sysmocom.de> http://www.sysmocom.de/
>>> =======================================================================
>>> * sysmocom - systems for mobile communications GmbH
>>> * Alt-Moabit 93
>>> * 10559 Berlin, Germany
>>> * Sitz / Registered office: Berlin, HRB 134158 B
>>> * Geschaeftsfuehrer / Managing Director: Harald Welte