path: root/pySim-read.py
diff options
authorPhilipp Maier <pmaier@sysmocom.de>2020-05-12 17:24:18 +0200
committerlaforge <laforge@osmocom.org>2020-05-12 18:11:38 +0000
commitff84c238390606d92eefc0f5342079178c5f8de6 (patch)
treeb2cb6b77a8e2a1dde3dee9e7f8239fb2bc8384e5 /pySim-read.py
parentb689754b4967eed6185352c36c3c17cac6702969 (diff)
pySim-prog, pySim-read, do not echo reader id
pySim-prog and pySim-read currently echo back the pcsc reader id (or baudrate/socket, depending on the interface used). This makes the output unecessarly undeterministic, which becomes a problem when verifying the putput in tests. Lets not echo those variable, user supplied parameters back. Also lets move the code that does the initalization to utils, so that it can be used from pySim-prog and from pySim-read (code dup). Change-Id: I243cc332f075d007b1c111292effcc610e874eb3 Related: OS#4503
Diffstat (limited to 'pySim-read.py')
1 files changed, 3 insertions, 17 deletions
diff --git a/pySim-read.py b/pySim-read.py
index 33e93a7..df21531 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -34,8 +34,8 @@ from pySim.ts_31_103 import EF_IST_map
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, dec_st
+from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn
+from pySim.utils import format_xplmn_w_act, dec_spn, dec_st, init_reader
def parse_options():
@@ -72,21 +72,7 @@ if __name__ == '__main__':
opts = parse_options()
# 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)
+ sl = init_reader(opts)
# Create command layer
scc = SimCardCommands(transport=sl)