mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-23 13:58:33 +03:00
pySim-read.py: Added a common card detection function for both pySim-prog.py and pySim-read.py
This function is used to detect the card type and return Card class/Card subclasses object if its a know card or else None. Also, an initial step towards refactoring of code. Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f
This commit is contained in:
@@ -31,6 +31,7 @@ import sys
|
||||
from pySim.ts_51_011 import EF, DF
|
||||
|
||||
from pySim.commands import SimCardCommands
|
||||
from pySim.cards import card_detect, Card
|
||||
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn, format_xplmn_w_act, dec_spn
|
||||
|
||||
|
||||
@@ -94,6 +95,9 @@ if __name__ == '__main__':
|
||||
# Program the card
|
||||
print("Reading ...")
|
||||
|
||||
# Initialize Card object by auto detecting the card
|
||||
card = card_detect("auto", scc) or Card(scc)
|
||||
|
||||
# EF.ICCID
|
||||
(res, sw) = scc.read_binary(EF['ICCID'])
|
||||
if sw == '9000':
|
||||
|
||||
Reference in New Issue
Block a user