Skip to content

Linux Enhancement request: Include symlinks in GetCommPorts return #567

@newHeiko

Description

@newHeiko

Hello and thanks for this piece of software!

We recently switched JMRI: https://jmri.org over from PureJavaComm to jSerialComm to future-proof it.

One issue we are just now running into: Since Linux re-enumerates USB-Serial-Adapters depending on the order of plugging them in, some of our Linux users use udev-generated symlinks to tell multiple different USB->Serial adapters apart. For example, what could today be:

/dev/PR3Adapter -> /dev/ttyUSB0
/dev/NCEAdapter -> /dev/ttyUSB1
/dev/LokProgrammer -> /dev/ttyACM4

might tomorrow or after a couple of unplugging/replugging cycles look like:

/dev/PR3Adapter -> /dev/ttyUSB1
/dev/NCEAdapter -> /dev/ttyUSB0
/dev/LokProgrammer -> /dev/ttyACM2

We'd love to have the return value of GetCommPorts include those symlinks. Would you accept a PR that adds to

directoryIterator = opendir("/dev/");
another iteration through /dev, looking for symlinks to ports already in the vector and adding the symlinks to the comPorts vector? (Would that even work if they refer to the same physical port but show up twice in the result?)

If not, I'll give our port selector another deep look.

Thanks,
Heiko

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions