33# Copyright (c) 2020 Patrick Huesmann
44# Copyright (c) 2021 mentha
55# Copyright (c) 2021 Chris Reed
6+ # Copyright (c) 2022 Harper Weigle
67# SPDX-License-Identifier: Apache-2.0
78#
89# Licensed under the Apache License, Version 2.0 (the "License");
@@ -336,14 +337,16 @@ def __call__(self, dev):
336337 if filter_device_by_class (dev .idVendor , dev .idProduct , dev .bDeviceClass ):
337338 return False
338339
340+ known_cmsis_dap = is_known_cmsis_dap_vid_pid (dev .idVendor , dev .idProduct )
339341 try :
340342 # First attempt to get the active config. This produces a more direct error
341343 # when you don't have device permissions on Linux
342344 config = dev .get_active_configuration ()
343345
346+
344347 # Now read the product name string.
345348 device_string = dev .product
346- if (device_string is None ) or ("CMSIS-DAP" not in device_string ):
349+ if (( device_string is None ) or ("CMSIS-DAP" not in device_string )) and ( not known_cmsis_dap ):
347350 return False
348351
349352 # Get count of HID interfaces.
@@ -360,7 +363,7 @@ def __call__(self, dev):
360363 (error , dev .idVendor , dev .idProduct ))
361364 # If we recognize this device as one that should be CMSIS-DAP, we can raise
362365 # the level of the log message since it's almost certainly a permissions issue.
363- if is_known_cmsis_dap_vid_pid ( dev . idVendor , dev . idProduct ) :
366+ if known_cmsis_dap :
364367 LOG .warning (msg )
365368 else :
366369 LOG .debug (msg )
0 commit comments