mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-22 21:38:35 +03:00
pySim-shell: print device info in case an exception occurs
When an exception occurs while initializing or handling the card we print a traceback, but we do not print any info that allows us to identify the device that was involved when the exception occurred. Let's include the device path or number in the error message before we print the traceback. In order to make it easier to print the device information, let's add a __str__() method to all of our devices. This method shall return the device number or path. Related: OS#6210 Change-Id: I200463e692245da40ea6d5b609bfc0ca02d15bdb
This commit is contained in:
@@ -39,6 +39,7 @@ class PcscSimLink(LinkBase):
|
||||
raise ReaderError('No reader found for number %d' % reader_number)
|
||||
self._reader = r[reader_number]
|
||||
self._con = self._reader.createConnection()
|
||||
self._reader_number = reader_number
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
@@ -91,3 +92,6 @@ class PcscSimLink(LinkBase):
|
||||
|
||||
# Return value
|
||||
return i2h(data), i2h(sw)
|
||||
|
||||
def __str__(self):
|
||||
return "PCSC:%u[%s]" % (self._reader_number, self._reader)
|
||||
|
||||
Reference in New Issue
Block a user