Can IO ninja show more information about a serial port when selecting?

Hi,

I am using IO ninja on linux (xubuntu 20.04). When selecting a serial port, the dropdown menu is not as helpful as it could be. Here is what I see:

G3_Xubuntu_64-bit_20_04_4.png

It isn't really clear from this which port is which. If I am using something like pyserial (for example), I can get a lot more useful information about the ports. For example, the code:

from serial.tools.list_ports import comports

for port in comports():
    print(port.manufacturer, port.description, "-",  port.usb_info())

gives the output (I deleted the real serial numbers):

SEGGER J-Link - CDC - USB VID:PID=1366:1051 SER=XYZ01 LOCATION=2-2.3:1.2
SEGGER J-Link - CDC - USB VID:PID=1366:1051 SER=XYZ01 LOCATION=2-2.3:1.0
Herbert Engineering polyglot-turtle-xiao - polyglot-turtle CDC - USB VID:PID=04D8:EB74 SER=XYZ02 LOCATION=2-2.2:1.0

Is it possible to have IO ninja display some of this extra information about the serial port ?

Thanks,
Jeremy

Hi,

TLDR:

Good point. We will add manufacturer's information in the next release. As for adding VID/PID and USB address (bus#/device#) information -- this of course is technically possible, but IMHO not really helpful with identifying a particular device (how many users can tell which port on their laptop is Bus 001 Device 008?)

More tech details below.

Serial port enumerator on Linux is using libudev to scan devices in the tty subsystem; then builds each device's description by querying its property (udev_device_get_property_value) called ID_MODEL_FROM_DATABASE -- in most cases, this gives a human readable name of the device. If this property is empty, we fall back to ID_MODEL, and if its also empty, we falls back to the driver's name (udev_device_get_driver).

serial.tools from pyserial seems to omits ID_MODEL_FROM_DATABASE and goes directly for ID_MODEL as the port description (questionable decision). However, they also provides manufacturer's name -- and this is helpful indeed. This information can be fetched via property ID_VENDOR_FROM_DATABASE (maybe, falling back to ID_VENDOR if the former is empty). The verbose USB bus information takes lots of space and gives little help, so I don't think we will copy that.

Thank you. The one thing which is important from the USB bus interface info is the interface number. For example, if you have an FT4232 (ie USB to 4x UART) there is no guarantee that UART0 on the device will enumerate as the first device. With the bus info, you can determine which interface you are connecting to. Perhaps if you think it is too much information, it could be hidden behind some sort of configuration option or preference?

In the example I showed, a J-Link has two serial ports, one on interface number 0 and one on interface number 2 (the last digit in the bus info, after the period). Without this info, it is anyones guess as to which port you are really connecting to. It also allows you to see how many interfaces are available for a specific device.

I would also really like to see the device name and serial number shown if possible; right now I have a system with 5x USB to serial converters connected that use the same IC (CP2102N). If the serial number was visible, it would be much easier to connect to the right device (especially after power cycling can randomise the order of the ports).

There are also companies that give out PIDs to use with their chips, so the manufacturer name in the descriptor doesn’t necessarily match the manufacturer name as reported by something like lsusb (which uses a VID lookup database rather than using the descriptor). Not sure if this matters but I thought I should point it out anyway.

Also, just to add, the last item in my example is one of these mixed manufacturer devices. It uses the Microchip VID, which was sub licensed to “Herbert Engineering” for use with a SAMD microcontroller. This behaviour is common with USB IC manufacturers (I know at least microchip, ST, FTDI and Silicon Labs do it). To report that this device as manufactured by microchip is probably not correct, as microchip would barely even know that it exists, let alone be able to provide support.

There are also cases where the database is wrong/old, for example the company “Cygnal integrated” was purchased by Silicon labs. Some of their new chips use the Cygnal VID, but set the manufacturer name correctly in the descriptor to “Silicon Labs”. So if you google for this there are lots of posts from confused users as to why this weird device is connected to their system. For example: https://stackoverflow.com/questions/38963029/cygnal-integrated-products-serial-port-on-linux

@jeremy-herbert

I see what you mean.

First of all, we are not going to completely match the output of what pyserial gives you. They enumerate and extract all the information by traversing the Linux filesystem and parsing file names and file contents; in IO Ninja we talk to systemd directly via libudev which is more efficient and IMHO a better approach overall.

But we can definitely add extra pieces of information to the description. Here's what we get for free from libudev:

getSysPath: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/ttyUSB0/tty/ttyUSB0
getSysName: ttyUSB0
getSysNum: 0
getDevPath: /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/ttyUSB0/tty/ttyUSB0
getDevNode: /dev/ttyUSB0
getDevType: 
getSubsystem: tty
getDriver: ch341-uart
getAction: 
property[CURRENT_TAGS] = ':systemd:'
property[DEVLINKS] = '/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 /dev/serial/by-path/pci-0000:00:14.0-usb-0:3.1:1.0-port0'
property[DEVNAME] = '/dev/ttyUSB0'
property[DEVPATH] = '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/ttyUSB0/tty/ttyUSB0'
property[ID_AUTOSUSPEND] = '1'
property[ID_BUS] = 'usb'
property[ID_MODEL] = 'USB2.0-Ser_'
property[ID_MODEL_ENC] = 'USB2.0-Ser\x21'
property[ID_MODEL_FROM_DATABASE] = 'CH340 serial converter'
property[ID_MODEL_ID] = '7523'
property[ID_PATH] = 'pci-0000:00:14.0-usb-0:3.1:1.0'
property[ID_PATH_TAG] = 'pci-0000_00_14_0-usb-0_3_1_1_0'
property[ID_PCI_CLASS_FROM_DATABASE] = 'Serial bus controller'
property[ID_PCI_INTERFACE_FROM_DATABASE] = 'XHCI'
property[ID_PCI_SUBCLASS_FROM_DATABASE] = 'USB controller'
property[ID_REVISION] = '0254'
property[ID_SERIAL] = '1a86_USB2.0-Ser_'
property[ID_TYPE] = 'generic'
property[ID_USB_CLASS_FROM_DATABASE] = 'Vendor Specific Class'
property[ID_USB_DRIVER] = 'ch341'
property[ID_USB_INTERFACES] = ':ff0102:'
property[ID_USB_INTERFACE_NUM] = '00'
property[ID_VENDOR] = '1a86'
property[ID_VENDOR_ENC] = '1a86'
property[ID_VENDOR_FROM_DATABASE] = 'QinHeng Electronics'
property[ID_VENDOR_ID] = '1a86'
property[MAJOR] = '188'
property[MINOR] = '0'
property[SUBSYSTEM] = 'tty'
property[TAGS] = ':systemd:'
property[USEC_INITIALIZED] = '10677556659'
tag: systemd
sysattr[dev] = '188:0'
sysattr[device] = '(null)'
sysattr[power/autosuspend_delay_ms] = '(null)'
sysattr[power/control] = 'auto'
sysattr[power/runtime_active_time] = '0'
sysattr[power/runtime_status] = 'unsupported'
sysattr[power/runtime_suspended_time] = '0'
sysattr[subsystem] = 'tty'
sysattr[uevent] = 'MAJOR=188
MINOR=0
DEVNAME=ttyUSB0'

We can start by adding ID_VENDOR_FROM_DATABASE and ID_PATH; we can also additionally show ID_VENDOR and ID_MODEL if they are different from database ones (I think those are fetched by querying USB descriptors).

However, this (already) results in a quite long description string. We will experiment and see how to represent it better -- maybe, via a tooltip, or a multiline combobox item, or some other way.

Bottom line: I heard you; we will add extra information about serial devices on Linux in future IO Ninja releases.

Just FYI, we started to show extended serial port information in ioninja-5.2.0. The port list now contains model and manufacturer information, and if you hover the mouse over a port, a tooltip with even more information will pop up. This applies to all serial-based plugins.

Let me know what you think!