Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-90877

QSerialPortInfo.vendorIdentifier() and QSerialPortInfo.productIdentifier() returns 0x0



    • Linux/X11


      This is a bug reported by a user of Mu Editor, who experience that the editor wouldn't recognize a USB device.

      We've discovered that QSerialPortInfo::availablePorts() in this case doesn't return the right vendor ID (VID) and product ID (PID) for his device, but instead returns 0x0 for both VID and PID.

      The original issue is over here on our bug tracker https://github.com/mu-editor/mu/issues/1270, but I will just describe the details here as well.

      The expected output is VID:PID=239a:8088, which has been confirmed through `lsusb`:

      ~$ lsusb
      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 001 Device 017: ID 239a:8088
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

      Here's a Qt program that queries and prints VID:PID's for all serial devices:

      #include <QDebug>
       #include <QtSerialPort/QSerialPortInfo>
      int main()
       qDebug() << "Qt version: " << QT_VERSION_STR;
       Q_FOREACH(QSerialPortInfo port, QSerialPortInfo::availablePorts())
      { QString vid = "0x" + QString::number(port.vendorIdentifier(), 16); QString pid = "0x" + QString::number(port.productIdentifier(), 16); QString line = QString("%1 VID:PID=%2:%3 (%4)").arg(port.portName(), vid, pid, port.manufacturer()); qDebug() << qPrintable(line); }


      Which just prints the following when executed:

      ~$ ./mu_issue1270
       Qt version: 5.11.3
       ttyACM0 VID:PID=0x0:0x0 ()

      We're using Python to develop Mu, and the other Python library for interacting with serial devices, pySerial, doesn't have this issue:

      ~$ python3 -m serial.tools.list_ports -v
       desc: Feather Bluefruit Sense - CircuitPython CDC control
       hwid: USB VID:PID=239A:8088 SER=5F7F72B6AB5B3CDC LOCATION=1-1:1.0
       1 ports found


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Unassigned Unassigned
            dybber Martin Dybdal
            0 Vote for this issue
            4 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes