aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-read.py
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-10-27 06:30:33 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-10-29 01:58:18 +0700
commit588f3aca3ce5cfa6db05f4a1b312d96d77b009e8 (patch)
tree7d9da6f11f439b775bc9f212e673a5ae791c29a8 /pySim-read.py
parent1381ff15af1ecaee1d1e0671406cd92fc3b52d99 (diff)
pySim-*.py: refactor card reader driver initialization
This would facilitate adding new card reader drivers. Change-Id: Ia893537786c95a6aab3a51fb1ba7169023d5ef97
Diffstat (limited to 'pySim-read.py')
-rwxr-xr-xpySim-read.py10
1 files changed, 5 insertions, 5 deletions
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 @@ if __name__ == '__main__':
# 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)