mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Implemented Bus_PlugInRequestCleanUpEvtTimerFunc
This commit is contained in:
@@ -181,7 +181,7 @@ typedef struct _FDO_PLUGIN_REQUEST_DATA
|
||||
//
|
||||
// High resolution timestamp taken when this request got moved to pending state
|
||||
//
|
||||
LONGLONG Timestamp;
|
||||
LARGE_INTEGER Timestamp;
|
||||
|
||||
//
|
||||
// Performance counter system frequency taken upon fetching timestamp
|
||||
|
||||
53
sys/Driver.c
53
sys/Driver.c
@@ -587,8 +587,59 @@ Bus_PlugInRequestCleanUpEvtTimerFunc(
|
||||
WDFTIMER Timer
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Timer);
|
||||
ULONG i;
|
||||
PFDO_DEVICE_DATA pFdoData;
|
||||
WDFREQUEST curRequest;
|
||||
ULONG items;
|
||||
WDFDEVICE device;
|
||||
PFDO_PLUGIN_REQUEST_DATA pPluginData;
|
||||
LONGLONG freq;
|
||||
LARGE_INTEGER pcNow;
|
||||
LONGLONG ellapsed;
|
||||
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
|
||||
|
||||
device = WdfTimerGetParentObject(Timer);
|
||||
pFdoData = FdoGetData(device);
|
||||
|
||||
WdfSpinLockAcquire(pFdoData->PendingPluginRequestsLock);
|
||||
|
||||
items = WdfCollectionGetCount(pFdoData->PendingPluginRequests);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION,
|
||||
TRACE_DRIVER,
|
||||
"Items count: %d",
|
||||
items);
|
||||
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
curRequest = WdfCollectionGetItem(pFdoData->PendingPluginRequests, i);
|
||||
pPluginData = PluginRequestGetData(curRequest);
|
||||
|
||||
freq = pPluginData->Frequency.QuadPart / 1000;
|
||||
pcNow = KeQueryPerformanceCounter(NULL);
|
||||
ellapsed = (pcNow.QuadPart - pPluginData->Timestamp.QuadPart) / freq;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TRACE_DRIVER,
|
||||
"PDO (serial = %d) age: %llu",
|
||||
pPluginData->Serial, ellapsed);
|
||||
|
||||
//if (Serial == curSerial)
|
||||
//{
|
||||
// WdfRequestComplete(curRequest, Status);
|
||||
//
|
||||
// WdfCollectionRemove(pFdoData->PendingPluginRequests, curRequest);
|
||||
//
|
||||
// TraceEvents(TRACE_LEVEL_INFORMATION,
|
||||
// TRACE_DRIVER,
|
||||
// "Removed item with serial: %d",
|
||||
// curSerial);
|
||||
//
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
WdfSpinLockRelease(pFdoData->PendingPluginRequestsLock);
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ NTSTATUS Bus_PlugInDevice(
|
||||
//
|
||||
// Timestamp the request to track its age
|
||||
//
|
||||
pReqData->Timestamp = KeQueryPerformanceCounter(&pReqData->Frequency).QuadPart;
|
||||
pReqData->Timestamp = KeQueryPerformanceCounter(&pReqData->Frequency);
|
||||
|
||||
//
|
||||
// Keep track of pending request in collection
|
||||
|
||||
Reference in New Issue
Block a user