dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/34853?usp=email )


Change subject: transport: move init message into concrete classes
......................................................................

transport: move init message into concrete classes

In in the module __init__.py we print an init message (which type of
LinkBase class is providing the SimLink). However in __init__.py we tend
to have only platform independed code but the message string can already
be categorized as platform depened. Let's put the init message into the
constructor of the concrete classes of LinkBase.

Related: OS#6210
Change-Id: I0a6dd7deb79a5f3e42b29094a1cf2535075fa430
---
M pySim/transport/__init__.py
M pySim/transport/calypso.py
M pySim/transport/modem_atcmd.py
M pySim/transport/pcsc.py
M pySim/transport/serial.py
5 files changed, 21 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/53/34853/1

diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py
index 581f8e5..5f48657 100644
--- a/pySim/transport/__init__.py
+++ b/pySim/transport/__init__.py
@@ -297,20 +297,16 @@
     Init card reader driver
     """
     if opts.pcsc_dev is not None:
-        print("Using PC/SC reader interface")
         from pySim.transport.pcsc import PcscSimLink
         sl = PcscSimLink(opts.pcsc_dev, **kwargs)
     elif opts.osmocon_sock is not None:
-        print("Using Calypso-based (OsmocomBB) reader interface")
         from pySim.transport.calypso import CalypsoSimLink
         sl = CalypsoSimLink(sock_path=opts.osmocon_sock, **kwargs)
     elif opts.modem_dev is not None:
-        print("Using modem for Generic SIM Access (3GPP TS 27.007)")
         from pySim.transport.modem_atcmd import ModemATCommandLink
         sl = ModemATCommandLink(
              device=opts.modem_dev, baudrate=opts.modem_baud, **kwargs)
     else:  # Serial reader is default
-        print("Using serial reader interface")
         from pySim.transport.serial import SerialSimLink
         sl = SerialSimLink(device=opts.device,
                            baudrate=opts.baudrate, **kwargs)
diff --git a/pySim/transport/calypso.py b/pySim/transport/calypso.py
index d7d9649..3fd9992 100644
--- a/pySim/transport/calypso.py
+++ b/pySim/transport/calypso.py
@@ -79,6 +79,8 @@

     def __init__(self, sock_path: str = "/tmp/osmocom_l2", **kwargs):
         super().__init__(**kwargs)
+        print("Using Calypso-based (OsmocomBB) reader interface")
+
         # Make sure that a given socket path exists
         if not os.path.exists(sock_path):
             raise ReaderError(
diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 5e5a3dd..1b741b0 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -35,6 +35,7 @@

     def __init__(self, device: str = '/dev/ttyUSB0', baudrate: int = 115200, 
**kwargs):
         super().__init__(**kwargs)
+        print("Using modem for Generic SIM Access (3GPP TS 27.007)")
         self._sl = serial.Serial(device, baudrate, timeout=5)
         self._echo = False             # this will be auto-detected by 
_check_echo()
         self._device = device
diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py
index c7b5878..3f3d06c 100644
--- a/pySim/transport/pcsc.py
+++ b/pySim/transport/pcsc.py
@@ -34,6 +34,7 @@

     def __init__(self, reader_number: int = 0, **kwargs):
         super().__init__(**kwargs)
+        print("Using PC/SC reader interface")
         r = readers()
         if reader_number >= len(r):
             raise ReaderError('No reader found for number %d' % reader_number)
diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py
index e5f7bdb..269ec9c 100644
--- a/pySim/transport/serial.py
+++ b/pySim/transport/serial.py
@@ -32,6 +32,7 @@
     def __init__(self, device: str = '/dev/ttyUSB0', baudrate: int = 9600, 
rst: str = '-rts',
                  debug: bool = False, **kwargs):
         super().__init__(**kwargs)
+        print("Using serial reader interface")
         if not os.path.exists(device):
             raise ValueError("device file %s does not exist -- abort" % device)
         self._sl = serial.Serial(

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34853?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0a6dd7deb79a5f3e42b29094a1cf2535075fa430
Gerrit-Change-Number: 34853
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to