lemanhtrung / qextserialport

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

Register for windows device notifications from USB ->serial converters #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Device notifications aren't received from USB serial converters, registering 
for notifications from the USB Raw GUID fixes this, the following can be added 
to qextserialenumerator_win.cpp:

#ifndef GUID_DEVCLASS_USBRAW
    DEFINE_GUID(GUID_DEVCLASS_USBRAW, 0xa5dcbf10, 0x6530, 0x11d2, 0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed );
#endif

...

void QextSerialEnumerator::setUpNotifications( )
{
...
    CopyMemory(&dbh.dbcc_classguid, &GUID_DEVCLASS_USBRAW, sizeof(GUID));
    if( RegisterDeviceNotification( notificationWidget->winId( ), &dbh, DEVICE_NOTIFY_WINDOW_HANDLE ) == NULL)
        qWarning() << "RegisterDeviceNotification (usbraw) failed:" << GetLastError();
...
}

Original issue reported on code.google.com by autopula...@gmail.com on 28 Jul 2010 at 10:13