Bug #4461
closedThe sort order of discovered ports is annoying
0%
Description
At least on Ubuntu, there are lots of /dev/ttyS* ports that show up at all times. When selecting a port to transfer to/from a radio it would be nice if these weren't in the way, making me scroll to the end of the list every time to select /dev/USB*
I propose to sort the discovered ports with /dev/ttyS* at the end rather than the middle.
Updated by Aaron P over 7 years ago
- Status changed from New to Rejected
Closing this.
The issue I had, which appears to be unique to me, at least at the moment, is I have several radios that enumerate as different devices. Every time I use chirp I have to change the selected device and that means scrolling all the way to the end of the list for /dev/ttyU*
There was some chat on IRC about this. We couldn't agree on an elegant solution. I have the following patched in platform.py and it works for me, but the concern is that a broken sort order might confuse users.
def list_serial_ports(self):
"""Return a list of OS files matching known patterns.
@
Each pattern is expanded and sorted, then appended
to the result. The primary point being to show ttyUSB*
before the huge list of ttyS*
"""
ports = [
"/dev/ttyACM*",
"/dev/ttyAMA*",
"/dev/cu.",
"/dev/cua0",
"/dev/cuaU*",
"/dev/term/",
"/dev/tty.KeySerial",
"/dev/ttyUSB*",
"/dev/ttyS*"]
@
available_ports = []
for port_pattern in ports:
for port in natural_sorted(glob.glob(port_pattern)):
available_ports.append(port)
return available_ports