Skip to content

list_ports does not include serial ports by id #66

@Qlexio

Description

@Qlexio

Issue importée depuis pyserial/pyserial

Auteur original : @davet2001
Issue originale : pyserial/pyserial#699
Statut original : Open


Summary

When I use list_ports to provide a list of serial ports to a user in linux, they are only shown ports directly under /dev/* (excluding sudirectories). This can result in multiple ports being displayed e.g. /dev/ttyUSB0, /dev/ttyUSB1.

This is a problem for two reasons:

  • There is no obvious indication which port is which - often resulting in user trial and error.
  • If the machine is restarted with USB adapters disconnected or in a different arrangement, the mapping of USB0,1 etc can change.

The solution would be to include serial ports by ID in the list.

Steps to reproduce

What I did:

$ python3 -m serial.tools.list_ports -v -s

What I expected to happen:

$ python3 -m serial.tools.list_ports -v -s
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
    desc: n/a
    hwid: LINK=/dev/ttyUSB0 LINK=/dev/ttyUSB0
/dev/ttyUSB0        
    desc: USB2.0-Serial
    hwid: USB VID:PID=1A86:7523 LOCATION=1-4
2 ports found

What actually happened:

/dev/ttyUSB0        
    desc: USB2.0-Serial
    hwid: USB VID:PID=1A86:7523 LOCATION=1-4
1 ports found

I am working on a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions