Skip to content

Serial Number of PPK2 #41

Closed
Closed

Description

@berkersal

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.

Activity

  1. berkersal commented on Feb 13, 2024

    @berkersal
    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

  2. wlgrd commented on Apr 18, 2024

    @wlgrd
    Collaborator

    @berkersal Will this suffice #43 ?

  3. berkersal commented on Apr 18, 2024

    @berkersal
    Author

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

  4. wlgrd commented on Apr 18, 2024

    @wlgrd
    Collaborator

    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)

  5. wlgrd commented on Apr 18, 2024

    @wlgrd
    Collaborator

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

  6. berkersal commented on Apr 18, 2024

    @berkersal
    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

  7. wlgrd commented on Apr 19, 2024

    @wlgrd
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions