Skip to content

Commit

Permalink
Use of common show_no_libusb_warning()
Browse files Browse the repository at this point in the history
- modified show_no_libusb_warning() message to include PicoProbe
- Use it instead of LOG.debug()
  • Loading branch information
newbrain committed Mar 31, 2021
1 parent d828a5d commit 1b062eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pyocd/probe/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ def show_no_libusb_warning():
"""! @brief Logs a warning about missing libusb library only the first time it is called."""
global did_show_no_libusb_warning
if not did_show_no_libusb_warning:
LOG.warning("STLink and CMSIS-DAPv2 probes are not supported because no libusb library was found.")
LOG.warning("STLink, CMSIS-DAPv2 and PicoProbe probes are not supported because no libusb library was found.")
did_show_no_libusb_warning = True

def should_show_libusb_device_error(vidpid):
"""! @brief Returns whether a debug warning should be shown for the given VID/PID pair.
The first time a given VID/PID is passed to this function, the result will be True. Any
subsequent times, False will be returned for the same VID/PID pair.
@param vidpi A bi-tuple of USB VID and PID, in that order.
"""
should_log = vidpid not in libusb_error_device_set
Expand Down
4 changes: 2 additions & 2 deletions pyocd/probe/picoprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from typing import List

from .debug_probe import DebugProbe
from .common import show_no_libusb_warning
from ..core import exceptions
from ..core.options import OptionInfo
from ..core.plugin import Plugin
Expand Down Expand Up @@ -108,10 +109,9 @@ def enumerate_picoprobes(cls, uid=None) -> List["PicoLink"]:
# Use a custom matcher to make sure the probe is a Picoprobe and accessible.
return [PicoLink(probe) for probe in core.find(find_all=True, custom_match=FindPicoprobe(uid))]
except core.NoBackendError:
LOG.debug(" No usb backend found")
show_no_libusb_warning()
return []


def q_read_bits(self, bits):
"""! @brief Queue a read request for 'bits' bits to the probe """
# Cannot be called with bits = 0
Expand Down

0 comments on commit 1b062eb

Please sign in to comment.