Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list_devices: adds support for several com ports #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ppk2_api/ppk2_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that location is same for both ports in macOS. But seems that first occurrence works there.

Copy link
Collaborator Author

@wlgrd wlgrd Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unfortunately don't have a mac to test with, but "first occurrence"; can you elaborate? The location should be derived from the USB hub tree, and both having the same location doesn't make sense to me as there has to be two logical endpoints on the device.

]
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

Expand Down