Solved QSerialPortInfo have different result on WIN/MAC ?
-
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-PortThe result on MAC is:
incoming port - Bluetooth-Incoming-Port
incoming port - Bluetooth-Incoming-PortMAC 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.
-
Please provide full info, e.g. use the {c}enumerator example. And a OSX version.
-
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.
-
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]
-
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 ~