transport/pcsc: Allow opening PC/SC readers by a regex of their name

Opening PC/SC readers by index/number is very error-prone as the order
is never deterministic in any system with multiple (hot-plugged, USB)
readers.  Instead, let's offer the alternative of specifying a regular
expression to match the reader name (similar to remsim-bankd).

Change-Id: I983f19c6741904c1adf27749c9801b44a03a5d78
This commit is contained in:
Harald Welte
2023-11-03 11:42:18 +01:00
parent 0f177c1d29
commit ad002797e2
2 changed files with 31 additions and 13 deletions

View File

@@ -287,7 +287,7 @@ def init_reader(opts, **kwargs) -> LinkBase:
"""
Init card reader driver
"""
if opts.pcsc_dev is not None:
if opts.pcsc_dev is not None or opts.pcsc_regex is not None:
from pySim.transport.pcsc import PcscSimLink
sl = PcscSimLink(opts, **kwargs)
elif opts.osmocon_sock is not None: