Change in pysim[master]: pySim-*.py: refactor card reader driver initialization

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Fri Oct 26 23:47:28 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/81/11481/1

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: newchange
Gerrit-Change-Id: Ia893537786c95a6aab3a51fb1ba7169023d5ef97
Gerrit-Change-Number: 11481
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181026/8e940e4f/attachment.htm>


More information about the gerrit-log mailing list