Previously only the dev_id (VID/PID/serial) was checked, but if the
bcdDevice has changed, Windows will have re-enumerated the device and
possibly attributed another ClassGuid to it.
Fixes issue #897.
Closes #900
Thanks to Craig Hutchinson for reporting, suggestion and testing.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
} usb_interface[USB_MAXINTERFACES];
struct hid_device_priv *hid;
PUSB_CONFIGURATION_DESCRIPTOR *config_descriptor; // list of pointers to the cached config descriptors
+ GUID class_guid; // checked for change during re-enumeration
};
struct usbdk_device_handle_priv {
priv = winusb_device_priv_init(dev);
priv->dev_id = _strdup(dev_id);
+ priv->class_guid = dev_info_data.ClassGuid;
if (priv->dev_id == NULL) {
libusb_unref_device(dev);
LOOP_BREAK(LIBUSB_ERROR_NO_MEM);
libusb_unref_device(dev);
goto alloc_device;
}
+ if (!IsEqualGUID(&priv->class_guid, &dev_info_data.ClassGuid)) {
+ usbi_dbg("device class GUID for session [%lX] changed", session_id);
+ usbi_disconnect_device(dev);
+ libusb_unref_device(dev);
+ goto alloc_device;
+ }
}
track_unref:
-#define LIBUSB_NANO 11625
+#define LIBUSB_NANO 11626