PDA

View Full Version : QextSerialEnumerator can not get modem port



baobui
26th July 2010, 11:59
Hi all,

I am using Qt4 to write a software to control the Huawei modem. In device manager, I can see the Modem under Modems tab. When I use teraterm, I can open the modem port (in my computer it is COM7) and send AT command to the modem (work OK).

But when I use QextSerialEnumerator to get the port list, I can not have COM7. QextSerialEnumerator can only list the ports under Ports(COM & LPT) tab.

How can I get the comport in the Modem tab to open the modem in my software?

I greatly appreciate any help

squidge
26th July 2010, 14:06
Did you try to ignore QextSerialEnumerator and open COM7 yourself?

baobui
26th July 2010, 14:49
Hi fatjuicymole,

Thank you very much for your soon reply.

Yes, if I just ignore the QextEnumerator and open COM 7, Qextserialport works OK. But when the user install the modem driver to another computer, the modem will take another COMPORT. I need to auto-detect the port that the modem using.:(

The modem GUID is: 4d32e96d-e325-11ce-bfc1-08002be10318. I tried to modify the GUID_CLASS_COMPORT in qextserialenumerator.cpp, but after recompile the dll, I can not get any port in my enumerator program. I am using the enumerator example.

The funny thing is: in my computer, I have 2 other virtual comports. Their GUID is 4d32e978-e325-11ce-bfc1-08002be10318. But after change the GUID to

DEFINE_GUID(GUID_CLASS_COMPORT, 0x4d32e978, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00,0x2b, 0xe1, 0x03, 0x18)
0r
DEFINE_GUID(GUID_CLASS_COMPORT, 0x4d32e978L, 0xe325, 0x11ce, 0xbf, 0xc1, 0x08, 0x00,0x2b, 0xe1, 0x03, 0x18)

I can not get the 2 virtual COMPORTs, either. :crying:

I can get these ports with the default GUID in the QextEnumerator.cpp

baobui
26th July 2010, 16:26
OK! After some hair-loss I solved my problem :cool:

It turn out that the GUID should be the device interface guid value, not the class guid value.
After changing the GUID to 2c7089aa-2e0e-11d1-b114-00c04fc2aae4, it worked.:o

By the way, is there any way to use the Class GUID value instead? Because the Class GUID of the COMPORT and Modem are the same, so I can enumerate all the ports and modem in oen function.
But when I use the Class GUID and change the flag in SetupDiGetClassDevs (in setupAPIScan function) to DIGCF_PRESENT, the Qextenumerator does not work, either.