- Timestamp:
- Sep 24, 2019 2:24:18 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
r80941 r80978 95 95 /* true iff device is filtered with a one-shot filter */ 96 96 bool fIsFilterOneShot; 97 /* true if descriptors could not be read and only inferred from PnP Manager data */ 98 bool fInferredDesc; 97 99 /* The device state. If the non-owner session is requesting the state while the device is grabbed, 98 100 * the USBDEVICESTATE_USED_BY_HOST is returned. */ … … 341 343 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_PRODUCT_ID, pDevice->idProduct, true); 342 344 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_REV, pDevice->bcdDevice, true); 343 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_CLASS, pDevice->bClass, true);344 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_SUB_CLASS, pDevice->bSubClass, true);345 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_PROTOCOL, pDevice->bProtocol, true);346 345 USBFilterSetStringExact(&DevFlt, USBFILTERIDX_MANUFACTURER_STR, pDevice->szMfgName, true /*fMustBePresent*/, true /*fPurge*/); 347 346 USBFilterSetStringExact(&DevFlt, USBFILTERIDX_PRODUCT_STR, pDevice->szProduct, true /*fMustBePresent*/, true /*fPurge*/); 348 347 USBFilterSetStringExact(&DevFlt, USBFILTERIDX_SERIAL_NUMBER_STR, pDevice->szSerial, true /*fMustBePresent*/, true /*fPurge*/); 348 349 /* If device descriptor had to be inferred from PnP Manager data, the class/subclass/protocol may be wrong. 350 * When Windows reports CompatibleIDs 'USB\Class_03&SubClass_00&Prot_00', the device descriptor might be 351 * reporting class 3 (HID), *or* the device descriptor might be reporting class 0 (specified by interface) 352 * and the device's interface reporting class 3. Ignore the class/subclass/protocol in such case, since 353 * we are more or less guaranteed to rely on VID/PID anyway. 354 * See @bugref{9479}. 355 */ 356 if (pDevice->fInferredDesc) 357 { 358 LOG(("Device descriptor was not read, only inferred; ignoring class/subclass/protocol!")); 359 } 360 else 361 { 362 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_CLASS, pDevice->bClass, true); 363 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_SUB_CLASS, pDevice->bSubClass, true); 364 USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_PROTOCOL, pDevice->bProtocol, true); 365 } 349 366 350 367 /* Run filters on the thing. */ … … 515 532 do 516 533 { 534 pDevice->fInferredDesc = false; 517 535 Status = VBoxUsbToolGetDescriptor(pDo, pDevDr, sizeof(*pDevDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 518 536 if (!NT_SUCCESS(Status)) … … 569 587 pDevDr->bDeviceSubClass = sub; 570 588 pDevDr->bDeviceProtocol = prt; 589 590 /* The USB device class/subclass/protocol may not be accurate. We have to be careful when comparing 591 * and not take mismatches too seriously. 592 */ 593 pDevice->fInferredDesc = true; 571 594 } 572 595 … … 1105 1128 USBFilterSetMustBePresent(pFilter, USBFILTERIDX_PORT, false); 1106 1129 1130 /* We may not be able to reconstruct the class/subclass/protocol if we aren't able to 1131 * read the device descriptor. Don't require these to be present. See also the fInferredDesc flag. 1132 */ 1133 USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_CLASS, false); 1134 USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_SUB_CLASS, false); 1135 USBFilterSetMustBePresent(pFilter, USBFILTERIDX_DEVICE_PROTOCOL, false); 1136 1107 1137 uintptr_t uId = 0; 1108 1138 VBOXUSBFLT_LOCK_ACQUIRE();
Note:
See TracChangeset
for help on using the changeset viewer.