VirtualBox

Changeset 78998 in vbox


Ignore:
Timestamp:
Jun 5, 2019 2:30:40 PM (6 years ago)
Author:
vboxsync
Message:

HostDrivers/VBOxUSB/win: Short term workaround for @bugref{9479} which needs to beactivated by a special registry setting, will get removed as soon as a proper fix is found

Location:
trunk/src/VBox/HostDrivers/VBoxUSB/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp

    r76553 r78998  
    307307    pDev->bcdDevice = pConInfo->DeviceDescriptor.bcdDevice;
    308308    pDev->bBus = 0; /** @todo figure out bBus on windows... */
     309#if 1 /** @todo check up the bPort value before enabling this. */
    309310    pDev->bPort = iPort;
     311#else
     312    pDev->bPort = 0;
     313#endif
    310314    /** @todo check which devices are used for primary input (keyboard & mouse) */
    311315    if (!lpszDrvKeyName || *lpszDrvKeyName == 0)
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp

    r76553 r78998  
    175175    LIST_ENTRY BlackDeviceList;
    176176    VBOXUSBFLT_LOCK Lock;
     177    /** Flag whether to force replugging a device we can't query descirptors from.
     178     * Short term workaround for @bugref{9479}. */
     179    ULONG           dwForceReplugWhenDevPopulateFails;
    177180} VBOXUSBFLTGLOBALS, *PVBOXUSBFLTGLOBALS;
    178181static VBOXUSBFLTGLOBALS g_VBoxUsbFltGlobals;
     
    830833            {
    831834                WARN(("vboxUsbFltDevPopulate for PDO 0x%p failed with Status 0x%x", pDevObj, Status));
     835                if (   Status == STATUS_CANCELLED
     836                    && g_VBoxUsbFltGlobals.dwForceReplugWhenDevPopulateFails)
     837                {
     838                    /*
     839                     * This can happen if the device got suspended and is in D3 state where we can't query any strings.
     840                     * There is no known way to set the power state of the device, especially if there is no driver attached yet.
     841                     * The sledgehammer approach is to just replug the device to force it out of suspend, see bugref @{9479}.
     842                     */
     843                    continue;
     844                }
    832845            }
    833846
     
    13811394}
    13821395
     1396
     1397static NTSTATUS vboxUsbFltRegKeyQuery(PWSTR ValueName, ULONG ValueType, PVOID ValueData, ULONG ValueLength, PVOID Context, PVOID EntryContext)
     1398{
     1399    NTSTATUS Status = STATUS_SUCCESS;
     1400
     1401    RT_NOREF(ValueName, Context);
     1402    if (   ValueType == REG_DWORD
     1403        && ValueLength == sizeof(ULONG))
     1404        *(ULONG *)EntryContext = *(ULONG *)ValueData;
     1405    else
     1406        Status = STATUS_OBJECT_TYPE_MISMATCH;
     1407
     1408    return Status;
     1409}
     1410
     1411
    13831412NTSTATUS VBoxUsbFltInit()
    13841413{
     
    13961425    vboxUsbFltBlDevPopulateWithKnownLocked();
    13971426    VBOXUSBFLT_LOCK_INIT();
     1427
     1428    /*
     1429     * Check whether the setting to force replugging USB devices when
     1430     * querying string descriptors fail is set in the registry,
     1431     * see @bugref{9479}.
     1432     */
     1433    RTL_QUERY_REGISTRY_TABLE aParams[] =
     1434    {
     1435        {vboxUsbFltRegKeyQuery, 0, L"ForceReplugWhenDevPopulateFails", &g_VBoxUsbFltGlobals.dwForceReplugWhenDevPopulateFails, REG_DWORD, &g_VBoxUsbFltGlobals.dwForceReplugWhenDevPopulateFails, sizeof(ULONG) },
     1436        {                 NULL, 0,                               NULL,                                                   NULL,         0,                                                     0,             0 }
     1437    };
     1438    UNICODE_STRING UnicodePath = RTL_CONSTANT_STRING(L"\\VBoxUSB");
     1439
     1440    NTSTATUS Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL, UnicodePath.Buffer, &aParams[0], NULL, NULL);
     1441    if (Status == STATUS_SUCCESS)
     1442    {
     1443        if (g_VBoxUsbFltGlobals.dwForceReplugWhenDevPopulateFails)
     1444            LOG(("Forcing replug of USB devices where querying the descriptors fail\n"));
     1445    }
     1446    else
     1447        LOG(("RtlQueryRegistryValues() -> %#x, assuming defaults\n", Status));
     1448
    13981449    return STATUS_SUCCESS;
    13991450}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette