lemanhtrung / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

deviceDiscovered / deviceRemoved aren't triggered for virtual COM ports under Windows Vista #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

- use a virtual COM port (attached is an USB device)
- call setUpNotifications() and connect deviceDiscovered and deviceRemoved 
to custom slots
- connect and disconnect the USB device

What is the expected output? What do you see instead?

- deviceDiscovered / deviceRemoved from QextSerialEnumerator should be 
triggered

What version of the product are you using? On what operating system?

- checked out version from 02/02/2010
- operating system is Windows Vista

Please provide any additional information below.

Have checked the method QextSerialEnumerator::onDeviceChangeWin. The 
parameter wParam isn't DBT_DEVICEARRIVAL nor DBT_DEVICEREMOVECOMPLETE, but 
instead was DBT_DEVNODES_CHANGED nevertheless of a connect or disconnect.
Can add a separate signal to notify, that something occured and reparse the  
ports everytime again, but maybe I'm missing something?

Original issue reported on code.google.com by Michael....@treggs.com on 3 Feb 2010 at 1:41

GoogleCodeExporter commented 9 years ago
Hm - I don't have a Vista machine to test on at the moment, but I'm pretty sure 
this code was working fine on a 
Windows 7 machine.

Have you been able to test with more than one serial device, or host machine?

Original comment by lst...@gmail.com on 3 Feb 2010 at 4:19

GoogleCodeExporter commented 9 years ago
Checked it on a second machine with Windows XP and 3 ports: LPT1, COM1 and 
COM18 
(virtual USB). Same behaviour.

Original comment by Michael....@treggs.com on 3 Feb 2010 at 6:22

GoogleCodeExporter commented 9 years ago
Not sure - it's been working for me on several Windows XP/7 machines.

Original comment by lst...@gmail.com on 4 Feb 2010 at 3:09

GoogleCodeExporter commented 9 years ago
Which Qt (and probably Ming) version do you use? I'm working with preconfigured 
LGPL Qt 
4.6.1

Original comment by Michael....@treggs.com on 4 Feb 2010 at 5:59

GoogleCodeExporter commented 9 years ago
Same - the most recent Qt SDK.  Not sure what's going on.

Original comment by lst...@gmail.com on 4 Feb 2010 at 7:12

GoogleCodeExporter commented 9 years ago
Could it be a port driver issue?

Original comment by Michael....@treggs.com on 4 Feb 2010 at 1:21

GoogleCodeExporter commented 9 years ago
If it's showing up in the Ports group, I'm pretty sure the driver has 
identified it correctly.  Which driver are you 
using?

Original comment by lst...@gmail.com on 4 Feb 2010 at 3:53

GoogleCodeExporter commented 9 years ago
That's for sure :)

It only seems, that possibly the driver fires different messages as usual. What 
do you 
think about applying the attached changes to your code?

Original comment by Michael....@treggs.com on 8 Feb 2010 at 9:39

Attachments:

GoogleCodeExporter commented 9 years ago
I had the same problem.
I just add to the RegisterDeviceNotification function the 
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES parameter and it works.

Original comment by vitalij....@gmail.com on 28 Sep 2012 at 1:14

GoogleCodeExporter commented 9 years ago
As suggested above, changing the RegisterDeviceNotification flag from 
DEVICE_NOTIFY_WINDOW_HANDLE to DEVICE_NOTIFY_ALL_INTERFACE_CLASSES fixed the 
issue for me.  Running on 64bit Windows 7 machine.

Original comment by B9Creati...@gmail.com on 24 Oct 2012 at 10:02

GoogleCodeExporter commented 9 years ago
Can someone show some codes to resolve this problem?

Original comment by da...@supridatta.com.br on 6 Dec 2012 at 5:53

GoogleCodeExporter commented 9 years ago
You change the file "qextserialenumerator_win.cpp":

 if(::RegisterDeviceNotification((HWND)notificationWidget->winId(), &dbh, DEVICE_NOTIFY_WINDOW_HANDLE ) == NULL) {
        QESP_WARNING() << "RegisterDeviceNotification failed:" << GetLastError();
        return false;
    }

to:

 if(::RegisterDeviceNotification((HWND)notificationWidget->winId(), &dbh, DEVICE_NOTIFY_ALL_INTERFACE_CLASSES ) == NULL) {
        QESP_WARNING() << "RegisterDeviceNotification failed:" << GetLastError();
        return false;
    }

Well I just find the "DEVICE_NOTIFY_WINDOW_HANDLE" on this file!
In unix version I don't find anything!!!
It will works only in Windows?!

Original comment by da...@supridatta.com.br on 6 Dec 2012 at 7:34

GoogleCodeExporter commented 9 years ago
Thanks, DEVICE_NOTIFY_ALL_INTERFACE_CLASSES has been added now.

Hi dante, Yes, it's windows only.

Original comment by dbzhang...@gmail.com on 10 Dec 2012 at 6:44