Vadim Yanitskiy has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11481 )

Change subject: pySim-*.py: refactor card reader driver initialization
......................................................................

pySim-*.py: refactor card reader driver initialization

This would facilitate adding new card reader drivers.

Change-Id: Ia893537786c95a6aab3a51fb1ba7169023d5ef97
---
M pySim-prog.py
M pySim-read.py
2 files changed, 10 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve



diff --git a/pySim-prog.py b/pySim-prog.py
index ae5e482..ba1b783 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -562,13 +562,13 @@
        # Parse options
        opts = parse_options()

-       # Connect to the card
-       if opts.pcsc_dev is None:
-               from pySim.transport.serial import SerialSimLink
-               sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)
-       else:
+       # Init card reader driver
+       if opts.pcsc_dev is not None:
                from pySim.transport.pcsc import PcscSimLink
                sl = PcscSimLink(opts.pcsc_dev)
+       else: # Serial reader is default
+               from pySim.transport.serial import SerialSimLink
+               sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)

        # Create command layer
        scc = SimCardCommands(transport=sl)
diff --git a/pySim-read.py b/pySim-read.py
index e807e3e..066b0df 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -70,13 +70,13 @@
        # Parse options
        opts = parse_options()

-       # Connect to the card
-       if opts.pcsc_dev is None:
-               from pySim.transport.serial import SerialSimLink
-               sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)
-       else:
+       # Init card reader driver
+       if opts.pcsc_dev is not None:
                from pySim.transport.pcsc import PcscSimLink
                sl = PcscSimLink(opts.pcsc_dev)
+       else: # Serial reader is default
+               from pySim.transport.serial import SerialSimLink
+               sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate)

        # Create command layer
        scc = SimCardCommands(transport=sl)

--
To view, visit https://gerrit.osmocom.org/11481
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia893537786c95a6aab3a51fb1ba7169023d5ef97
Gerrit-Change-Number: 11481
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Assignee: tnt <t...@246tnt.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: tnt <t...@246tnt.com>

Reply via email to