diff --git a/pyocd_pemicro/pemicro_probe.py b/pyocd_pemicro/pemicro_probe.py index bf91784..4e82b6e 100644 --- a/pyocd_pemicro/pemicro_probe.py +++ b/pyocd_pemicro/pemicro_probe.py @@ -44,7 +44,7 @@ LOG = logging.getLogger(__name__) TRACE = LOG.getChild("trace") -TRACE.setLevel(logging.INFO) +TRACE.disabled = True class PEMicroProbe(DebugProbe): """! @brief Wraps a PEMicro as a DebugProbe.""" @@ -58,6 +58,10 @@ class PEMicroProbe(DebugProbe): APSEL_SHIFT = 24 APSEL_APBANKSEL = APSEL | APBANKSEL + ## Part of the error message for exceptions raised when there isn't a PEMicro library + # matching the system's architecture, or other similar reasons. + NO_LIBRARY_ERR = "Unable to find any usable library" + @classmethod def _get_pemicro(cls): # PEMicroException is raised by PyPemicro if the PEMicro DLL cannot be found. @@ -80,6 +84,10 @@ def get_all_connected_probes(cls, unique_id=None, is_explicit=False): return [] return [cls(str(info["id"])) for info in port_list] except PEMicroException as exc: + # Ignore errors about a missing library, which can happen on systems not supported by + # the PEMicro library but on which the plugin is installed. + if cls.NO_LIBRARY_ERR in exc.message: + return [] six.raise_from(cls._convert_exception(exc), exc) @classmethod @@ -94,6 +102,10 @@ def get_probe_with_id(cls, unique_id, is_explicit=False): else: return None except PEMicroException as exc: + # Ignore errors about a missing library, which can happen on systems not supported by + # the PEMicro library but on which the plugin is installed. + if cls.NO_LIBRARY_ERR not in exc.message: + return None six.raise_from(cls._convert_exception(exc), exc) def __init__(self, serial_number):