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

Serial Number of PPK2 #41

Open
berkersal opened this issue Feb 13, 2024 · 7 comments
Open

Serial Number of PPK2 #41

berkersal opened this issue Feb 13, 2024 · 7 comments

Comments

@berkersal
Copy link

I know it is possible to get which port the device is connected to with list_devices() but I have two PPK2's in a system and need to know which is which without relying on systems enumeration (a.k.a /dev/ttyACM0).

I checked the source code of the library but couldn't find it.

Thanks in advance.

@berkersal
Copy link
Author

By looking at list_devices() I implemented

import serial.tools.list_ports
ports = serial.tools.list_ports.comports()
for port in ports:
    dev = port.device
    serial_number = port.serial_number

It may be a good idea to but serial number in PPK2_API object so people can easily get the serial number

@wlgrd
Copy link
Collaborator

wlgrd commented Apr 18, 2024

@berkersal Will this suffice #43 ?

@berkersal
Copy link
Author

Yes it helps for my case but it will break the examples for Windows

@wlgrd
Copy link
Collaborator

wlgrd commented Apr 18, 2024

Ah, of course. Will have a look at that later when I have access to a Windows computer. If you have any input and you're able to test, please feel free to pitch in and I will update the PR (I don't know if serialtools has the same support for fetching the serial in Windows)

@wlgrd
Copy link
Collaborator

wlgrd commented Apr 18, 2024

Added the same changes to the windows part of list_devices() as I would assume that works

@berkersal
Copy link
Author

I don't have access to a Windows computer that I can use with PPK. But the documentation of pyserial says Windows also supports serial number.
https://pyserial.readthedocs.io/en/latest/tools.html?highlight=serial.tools.list_ports.comports()#serial.tools.list_ports.comports

@wlgrd
Copy link
Collaborator

wlgrd commented Apr 19, 2024

Got around to test it now, it works for both systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants