btw, you may want to move this discussion to the simtrace mailing list instead of openbsc, I think it fits there better.

Lukas


On Wed, May 8, 2013 at 1:46 PM, Lukas Kuzmiak <lukash@backstep.net> wrote:
Hey there,

it seems to me the pySim was trying to update 6f30 file (not sure why):
  self._scc.update_binary('6f30', hplmn + 'ff' * (tl-3))

and got back 0x9804 instead of 0x9000, which means you don't have sufficient permissions to update that file - either pin verification went wrong or you need some other key to update that file, not sure what permissions are set of 6f30 file there.

Hopes this will help you debugging it.

Cheers!
Lukas


On Wed, May 8, 2013 at 1:38 PM, Martin Nagy <nugett@centrum.sk> wrote:
Hi all,
After buying a super Sim Kit (16 in 1) from China, I tried the reader (green PCB inside a blue transparent plastic case with a blue LED) and SIM (identified as a fakesupersim) with pysim tool. However i am getting the following error:

/pySim-prog.py -n 26C3 -c 49 -x 262 -y 42 -z 1234 -j 1 -t auto
Insert card now (or CTRL-C to cancel)
Autodetected card type fakemagicsim
Generated card parameters :
 > Name    : 26C3
 > SMSP    : e1ffffffffffffffffffffffff058100945555ffffffffffff000000
 > ICCID   : 8949262427518313026
 > MCC/MNC : 262/42
 > IMSI    : 262422461512085
 > Ki      : 7b74741a1ee14337ec23f9ab92a13648
 > OPC     : ccd867d60797d8d45354a51b3ef568ff

Programming ...
Traceback (most recent call last):
  File "./pySim-prog.py", line 530, in <module>
    card.program(cp)
  File "/home/nadicek/pysim/pysim/pySim/cards.py", line 231, in program
    self._scc.update_binary('6f30', hplmn + 'ff' * (tl-3))
  File "/home/nadicek/pysim/pysim/pySim/commands.py", line 53, in update_binary
    return self._tp.send_apdu_checksw(pdu)
  File "/home/nadicek/pysim/pysim/pySim/transport/__init__.py", line 87, 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 9804.

I checked mailing lists and haven’t found anybody who had similar problem with pysim. Also I have tried forcing different models of SIM, but nothing is working. Obviously I can remove this check from the script file (__init__.py in /pySim/transport), however somebody had a reason to put such condition there. I would like to ask if it is safe to remove that line of code and the purpose of that line of code.

Thanks a lot and best regards
Martin