dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/34693?usp=email )
Change subject: transport: print device path/number on initialization failure ......................................................................
transport: print device path/number on initialization failure
When the try block in init_reader raises an exception, we print a tranceback, but we do not mention which device was involved when the problem occurred. Let's make sure we print enough information that allows us to identify the device.
Related: OS#6210 Change-Id: I3f5387508ccc2aa349adc7aec3d04d8fc977690b --- M pySim/transport/__init__.py 1 file changed, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/93/34693/1
diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py index 9b28a8f..70878c7 100644 --- a/pySim/transport/__init__.py +++ b/pySim/transport/__init__.py @@ -321,7 +321,18 @@ baudrate=opts.baudrate, **kwargs) return sl except Exception as e: - print("Card reader initialization failed with an exception:") + if opts.pcsc_dev is not None: + devinfo = "PCSC:%u" % opts.pcsc_dev + elif opts.osmocon_sock is not None: + devinfo = "osmocon:%s" % opts.osmocon_sock + elif opts.modem_dev is not None: + devinfo = "modem:%s" % opts.modem_dev + elif opts.device is not None: + devinfo = "serial:%s" % opts.device + else: + devinfo = "none" + + print("Card reader initialization (%s) failed with an exception:" % devinfo) print("---------------------8<---------------------") traceback.print_exc() print("---------------------8<---------------------")