From 2891553a2ee54a851a93d30ab6b04e9228f3f9dc Mon Sep 17 00:00:00 2001 From: Christian Wilgaard Date: Thu, 25 Jul 2024 11:45:41 +0200 Subject: [PATCH] list_devices: adds support for several com ports After the firmware change in the official PPK2 application 4.2.0, the device now enumerates two serial ports: one for data and commands, the other for a debug shell which is not used in this library. This forces connection with the port on endpoint 1. --- src/ppk2_api/ppk2_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ppk2_api/ppk2_api.py b/src/ppk2_api/ppk2_api.py index c291cdc..4b39a69 100644 --- a/src/ppk2_api/ppk2_api.py +++ b/src/ppk2_api/ppk2_api.py @@ -219,13 +219,13 @@ def list_devices(): devices = [ (port.device, port.serial_number[:8]) for port in ports - if port.description.startswith("nRF Connect USB CDC ACM") + if port.description.startswith("nRF Connect USB CDC ACM") and port.location.endswith("1") ] else: devices = [ (port.device, port.serial_number[:8]) for port in ports - if port.product == "PPK2" + if port.product == "PPK2" and port.location.endswith("1") ] return devices