pySim-*.py: print info about selected reader interface

Change-Id: Idd791d7ef635e15915aab13274aefc15e70777b0
This commit is contained in:
Vadim Yanitskiy 2018-10-29 02:02:14 +07:00
parent 5491c48e71
commit 35a96edb0d
5 changed files with 15 additions and 0 deletions

View File

@ -568,12 +568,18 @@ if __name__ == '__main__':
# Init card reader driver
if opts.pcsc_dev is not None:
print("Using PC/SC reader (dev=%d) interface"
% opts.pcsc_dev)
from pySim.transport.pcsc import PcscSimLink
sl = PcscSimLink(opts.pcsc_dev)
elif opts.osmocon_sock is not None:
print("Using Calypso-based (OsmocomBB, sock=%s) reader interface"
% opts.osmocon_sock)
from pySim.transport.calypso import CalypsoSimLink
sl = CalypsoSimLink(sock_path=opts.osmocon_sock)
else: # Serial reader is default
print("Using serial reader (port=%s, baudrate=%d) interface"
% (opts.device, opts.baudrate))
from pySim.transport.serial import SerialSimLink
sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)

View File

@ -76,12 +76,18 @@ if __name__ == '__main__':
# Init card reader driver
if opts.pcsc_dev is not None:
print("Using PC/SC reader (dev=%d) interface"
% opts.pcsc_dev)
from pySim.transport.pcsc import PcscSimLink
sl = PcscSimLink(opts.pcsc_dev)
elif opts.osmocon_sock is not None:
print("Using Calypso-based (OsmocomBB, sock=%s) reader interface"
% opts.osmocon_sock)
from pySim.transport.calypso import CalypsoSimLink
sl = CalypsoSimLink(sock_path=opts.osmocon_sock)
else: # Serial reader is default
print("Using serial reader (port=%s, baudrate=%d) interface"
% (opts.device, opts.baudrate))
from pySim.transport.serial import SerialSimLink
sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)

View File

@ -1,3 +1,4 @@
Using PC/SC reader (dev=1) interface
Reading ...
ICCID: 1122334455667788990
IMSI: 001010000000102

View File

@ -1,3 +1,4 @@
Using PC/SC reader (dev=0) interface
Reading ...
ICCID: 1122334455667788990
IMSI: 001010000000102

View File

@ -1,3 +1,4 @@
Using PC/SC reader (dev=2) interface
Reading ...
ICCID: 1122334455667788990
IMSI: 001010000000102