Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSerialPortInfo have different result on WIN/MAC ?
Forum Updated to NodeBB v4.3 + New Features

QSerialPortInfo have different result on WIN/MAC ?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saito
    wrote on last edited by
    #1

    Dear Sirs,

    I am trying to find com port by PID/VID on WIN and MAC by QSerialPortInfo.
    It works fine on WIN, but on MAC system, it will reply same device twice?

    auto allInfo = QSerialPortInfo::availablePorts();
    for (int i = 0; i < allInfo.size(); i++)
    {
      auto desc = allInfo[i].description().toStdString();
      auto cdesc = desc.c_str();
      auto vid = allInfo[i].vendorIdentifier();
      auto pid = allInfo[i].productIdentifier();
      printf("%s\r\n", cdesc);
    }
    
    

    The result on WIN is :
    incoming port - Bluetooth-Incoming-Port

    The result on MAC is:
    incoming port - Bluetooth-Incoming-Port
    incoming port - Bluetooth-Incoming-Port

    MAC will show same device twice, why ?

    Currently I always choose first one, it looks OK for now , but is it correct ?

    Thanks for any comment.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by kuzulis
      #2

      Please provide full info, e.g. use the {c}enumerator example. And a OSX version.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saito
        wrote on last edited by
        #3

        Dear @kuzulis ,

        The enumeration method is "QSerialPortInfo::availablePorts()".

        When there are only one serial port device on my MAC, the size report 2.
        Then I print out the content of allInfo, I can see it show same device name twice.

        The OS version is 10.11.4(El Capitan) MacBook.

        The same code running on my WIN7 will not show duplicate name.

        Thank you.

        K 1 Reply Last reply
        0
        • S saito

          Dear @kuzulis ,

          The enumeration method is "QSerialPortInfo::availablePorts()".

          When there are only one serial port device on my MAC, the size report 2.
          Then I print out the content of allInfo, I can see it show same device name twice.

          The OS version is 10.11.4(El Capitan) MacBook.

          The same code running on my WIN7 will not show duplicate name.

          Thank you.

          K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on last edited by kshegunov
          #4

          Did you hear me? If you want to get any help, please provide a specific output from the cenumerator example. Make what is asked. Also specify a Qt version too.

          PS: Here are no telepathists.

          [Edited out a sharp-ish comment. ~kshegunov]

          1 Reply Last reply
          2
          • S Offline
            S Offline
            saito
            wrote on last edited by saito
            #5

            Dear @kuzulis ,

            I am sorry cause any confusing, due to my low knowledge I think I misunderstood your question.
            I didn't realize you are talking about the Qt serial port example "cenumerator",
            I though you were asking me how to enumerate serial port in C, sorry.

            After finding the correct cenumerator example code, I understand that there are two similar com port in /dev/cu and /dev/tty, this is why I always see two identical port name in MAC.

            Thank you for the help, appreciate that ~

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved