VirtualBox

Changeset 38425 in vbox


Ignore:
Timestamp:
Aug 11, 2011 8:22:34 PM (13 years ago)
Author:
vboxsync
Message:

usb/win: better logging

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp

    r38424 r38425  
    252252static void vboxUsbFltDevOwnerSetLocked(PVBOXUSBFLT_DEVICE pDevice, PVBOXUSBFLTCTX pContext, uintptr_t uFltId, bool fIsOneShot)
    253253{
    254     Assert(!pDevice->pOwner);
     254    ASSERT_WARN(!pDevice->pOwner, ("device 0x%p has an owner(0x%p)", pDevice, pDevice->pOwner));
    255255    ++pContext->cActiveFilters;
    256256    pDevice->pOwner = pContext;
     
    261261static void vboxUsbFltDevOwnerClearLocked(PVBOXUSBFLT_DEVICE pDevice)
    262262{
    263     Assert(pDevice->pOwner);
     263    ASSERT_WARN(pDevice->pOwner, ("no owner for device 0x%p", pDevice));
    264264    --pDevice->pOwner->cActiveFilters;
    265     Assert(pDevice->pOwner->cActiveFilters < UINT32_MAX/2);
     265    ASSERT_WARN(pDevice->pOwner->cActiveFilters < UINT32_MAX/2, ("cActiveFilters (%d)", pDevice->pOwner->cActiveFilters));
    266266    pDevice->pOwner = NULL;
    267267    pDevice->uFltId = 0;
     
    905905                        }
    906906                    }
     907                    else
     908                    {
     909                        LOG(("driver name not match, was:"));
     910                        LOG_USTR(&pHubDevObj->DriverObject->DriverName);
     911                        LOG(("but expected:"));
     912                        LOG_USTR(&szStandardControllerName[j]);
     913                    }
    907914                }
    908915            }
     916            else
     917            {
     918                LOG(("null driver object (0x%p) or name buffer (0x%p), length(%d)", pHubDevObj->DriverObject,
     919                        pHubDevObj->DriverObject ? pHubDevObj->DriverObject->DriverName.Buffer : NULL,
     920                        pHubDevObj->DriverObject ? pHubDevObj->DriverObject->DriverName.Length : 0));
     921            }
    909922            ObDereferenceObject(pHubFileObj);
    910923        }
     
    918931NTSTATUS VBoxUsbFltClose(PVBOXUSBFLTCTX pContext)
    919932{
     933    LOG(("Closing context(0x%p)", pContext));
    920934    LIST_ENTRY ReplugDevList;
    921935    InitializeListHead(&ReplugDevList);
    922936
    923     Assert(pContext);
     937    ASSERT_WARN(pContext, ("null context"));
    924938
    925939    KIRQL Irql = KeGetCurrentIrql();
    926     Assert(Irql == PASSIVE_LEVEL);
     940    ASSERT_WARN(Irql == PASSIVE_LEVEL, ("irql==(%d)", Irql));
    927941
    928942    VBOXUSBFLT_LOCK_ACQUIRE();
     
    931945    if (pContext->pChangeEvent)
    932946    {
     947        LOG(("seting & closing change event (0x%p)", pContext->pChangeEvent));
    933948        KeSetEvent(pContext->pChangeEvent,
    934949                0, /* increment*/
     
    937952        pContext->pChangeEvent = NULL;
    938953    }
     954    else
     955    {
     956        LOG(("no change event"));
     957    }
    939958    RemoveEntryList(&pContext->ListEntry);
    940959
     960    LOG(("removing owner filters"));
    941961    /* now re-arrange the filters */
    942962    /* 1. remove filters */
    943963    VBoxUSBFilterRemoveOwner(pContext);
    944964
     965    LOG(("enumerating devices.."));
    945966    /* 2. check if there are devices owned */
    946967    for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.DeviceList.Flink;
     
    952973            continue;
    953974
    954         Assert(pDevice->enmState != VBOXUSBFLT_DEVSTATE_ADDED);
    955         Assert(pDevice->enmState != VBOXUSBFLT_DEVSTATE_REMOVED);
     975        LOG(("found device(0x%p), pdo(0x%p), state(%d), filter id(0x%p), oneshot(%d)",
     976                pDevice, pDevice->Pdo, pDevice->enmState, pDevice->uFltId, (int)pDevice->fIsFilterOneShot));
     977        ASSERT_WARN(pDevice->enmState != VBOXUSBFLT_DEVSTATE_ADDED, ("VBOXUSBFLT_DEVSTATE_ADDED state for device(0x%p)", pDevice));
     978        ASSERT_WARN(pDevice->enmState != VBOXUSBFLT_DEVSTATE_REMOVED, ("VBOXUSBFLT_DEVSTATE_REMOVED state for device(0x%p)", pDevice));
    956979
    957980        vboxUsbFltDevOwnerClearLocked(pDevice);
     
    959982        if (vboxUsbFltDevCheckReplugLocked(pDevice, pContext))
    960983        {
     984            LOG(("device needs replug"));
    961985            InsertHeadList(&ReplugDevList, &pDevice->RepluggingLe);
    962986            /* retain to ensure the device is not removed before we issue a replug */
     
    965989            ObReferenceObject(pDevice->Pdo);
    966990        }
     991        else
     992        {
     993            LOG(("device does NOT need replug"));
     994        }
    967995    }
    968996    VBOXUSBFLT_LOCK_RELEASE();
     
    971999    vboxUsbFltReplugList(&ReplugDevList);
    9721000
     1001    LOG(("SUCCESS done context(0x%p)", pContext));
    9731002    return STATUS_SUCCESS;
    9741003}
     
    9761005NTSTATUS VBoxUsbFltCreate(PVBOXUSBFLTCTX pContext)
    9771006{
     1007    LOG(("Creating context(0x%p)", pContext));
    9781008    memset(pContext, 0, sizeof (*pContext));
    9791009    pContext->Process = RTProcSelf();
     
    9811011    InsertHeadList(&g_VBoxUsbFltGlobals.ContextList, &pContext->ListEntry);
    9821012    VBOXUSBFLT_LOCK_RELEASE();
     1013    LOG(("SUCCESS context(0x%p)", pContext));
    9831014    return STATUS_SUCCESS;
    9841015}
     
    9861017int VBoxUsbFltAdd(PVBOXUSBFLTCTX pContext, PUSBFILTER pFilter, uintptr_t *pId)
    9871018{
     1019    LOG(("adding filter, Context (0x%p)..", pContext));
    9881020    *pId = 0;
    9891021    /* LOG the filter details. */
     
    10341066int VBoxUsbFltRemove(PVBOXUSBFLTCTX pContext, uintptr_t uId)
    10351067{
     1068    LOG(("removing filter id(0x%p), Context (0x%p)..", pContext, uId));
    10361069    Assert(uId);
    10371070
     
    10451078    }
    10461079
     1080    LOG(("enumerating devices.."));
    10471081    for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.DeviceList.Flink;
    10481082            pEntry != &g_VBoxUsbFltGlobals.DeviceList;
     
    10621096            continue;
    10631097
     1098        LOG(("found device(0x%p), pdo(0x%p), state(%d), filter id(0x%p), oneshot(%d)",
     1099                pDevice, pDevice->Pdo, pDevice->enmState, pDevice->uFltId, (int)pDevice->fIsFilterOneShot));
    10641100        ASSERT_WARN(!pDevice->fIsFilterOneShot, ("device(0x%p) is filtered with a oneshot filter", pDevice));
    10651101        pDevice->uFltId = 0;
     
    10681104    }
    10691105    VBOXUSBFLT_LOCK_RELEASE();
     1106
     1107    LOG(("done enumerating devices"));
    10701108
    10711109    if (RT_SUCCESS(rc))
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp

    r38356 r38425  
    13391339#endif
    13401340
    1341     LOG(("VBoxUSBMon::DriverEntry\n"));
     1341    LOGREL(("Built %s %s", __DATE__, __TIME__));
    13421342
    13431343    memset (&g_VBoxUsbMonGlobals, 0, sizeof (g_VBoxUsbMonGlobals));
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