mirror of
https://github.com/nefarius/ViGEmBus.git
synced 2025-08-10 00:52:17 +00:00
Updated tracing routines
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
//
|
||||
// Don't compile in verbose tracing on release builds
|
||||
//
|
||||
#ifndef DBG
|
||||
#ifdef TraceDbg
|
||||
#undef TraceDbg
|
||||
#define TraceDbg(...) { /* nothing to see here :) */ };
|
||||
#endif
|
||||
#endif
|
||||
@@ -51,8 +51,6 @@
|
||||
#include "XusbPdo.hpp"
|
||||
#include "Ds4Pdo.hpp"
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
using ViGEm::Bus::Core::PDO_IDENTIFICATION_DESCRIPTION;
|
||||
using ViGEm::Bus::Core::EmulationTargetPDO;
|
||||
using ViGEm::Bus::Targets::EmulationTargetXUSB;
|
||||
@@ -147,7 +145,7 @@ NTSTATUS Bus_EvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit)
|
||||
|
||||
if (deviceAlreadyExists)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"Device with interface GUID {%!GUID!} already exists (%ws)",
|
||||
&GUID_DEVINTERFACE_BUSENUM_VIGEM,
|
||||
@@ -201,7 +199,7 @@ NTSTATUS Bus_EvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit)
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"WdfDeviceCreate failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -211,7 +209,7 @@ NTSTATUS Bus_EvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit)
|
||||
pFDOData = FdoGetData(device);
|
||||
if (pFDOData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"FdoGetData failed");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
@@ -234,7 +232,7 @@ NTSTATUS Bus_EvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit)
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"WdfIoQueueCreate failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -249,7 +247,7 @@ NTSTATUS Bus_EvtDeviceAdd(IN WDFDRIVER Driver, IN PWDFDEVICE_INIT DeviceInit)
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"WdfDeviceCreateDeviceInterface failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -300,7 +298,7 @@ Bus_DeviceFileCreate(
|
||||
|
||||
if (pFileData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"FileObjectGetData failed to return file object from WDFFILEOBJECT 0x%p",
|
||||
FileObject);
|
||||
@@ -310,7 +308,7 @@ Bus_DeviceFileCreate(
|
||||
pFDOData = FdoGetData(Device);
|
||||
if (pFDOData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"FdoGetData failed");
|
||||
status = STATUS_NO_SUCH_DEVICE;
|
||||
@@ -364,7 +362,7 @@ Bus_FileClose(
|
||||
pFileData = FileObjectGetData(FileObject);
|
||||
if (pFileData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"FileObjectGetData failed to return file object from WDFFILEOBJECT 0x%p",
|
||||
FileObject);
|
||||
@@ -376,7 +374,7 @@ Bus_FileClose(
|
||||
pFDOData = FdoGetData(device);
|
||||
if (pFDOData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"FdoGetData failed");
|
||||
status = STATUS_NO_SUCH_DEVICE;
|
||||
@@ -408,7 +406,7 @@ Bus_FileClose(
|
||||
break;
|
||||
}
|
||||
|
||||
//TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
//TraceVerbose(
|
||||
// TRACE_DRIVER,
|
||||
// "PDO properties: status = %!STATUS!, pdoPID = %d, curPID = %d, pdoSID = %d, curSID = %d, internal = %d",
|
||||
// (int)childInfo.Status,
|
||||
@@ -432,7 +430,7 @@ Bus_FileClose(
|
||||
status = WdfChildListUpdateChildDescriptionAsMissing(list, &description.Header);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DRIVER,
|
||||
"WdfChildListUpdateChildDescriptionAsMissing failed with status %!STATUS!",
|
||||
status);
|
||||
|
||||
180
sys/Ds4Pdo.cpp
180
sys/Ds4Pdo.cpp
@@ -40,14 +40,12 @@
|
||||
#define NTSTRSAFE_LIB
|
||||
#include <ntstrsafe.h>
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
|
||||
PCWSTR ViGEm::Bus::Targets::EmulationTargetDS4::_deviceDescription = L"Virtual DualShock 4 Controller";
|
||||
|
||||
ViGEm::Bus::Targets::EmulationTargetDS4::EmulationTargetDS4(ULONG Serial, LONG SessionId, USHORT VendorId,
|
||||
USHORT ProductId) : EmulationTargetPDO(
|
||||
Serial, SessionId, VendorId, ProductId)
|
||||
USHORT ProductId) : EmulationTargetPDO(
|
||||
Serial, SessionId, VendorId, ProductId)
|
||||
{
|
||||
this->_TargetType = DualShock4Wired;
|
||||
this->_UsbConfigurationDescriptionSize = DS4_DESCRIPTOR_SIZE;
|
||||
@@ -74,7 +72,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = RtlUnicodeStringInit(DeviceDescription, _deviceDescription);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"RtlUnicodeStringInit failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -88,7 +86,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = WdfPdoInitAddHardwareID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfPdoInitAddHardwareID failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -103,7 +101,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = WdfPdoInitAddHardwareID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfPdoInitAddHardwareID failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -116,7 +114,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfPdoInitAddCompatibleID (#01) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -128,7 +126,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfPdoInitAddCompatibleID (#02) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -140,7 +138,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoPrepareDevice(PWDFDEVICE_IN
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfPdoInitAddCompatibleID (#03) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -202,10 +200,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfTimerCreate failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfTimerCreate failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -226,10 +224,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfDriverOpenParametersRegistryKey failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfDriverOpenParametersRegistryKey failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -246,10 +244,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -266,10 +264,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -287,10 +285,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfRegistryCreateKey failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -306,14 +304,14 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION,
|
||||
TRACE_DS4,
|
||||
"MAC-Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
this->_TargetMacAddress.Vendor0,
|
||||
this->_TargetMacAddress.Vendor1,
|
||||
this->_TargetMacAddress.Vendor2,
|
||||
this->_TargetMacAddress.Nic0,
|
||||
this->_TargetMacAddress.Nic1,
|
||||
this->_TargetMacAddress.Nic2);
|
||||
TRACE_DS4,
|
||||
"MAC-Address: %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
this->_TargetMacAddress.Vendor0,
|
||||
this->_TargetMacAddress.Vendor1,
|
||||
this->_TargetMacAddress.Vendor2,
|
||||
this->_TargetMacAddress.Nic0,
|
||||
this->_TargetMacAddress.Nic1,
|
||||
this->_TargetMacAddress.Nic2);
|
||||
|
||||
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
{
|
||||
@@ -328,19 +326,19 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfRegistryAssignValue failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfRegistryAssignValue failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
else if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_DS4,
|
||||
"WdfRegistryQueryValue failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_DS4,
|
||||
"WdfRegistryQueryValue failed with status %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -430,20 +428,20 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::SelectConfiguration(PURB Urb)
|
||||
if (Urb->UrbHeader.Length < DS4_CONFIGURATION_SIZE)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_WARNING,
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Invalid ConfigurationDescriptor");
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Invalid ConfigurationDescriptor");
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PUSBD_INTERFACE_INFORMATION pInfo = &Urb->UrbSelectConfiguration.Interface;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TRACE_DS4,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
static_cast<int>(pInfo->Length),
|
||||
static_cast<int>(pInfo->InterfaceNumber),
|
||||
static_cast<int>(pInfo->AlternateSetting),
|
||||
pInfo->NumberOfPipes);
|
||||
TraceVerbose(
|
||||
TRACE_DS4,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
static_cast<int>(pInfo->Length),
|
||||
static_cast<int>(pInfo->InterfaceNumber),
|
||||
static_cast<int>(pInfo->AlternateSetting),
|
||||
pInfo->NumberOfPipes);
|
||||
|
||||
pInfo->Class = 0x03; // HID
|
||||
pInfo->SubClass = 0x00;
|
||||
@@ -480,10 +478,10 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbClassInterface(PURB Urb)
|
||||
{
|
||||
struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST* pRequest = &Urb->UrbControlVendorClassRequest;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_CLASS_INTERFACE");
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> TransferFlags = 0x%X, Request = 0x%X, Value = 0x%X, Index = 0x%X, BufLen = %d",
|
||||
pRequest->TransferFlags,
|
||||
@@ -499,7 +497,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbClassInterface(PURB Urb)
|
||||
UCHAR reportId = hid_get_report_id(pRequest);
|
||||
UCHAR reportType = hid_get_report_type(pRequest);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> >> GET_REPORT(%d): %d",
|
||||
reportType, reportId);
|
||||
@@ -586,7 +584,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbClassInterface(PURB Urb)
|
||||
UCHAR reportId = hid_get_report_id(pRequest);
|
||||
UCHAR reportType = hid_get_report_type(pRequest);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> >> SET_REPORT(%d): %d",
|
||||
reportType, reportId);
|
||||
@@ -884,7 +882,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbGetDescriptorFromInterface(
|
||||
|
||||
struct _URB_CONTROL_DESCRIPTOR_REQUEST* pRequest = &Urb->UrbControlDescriptorRequest;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> _URB_CONTROL_DESCRIPTOR_REQUEST: Buffer Length %d",
|
||||
pRequest->TransferBufferLength);
|
||||
@@ -912,7 +910,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbSelectInterface(PURB Urb)
|
||||
|
||||
NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbGetStringDescriptorType(PURB Urb)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"Index = %d",
|
||||
Urb->UrbControlDescriptorRequest.Index);
|
||||
@@ -934,7 +932,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbGetStringDescriptorType(PUR
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"LanguageId = 0x%X",
|
||||
Urb->UrbControlDescriptorRequest.LanguageId);
|
||||
@@ -965,7 +963,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbGetStringDescriptorType(PUR
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"LanguageId = 0x%X",
|
||||
Urb->UrbControlDescriptorRequest.LanguageId);
|
||||
@@ -1003,12 +1001,12 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbBulkOrInterruptTransfer(_UR
|
||||
{
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
WDFREQUEST notifyRequest;
|
||||
|
||||
|
||||
// Data coming FROM us TO higher driver
|
||||
if (pTransfer->TransferFlags & USBD_TRANSFER_DIRECTION_IN
|
||||
&& pTransfer->PipeHandle == reinterpret_cast<USBD_PIPE_HANDLE>(0xFFFF0084))
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> Incoming request, queuing...");
|
||||
|
||||
@@ -1046,18 +1044,18 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbBulkOrInterruptTransfer(_UR
|
||||
notify->Report = this->_OutputReport;
|
||||
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
sizeof(DS4_REQUEST_NOTIFICATION)
|
||||
notify,
|
||||
sizeof(DS4_REQUEST_NOTIFICATION)
|
||||
);
|
||||
|
||||
WdfRequestCompleteWithInformation(notifyRequest, status, notify->Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_USBPDO,
|
||||
"WdfRequestRetrieveOutputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_USBPDO,
|
||||
"WdfRequestRetrieveOutputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1078,12 +1076,12 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::UsbBulkOrInterruptTransfer(_UR
|
||||
|
||||
*static_cast<size_t*>(contextBuffer) = DS4_OUTPUT_BUFFER_LENGTH;
|
||||
|
||||
TraceDbg(TRACE_USBPDO, "Queued %Iu bytes", DS4_OUTPUT_BUFFER_LENGTH);
|
||||
TraceVerbose(TRACE_USBPDO, "Queued %Iu bytes", DS4_OUTPUT_BUFFER_LENGTH);
|
||||
|
||||
DMF_BufferQueue_Enqueue(this->_UsbInterruptOutBufferQueue, clientBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1119,9 +1117,9 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::SubmitReportImpl(PVOID NewRepo
|
||||
{
|
||||
NTSTATUS status;
|
||||
WDFREQUEST usbRequest;
|
||||
|
||||
|
||||
/*
|
||||
* The logic here is unusual to keep backwards compatibility with the
|
||||
* The logic here is unusual to keep backwards compatibility with the
|
||||
* original API that didn't allow submitting the full report.
|
||||
*/
|
||||
|
||||
@@ -1150,13 +1148,13 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::SubmitReportImpl(PVOID NewRepo
|
||||
* Skip first byte as it contains the never changing report ID
|
||||
*/
|
||||
|
||||
//
|
||||
// "Old" API which only allows to update partial report
|
||||
//
|
||||
//
|
||||
// "Old" API which only allows to update partial report
|
||||
//
|
||||
if (pSubmit->Size == sizeof(DS4_SUBMIT_REPORT))
|
||||
{
|
||||
TraceDbg(TRACE_DS4, "Received DS4_SUBMIT_REPORT update");
|
||||
|
||||
TraceVerbose(TRACE_DS4, "Received DS4_SUBMIT_REPORT update");
|
||||
|
||||
RtlCopyBytes(
|
||||
&this->_Report[1],
|
||||
&(static_cast<PDS4_SUBMIT_REPORT>(NewReport))->Report,
|
||||
@@ -1169,15 +1167,15 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetDS4::SubmitReportImpl(PVOID NewRepo
|
||||
//
|
||||
if (pSubmit->Size == sizeof(DS4_SUBMIT_REPORT_EX))
|
||||
{
|
||||
TraceDbg(TRACE_DS4, "Received DS4_SUBMIT_REPORT_EX update");
|
||||
|
||||
TraceVerbose(TRACE_DS4, "Received DS4_SUBMIT_REPORT_EX update");
|
||||
|
||||
RtlCopyBytes(
|
||||
&this->_Report[1],
|
||||
&(static_cast<PDS4_SUBMIT_REPORT_EX>(NewReport))->Report,
|
||||
sizeof((static_cast<PDS4_SUBMIT_REPORT_EX>(NewReport))->Report)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (buffer)
|
||||
RtlCopyBytes(buffer, this->_Report, DS4_REPORT_SIZE);
|
||||
|
||||
@@ -1229,8 +1227,8 @@ void ViGEm::Bus::Targets::EmulationTargetDS4::ProcessPendingNotification(WDFQUEU
|
||||
PVOID clientBuffer, contextBuffer;
|
||||
PDS4_REQUEST_NOTIFICATION notify = nullptr;
|
||||
|
||||
TraceDbg(TRACE_USBPDO, "%!FUNC! Entry");
|
||||
|
||||
FuncEntry(TRACE_DS4);
|
||||
|
||||
//
|
||||
// Loop through and drain all queued requests until buffer is empty
|
||||
//
|
||||
@@ -1268,11 +1266,11 @@ void ViGEm::Bus::Targets::EmulationTargetDS4::ProcessPendingNotification(WDFQUEU
|
||||
notify->SerialNo = this->_SerialNo;
|
||||
notify->Report = *static_cast<PDS4_OUTPUT_REPORT>(clientBuffer);
|
||||
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
sizeof(DS4_REQUEST_NOTIFICATION)
|
||||
);
|
||||
|
||||
|
||||
WdfRequestCompleteWithInformation(request, status, notify->Size);
|
||||
}
|
||||
|
||||
@@ -1287,7 +1285,7 @@ void ViGEm::Bus::Targets::EmulationTargetDS4::ProcessPendingNotification(WDFQUEU
|
||||
}
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_USBPDO, "%!FUNC! Exit");
|
||||
TraceVerbose(TRACE_USBPDO, "%!FUNC! Exit");
|
||||
}
|
||||
|
||||
VOID ViGEm::Bus::Targets::EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
@@ -1299,7 +1297,7 @@ VOID ViGEm::Bus::Targets::EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
|
||||
WDFREQUEST usbRequest;
|
||||
|
||||
TraceDbg(TRACE_DS4, "%!FUNC! Entry");
|
||||
FuncEntry(TRACE_DS4);
|
||||
|
||||
// Get pending USB request
|
||||
const auto status = WdfIoQueueRetrieveNextRequest(ctx->_PendingUsbInRequests, &usbRequest);
|
||||
@@ -1328,5 +1326,5 @@ VOID ViGEm::Bus::Targets::EmulationTargetDS4::PendingUsbRequestsTimerFunc(
|
||||
WdfRequestComplete(usbRequest, status);
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_DS4, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
TraceVerbose(TRACE_DS4, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#include <usbioctl.h>
|
||||
#include <usbiodef.h>
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
|
||||
PCWSTR ViGEm::Bus::Core::EmulationTargetPDO::_deviceLocation = L"Virtual Gamepad Emulation Bus";
|
||||
|
||||
@@ -89,7 +87,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
status = WdfPdoInitAssignDeviceID(DeviceInit, &deviceId);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfPdoInitAssignDeviceID failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -100,7 +98,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
status = RtlUnicodeStringPrintf(&buffer, L"%02d", this->_SerialNo);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"RtlUnicodeStringPrintf failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -111,7 +109,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
status = WdfPdoInitAssignInstanceID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfPdoInitAssignInstanceID failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -122,7 +120,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
status = WdfPdoInitAddDeviceText(DeviceInit, &deviceDescription, &deviceLocation, 0x409);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfPdoInitAddDeviceText failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -158,14 +156,14 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
status = WdfDeviceCreate(&DeviceInit, &pdoAttributes, &this->_PdoDevice);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfDeviceCreate failed with status %!STATUS!",
|
||||
status);
|
||||
break;
|
||||
}
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
"Created PDO 0x%p",
|
||||
this->_PdoDevice);
|
||||
@@ -181,7 +179,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfDeviceCreateDeviceInterface failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -202,7 +200,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"Couldn't initialize additional contexts: %!STATUS!",
|
||||
status);
|
||||
@@ -212,7 +210,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Create Queues & Locks
|
||||
|
||||
|
||||
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
|
||||
attributes.ParentObject = this->_PdoDevice;
|
||||
|
||||
@@ -227,7 +225,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfIoQueueCreate (PendingUsbInRequests) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -248,7 +246,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfIoQueueCreate (PendingNotificationRequests) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -262,7 +260,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfIoQueueReadyNotify (PendingNotificationRequests) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -288,7 +286,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoCreateDevice(WDFDEVICE ParentD
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfIoQueueCreate (Default) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -330,7 +328,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtDeviceContextCleanup(
|
||||
IN WDFOBJECT Device
|
||||
)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE, TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
TraceVerbose(TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
|
||||
const auto ctx = EmulationTargetPdoGetContext(Device);
|
||||
|
||||
@@ -367,13 +365,13 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtDeviceContextCleanup(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// PDO device object getting disposed, free context object
|
||||
//
|
||||
delete ctx->Target;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE, TRACE_BUSPDO, "%!FUNC! Exit");
|
||||
TraceVerbose(TRACE_BUSPDO, "%!FUNC! Exit");
|
||||
}
|
||||
|
||||
NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::SubmitReport(PVOID NewReport)
|
||||
@@ -428,21 +426,21 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EnqueueWaitDeviceReady(WDFREQUEST
|
||||
else
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_WARNING,
|
||||
TRACE_BUSPDO,
|
||||
"KeWaitForSingleObject failed with status %!STATUS!",
|
||||
status
|
||||
TRACE_BUSPDO,
|
||||
"KeWaitForSingleObject failed with status %!STATUS!",
|
||||
status
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = WdfRequestForwardToIoQueue(Request, this->_WaitDeviceReadyRequests);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_BUSPDO,
|
||||
"WdfRequestForwardToIoQueue failed with status %!STATUS!",
|
||||
status
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfRequestForwardToIoQueue failed with status %!STATUS!",
|
||||
status
|
||||
);
|
||||
|
||||
return status;
|
||||
@@ -451,23 +449,23 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EnqueueWaitDeviceReady(WDFREQUEST
|
||||
OBJECT_ATTRIBUTES threadOb;
|
||||
|
||||
InitializeObjectAttributes(&threadOb, NULL,
|
||||
OBJ_KERNEL_HANDLE, NULL, NULL);
|
||||
OBJ_KERNEL_HANDLE, NULL, NULL);
|
||||
|
||||
status = PsCreateSystemThread(&this->_WaitDeviceReadyCompletionWorkerThreadHandle,
|
||||
static_cast<ACCESS_MASK>(0L),
|
||||
&threadOb,
|
||||
nullptr,
|
||||
nullptr,
|
||||
WaitDeviceReadyCompletionWorkerRoutine,
|
||||
this
|
||||
static_cast<ACCESS_MASK>(0L),
|
||||
&threadOb,
|
||||
nullptr,
|
||||
nullptr,
|
||||
WaitDeviceReadyCompletionWorkerRoutine,
|
||||
this
|
||||
);
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_BUSPDO,
|
||||
"PsCreateSystemThread failed with status %!STATUS!",
|
||||
status
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"PsCreateSystemThread failed with status %!STATUS!",
|
||||
status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -481,7 +479,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoPrepare(WDFDEVICE ParentDevice
|
||||
WDF_IO_QUEUE_CONFIG plugInQueueConfig;
|
||||
DMF_MODULE_ATTRIBUTES moduleAttributes;
|
||||
DMF_CONFIG_BufferQueue dmfBufferCfg;
|
||||
|
||||
|
||||
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
|
||||
attributes.ParentObject = ParentDevice;
|
||||
|
||||
@@ -496,7 +494,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoPrepare(WDFDEVICE ParentDevice
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"WdfIoQueueCreate (PendingPlugInRequests) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -530,10 +528,10 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::PdoPrepare(WDFDEVICE ParentDevice
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_BUSPDO,
|
||||
"DMF_BufferQueue_Create failed with status %!STATUS!",
|
||||
status
|
||||
TraceError(
|
||||
TRACE_BUSPDO,
|
||||
"DMF_BufferQueue_Create failed with status %!STATUS!",
|
||||
status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -617,8 +615,8 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::WaitDeviceReadyCompletionWorkerRoutin
|
||||
timeout.QuadPart = WDF_REL_TIMEOUT_IN_SEC(1);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION,
|
||||
TRACE_BUSPDO,
|
||||
"Waiting for 1 second to complete PDO boot..."
|
||||
TRACE_BUSPDO,
|
||||
"Waiting for 1 second to complete PDO boot..."
|
||||
);
|
||||
|
||||
NTSTATUS status = KeWaitForSingleObject(
|
||||
@@ -637,8 +635,8 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::WaitDeviceReadyCompletionWorkerRoutin
|
||||
if (!NT_SUCCESS(WdfIoQueueRetrieveNextRequest(ctx->_WaitDeviceReadyRequests, &waitRequest)))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_WARNING,
|
||||
TRACE_BUSPDO,
|
||||
"No pending device wait request available"
|
||||
TRACE_BUSPDO,
|
||||
"No pending device wait request available"
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -646,8 +644,8 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::WaitDeviceReadyCompletionWorkerRoutin
|
||||
if (status == STATUS_TIMEOUT)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_WARNING,
|
||||
TRACE_BUSPDO,
|
||||
"Device wait request timed out, completing with error"
|
||||
TRACE_BUSPDO,
|
||||
"Device wait request timed out, completing with error"
|
||||
);
|
||||
|
||||
//
|
||||
@@ -660,8 +658,8 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::WaitDeviceReadyCompletionWorkerRoutin
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION,
|
||||
TRACE_BUSPDO,
|
||||
"Device wait request completed successfully"
|
||||
TRACE_BUSPDO,
|
||||
"Device wait request completed successfully"
|
||||
);
|
||||
|
||||
//
|
||||
@@ -670,8 +668,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::WaitDeviceReadyCompletionWorkerRoutin
|
||||
WdfRequestComplete(waitRequest, STATUS_SUCCESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (FALSE);
|
||||
} while (FALSE);
|
||||
|
||||
ZwClose(ctx->_WaitDeviceReadyCompletionWorkerThreadHandle);
|
||||
ctx->_WaitDeviceReadyCompletionWorkerThreadHandle = nullptr;
|
||||
@@ -699,7 +696,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::DumpAsHex(PCSTR Prefix, PVOID Buffer,
|
||||
sprintf(&dumpBuffer[i * 2], "%02X", static_cast<PUCHAR>(Buffer)[i]);
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_BUSPDO,
|
||||
TraceVerbose(TRACE_BUSPDO,
|
||||
"%s - Buffer length: %04d, buffer content: %s\n",
|
||||
Prefix,
|
||||
BufferLength,
|
||||
@@ -751,14 +748,14 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::UsbGetConfigurationDescriptorType
|
||||
|
||||
NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::UsbSelectConfiguration(PURB Urb)
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: TotalLength %d",
|
||||
Urb->UrbHeader.Length);
|
||||
|
||||
if (Urb->UrbHeader.Length == sizeof(struct _URB_SELECT_CONFIGURATION))
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: NULL ConfigurationDescriptor");
|
||||
return STATUS_SUCCESS;
|
||||
@@ -835,7 +832,7 @@ BOOLEAN ViGEm::Bus::Core::EmulationTargetPDO::EvtChildListIdentificationDescript
|
||||
|
||||
|
||||
NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EnqueueWaitDeviceReady(WDFDEVICE ParentDevice, ULONG SerialNo,
|
||||
WDFREQUEST Request)
|
||||
WDFREQUEST Request)
|
||||
{
|
||||
NTSTATUS status;
|
||||
PDO_IDENTIFICATION_DESCRIPTION description;
|
||||
@@ -843,8 +840,8 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EnqueueWaitDeviceReady(WDFDEVICE
|
||||
WDF_CHILD_RETRIEVE_INFO childInfo;
|
||||
WDFDEVICE childDevice;
|
||||
|
||||
TraceDbg(TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
|
||||
FuncEntry(TRACE_BUSPDO);
|
||||
|
||||
const WDFCHILDLIST list = WdfFdoGetDefaultChildList(ParentDevice);
|
||||
|
||||
WDF_CHILD_LIST_ITERATOR_INIT(
|
||||
@@ -893,8 +890,8 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EnqueueWaitDeviceReady(WDFDEVICE
|
||||
&iterator
|
||||
);
|
||||
|
||||
TraceDbg(TRACE_BUSPDO, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
|
||||
TraceVerbose(TRACE_BUSPDO, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -904,7 +901,7 @@ NTSTATUS ViGEm::Bus::Core::EmulationTargetPDO::EvtDevicePrepareHardware(
|
||||
_In_ WDFCMRESLIST ResourcesTranslated
|
||||
)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
FuncEntry(TRACE_BUSPDO);
|
||||
|
||||
UNREFERENCED_PARAMETER(ResourcesRaw);
|
||||
UNREFERENCED_PARAMETER(ResourcesTranslated);
|
||||
@@ -936,7 +933,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
PURB urb;
|
||||
PIO_STACK_LOCATION irpStack;
|
||||
|
||||
TraceDbg(TRACE_BUSPDO, "%!FUNC! Entry");
|
||||
FuncEntry(TRACE_BUSPDO);
|
||||
|
||||
// No help from the framework available from here on
|
||||
irp = WdfRequestWdmGetIrp(Request);
|
||||
@@ -946,7 +943,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
{
|
||||
case IOCTL_INTERNAL_USB_SUBMIT_URB:
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> IOCTL_INTERNAL_USB_SUBMIT_URB");
|
||||
|
||||
@@ -956,7 +953,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
{
|
||||
case URB_FUNCTION_CONTROL_TRANSFER:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_CONTROL_TRANSFER");
|
||||
|
||||
@@ -966,7 +963,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_CONTROL_TRANSFER_EX:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_CONTROL_TRANSFER_EX");
|
||||
|
||||
@@ -976,7 +973,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER");
|
||||
|
||||
@@ -986,7 +983,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_SELECT_CONFIGURATION:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_SELECT_CONFIGURATION");
|
||||
|
||||
@@ -996,7 +993,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_SELECT_INTERFACE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_SELECT_INTERFACE");
|
||||
|
||||
@@ -1006,7 +1003,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE");
|
||||
|
||||
@@ -1014,7 +1011,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
{
|
||||
case USB_DEVICE_DESCRIPTOR_TYPE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> >> USB_DEVICE_DESCRIPTOR_TYPE");
|
||||
|
||||
@@ -1025,7 +1022,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case USB_CONFIGURATION_DESCRIPTOR_TYPE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> >> USB_CONFIGURATION_DESCRIPTOR_TYPE");
|
||||
|
||||
@@ -1035,7 +1032,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case USB_STRING_DESCRIPTOR_TYPE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> >> USB_STRING_DESCRIPTOR_TYPE");
|
||||
|
||||
@@ -1045,14 +1042,14 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
default:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> >> Unknown descriptor type");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
"<< <<");
|
||||
|
||||
@@ -1060,7 +1057,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_GET_STATUS_FROM_DEVICE");
|
||||
|
||||
@@ -1071,7 +1068,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_ABORT_PIPE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_ABORT_PIPE");
|
||||
|
||||
@@ -1081,7 +1078,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_CLASS_INTERFACE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_CLASS_INTERFACE");
|
||||
|
||||
@@ -1091,7 +1088,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE");
|
||||
|
||||
@@ -1101,7 +1098,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
default:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> >> Unknown function: 0x%X",
|
||||
urb->UrbHeader.Function);
|
||||
@@ -1109,7 +1106,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
break;
|
||||
}
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
"<<");
|
||||
|
||||
@@ -1117,7 +1114,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case IOCTL_INTERNAL_USB_GET_PORT_STATUS:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> IOCTL_INTERNAL_USB_GET_PORT_STATUS");
|
||||
|
||||
@@ -1130,7 +1127,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case IOCTL_INTERNAL_USB_RESET_PORT:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> IOCTL_INTERNAL_USB_RESET_PORT");
|
||||
|
||||
@@ -1141,7 +1138,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION");
|
||||
|
||||
@@ -1153,7 +1150,7 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
|
||||
default:
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSPDO,
|
||||
">> Unknown I/O control code 0x%X",
|
||||
IoControlCode);
|
||||
@@ -1166,12 +1163,12 @@ VOID ViGEm::Bus::Core::EmulationTargetPDO::EvtIoInternalDeviceControl(
|
||||
WdfRequestComplete(Request, status);
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_BUSPDO, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
TraceVerbose(TRACE_BUSPDO, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
}
|
||||
|
||||
void ViGEm::Bus::Core::EmulationTargetPDO::EvtWdfIoPendingNotificationQueueState(
|
||||
WDFQUEUE Queue,
|
||||
WDFCONTEXT Context
|
||||
WDFQUEUE Queue,
|
||||
WDFCONTEXT Context
|
||||
)
|
||||
{
|
||||
const auto pThis = static_cast<EmulationTargetPDO*>(Context);
|
||||
@@ -1183,6 +1180,6 @@ void ViGEm::Bus::Core::EmulationTargetPDO::EvtWdfIoPendingNotificationQueueState
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pThis->ProcessPendingNotification(Queue);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
#include "XusbPdo.hpp"
|
||||
#include "Ds4Pdo.hpp"
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
using ViGEm::Bus::Core::PDO_IDENTIFICATION_DESCRIPTION;
|
||||
using ViGEm::Bus::Core::EmulationTargetPDO;
|
||||
using ViGEm::Bus::Targets::EmulationTargetXUSB;
|
||||
@@ -76,7 +74,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
Device = WdfIoQueueGetDevice(Queue);
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "%!FUNC! Entry (device: 0x%p)", Device);
|
||||
TraceVerbose(TRACE_QUEUE, "%!FUNC! Entry (device: 0x%p)", Device);
|
||||
|
||||
switch (IoControlCode)
|
||||
{
|
||||
@@ -84,7 +82,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_VIGEM_CHECK_VERSION:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_VIGEM_CHECK_VERSION");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_VIGEM_CHECK_VERSION");
|
||||
|
||||
status = WdfRequestRetrieveInputBuffer(
|
||||
Request,
|
||||
@@ -101,7 +99,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
status = (pCheckVersion->Version == VIGEM_COMMON_VERSION) ? STATUS_SUCCESS : STATUS_NOT_SUPPORTED;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_QUEUE,
|
||||
"Requested version: 0x%04X, compiled version: 0x%04X",
|
||||
pCheckVersion->Version, VIGEM_COMMON_VERSION);
|
||||
@@ -114,7 +112,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_VIGEM_WAIT_DEVICE_READY:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_VIGEM_WAIT_DEVICE_READY");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_VIGEM_WAIT_DEVICE_READY");
|
||||
|
||||
status = WdfRequestRetrieveInputBuffer(
|
||||
Request,
|
||||
@@ -132,7 +130,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
// This request only supports a single PDO at a time
|
||||
if (pWaitDeviceReady->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Invalid serial 0 submitted");
|
||||
|
||||
@@ -156,7 +154,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_VIGEM_PLUGIN_TARGET:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_VIGEM_PLUGIN_TARGET");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_VIGEM_PLUGIN_TARGET");
|
||||
|
||||
status = Bus_PlugInDevice(Device, Request, FALSE, &length);
|
||||
|
||||
@@ -168,7 +166,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_VIGEM_UNPLUG_TARGET:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_VIGEM_UNPLUG_TARGET");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_VIGEM_UNPLUG_TARGET");
|
||||
|
||||
status = Bus_UnPlugDevice(Device, Request, FALSE, &length);
|
||||
|
||||
@@ -180,7 +178,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_XUSB_SUBMIT_REPORT:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_XUSB_SUBMIT_REPORT");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_XUSB_SUBMIT_REPORT");
|
||||
|
||||
status = WdfRequestRetrieveInputBuffer(
|
||||
Request,
|
||||
@@ -191,7 +189,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -203,7 +201,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
// This request only supports a single PDO at a time
|
||||
if (xusbSubmit->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Invalid serial 0 submitted");
|
||||
|
||||
@@ -225,12 +223,12 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_XUSB_REQUEST_NOTIFICATION:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_XUSB_REQUEST_NOTIFICATION");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_XUSB_REQUEST_NOTIFICATION");
|
||||
|
||||
// Don't accept the request if the output buffer can't hold the results
|
||||
if (OutputBufferLength < sizeof(XUSB_REQUEST_NOTIFICATION))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Output buffer %d too small, require at least %d",
|
||||
static_cast<int>(OutputBufferLength), static_cast<int>(sizeof(XUSB_REQUEST_NOTIFICATION)));
|
||||
@@ -246,7 +244,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -258,7 +256,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
// This request only supports a single PDO at a time
|
||||
if (xusbNotify->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Invalid serial 0 submitted");
|
||||
|
||||
@@ -284,7 +282,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_DS4_SUBMIT_REPORT:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_DS4_SUBMIT_REPORT");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_DS4_SUBMIT_REPORT");
|
||||
|
||||
status = WdfRequestRetrieveInputBuffer(
|
||||
Request,
|
||||
@@ -295,7 +293,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -307,7 +305,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
//
|
||||
if (length < sizeof(DS4_SUBMIT_REPORT) || length > sizeof(DS4_SUBMIT_REPORT_EX))
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_QUEUE,
|
||||
"Unexpected buffer size: %d",
|
||||
static_cast<ULONG>(length)
|
||||
@@ -322,7 +320,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
//
|
||||
if (length != ds4Submit->Size)
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_QUEUE,
|
||||
"Invalid buffer size: %d",
|
||||
ds4Submit->Size
|
||||
@@ -337,7 +335,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
//
|
||||
if (ds4Submit->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Invalid serial 0 submitted");
|
||||
|
||||
@@ -358,12 +356,12 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_DS4_REQUEST_NOTIFICATION:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_DS4_REQUEST_NOTIFICATION");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_DS4_REQUEST_NOTIFICATION");
|
||||
|
||||
// Don't accept the request if the output buffer can't hold the results
|
||||
if (OutputBufferLength < sizeof(DS4_REQUEST_NOTIFICATION))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Output buffer %d too small, require at least %d",
|
||||
static_cast<int>(OutputBufferLength), static_cast<int>(sizeof(DS4_REQUEST_NOTIFICATION)));
|
||||
@@ -379,7 +377,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -391,7 +389,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
// This request only supports a single PDO at a time
|
||||
if (ds4Notify->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_QUEUE,
|
||||
"Invalid serial 0 submitted");
|
||||
|
||||
@@ -417,7 +415,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
|
||||
case IOCTL_XUSB_GET_USER_INDEX:
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "IOCTL_XUSB_GET_USER_INDEX");
|
||||
TraceVerbose(TRACE_QUEUE, "IOCTL_XUSB_GET_USER_INDEX");
|
||||
|
||||
// Don't accept the request if the output buffer can't hold the results
|
||||
if (OutputBufferLength < sizeof(XUSB_GET_USER_INDEX))
|
||||
@@ -474,7 +472,7 @@ VOID Bus_EvtIoDeviceControl(
|
||||
WdfRequestCompleteWithInformation(Request, status, length);
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_QUEUE, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
TraceVerbose(TRACE_QUEUE, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
}
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\sdk\include\ViGEm\km\BusShared.h" />
|
||||
<ClInclude Include="Debugging.hpp" />
|
||||
<ClInclude Include="Driver.h" />
|
||||
<ClInclude Include="CRTCPP.hpp" />
|
||||
<ClInclude Include="Ds4Pdo.hpp" />
|
||||
|
||||
@@ -57,9 +57,6 @@
|
||||
<ClInclude Include="..\sdk\include\ViGEm\km\BusShared.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugging.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="XusbPdo.cpp">
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include <usbbusif.h>
|
||||
|
||||
#include <ViGEm/km/BusShared.h>
|
||||
#include "Debugging.hpp"
|
||||
|
||||
|
||||
PCWSTR ViGEm::Bus::Targets::EmulationTargetXUSB::_deviceDescription = L"Virtual Xbox 360 Controller";
|
||||
|
||||
@@ -88,7 +86,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = RtlUnicodeStringInit(DeviceDescription, _deviceDescription);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"RtlUnicodeStringInit failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -103,7 +101,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = WdfPdoInitAddHardwareID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfPdoInitAddHardwareID failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -117,7 +115,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfPdoInitAddCompatibleID #1 failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -129,7 +127,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfPdoInitAddCompatibleID #2 failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -141,7 +139,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfPdoInitAddCompatibleID #3 failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -153,7 +151,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareDevice(PWDFDEVICE_I
|
||||
status = WdfPdoInitAddCompatibleID(DeviceInit, &buffer);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfPdoInitAddCompatibleID #4 failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -197,7 +195,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoPrepareHardware()
|
||||
status = WdfDeviceAddQueryInterface(this->_PdoDevice, &ifaceCfg);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfDeviceAddQueryInterface failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -215,7 +213,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoInitContext()
|
||||
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
|
||||
attributes.ParentObject = this->_PdoDevice;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE, TRACE_XUSB, "Initializing XUSB context...");
|
||||
TraceVerbose(TRACE_XUSB, "Initializing XUSB context...");
|
||||
|
||||
RtlZeroMemory(this->_Rumble, ARRAYSIZE(this->_Rumble));
|
||||
|
||||
@@ -241,7 +239,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfMemoryCreate failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -284,7 +282,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::PdoInitContext()
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_XUSB,
|
||||
"WdfIoQueueCreate (HoldingUsbInRequests) failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -468,7 +466,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SelectConfiguration(PURB Urb)
|
||||
|
||||
PUSBD_INTERFACE_INFORMATION pInfo = &Urb->UrbSelectConfiguration.Interface;
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_XUSB,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
(int)pInfo->Length,
|
||||
@@ -500,7 +498,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SelectConfiguration(PURB Urb)
|
||||
|
||||
pInfo = (PUSBD_INTERFACE_INFORMATION)((PCHAR)pInfo + pInfo->Length);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_XUSB,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
(int)pInfo->Length,
|
||||
@@ -548,7 +546,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SelectConfiguration(PURB Urb)
|
||||
|
||||
pInfo = (PUSBD_INTERFACE_INFORMATION)((PCHAR)pInfo + pInfo->Length);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_XUSB,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
(int)pInfo->Length,
|
||||
@@ -572,7 +570,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SelectConfiguration(PURB Urb)
|
||||
|
||||
pInfo = (PUSBD_INTERFACE_INFORMATION)((PCHAR)pInfo + pInfo->Length);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_XUSB,
|
||||
">> >> >> URB_FUNCTION_SELECT_CONFIGURATION: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
(int)pInfo->Length,
|
||||
@@ -611,7 +609,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbSelectInterface(PURB Urb)
|
||||
{
|
||||
PUSBD_INTERFACE_INFORMATION pInfo = &Urb->UrbSelectInterface.Interface;
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_INTERFACE: Length %d, Interface %d, Alternate %d, Pipes %d",
|
||||
(int)pInfo->Length,
|
||||
@@ -619,7 +617,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbSelectInterface(PURB Urb)
|
||||
(int)pInfo->AlternateSetting,
|
||||
pInfo->NumberOfPipes);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_SELECT_INTERFACE: Class %d, SubClass %d, Protocol %d",
|
||||
(int)pInfo->Class,
|
||||
@@ -708,7 +706,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
// Data coming FROM us TO higher driver
|
||||
if (pTransfer->TransferFlags & USBD_TRANSFER_DIRECTION_IN)
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> Incoming request, queuing...");
|
||||
|
||||
@@ -807,7 +805,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
}
|
||||
|
||||
// Data coming FROM the higher driver TO us
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
">> >> >> URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: Handle %p, Flags %X, Length %d",
|
||||
pTransfer->PipeHandle,
|
||||
@@ -820,7 +818,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
{
|
||||
auto Buffer = static_cast<PUCHAR>(pTransfer->TransferBuffer);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"-- LED Buffer: %02X %02X %02X",
|
||||
Buffer[0], Buffer[1], Buffer[2]);
|
||||
@@ -833,7 +831,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
if (Buffer[2] == 0x04)this->_LedNumber = 2;
|
||||
if (Buffer[2] == 0x05)this->_LedNumber = 3;
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"-- LED Number: %d",
|
||||
this->_LedNumber);
|
||||
@@ -850,7 +848,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
{
|
||||
auto Buffer = static_cast<PUCHAR>(pTransfer->TransferBuffer);
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_USBPDO,
|
||||
"-- Rumble Buffer: %02X %02X %02X %02X %02X %02X %02X %02X",
|
||||
Buffer[0],
|
||||
@@ -891,18 +889,18 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
notify->SmallMotor = this->_Rumble[4];
|
||||
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
sizeof(XUSB_REQUEST_NOTIFICATION)
|
||||
notify,
|
||||
sizeof(XUSB_REQUEST_NOTIFICATION)
|
||||
);
|
||||
|
||||
WdfRequestCompleteWithInformation(notifyRequest, status, notify->Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TRACE_USBPDO,
|
||||
"WdfRequestRetrieveOutputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
TraceError(
|
||||
TRACE_USBPDO,
|
||||
"WdfRequestRetrieveOutputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -923,7 +921,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbBulkOrInterruptTransfer(_U
|
||||
|
||||
*static_cast<size_t*>(contextBuffer) = pTransfer->TransferBufferLength;
|
||||
|
||||
TraceDbg(TRACE_USBPDO, "Queued %Iu bytes", pTransfer->TransferBufferLength);
|
||||
TraceVerbose(TRACE_USBPDO, "Queued %Iu bytes", pTransfer->TransferBufferLength);
|
||||
|
||||
DMF_BufferQueue_Enqueue(this->_UsbInterruptOutBufferQueue, clientBuffer);
|
||||
}
|
||||
@@ -977,7 +975,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::UsbControlTransfer(PURB Urb)
|
||||
|
||||
NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SubmitReportImpl(PVOID NewReport)
|
||||
{
|
||||
TraceDbg(TRACE_BUSENUM, "%!FUNC! Entry");
|
||||
FuncEntry(TRACE_BUSENUM);
|
||||
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
BOOLEAN changed;
|
||||
@@ -990,14 +988,14 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SubmitReportImpl(PVOID NewRep
|
||||
// Don't waste pending IRP if input hasn't changed
|
||||
if (!changed)
|
||||
{
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"Input report hasn't changed since last update, aborting with %!STATUS!",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
|
||||
TraceDbg(
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"Received new report, processing");
|
||||
|
||||
@@ -1025,7 +1023,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::SubmitReportImpl(PVOID NewRep
|
||||
// Complete pending request
|
||||
WdfRequestComplete(usbRequest, status);
|
||||
|
||||
TraceDbg(TRACE_BUSENUM, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
TraceVerbose(TRACE_BUSENUM, "%!FUNC! Exit with status %!STATUS!", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1037,7 +1035,7 @@ NTSTATUS ViGEm::Bus::Targets::EmulationTargetXUSB::GetUserIndex(PULONG UserIndex
|
||||
|
||||
if (!UserIndex)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
|
||||
if (this->_LedNumber >= 0)
|
||||
{
|
||||
*UserIndex = static_cast<ULONG>(this->_LedNumber);
|
||||
@@ -1057,8 +1055,8 @@ void ViGEm::Bus::Targets::EmulationTargetXUSB::ProcessPendingNotification(WDFQUE
|
||||
size_t bufferLength;
|
||||
PXUSB_REQUEST_NOTIFICATION notify = nullptr;
|
||||
|
||||
TraceDbg(TRACE_BUSENUM, "%!FUNC! Entry");
|
||||
|
||||
FuncEntry(TRACE_BUSENUM);
|
||||
|
||||
//
|
||||
// Loop through and drain all queued requests until buffer is empty
|
||||
//
|
||||
@@ -1103,7 +1101,7 @@ void ViGEm::Bus::Targets::EmulationTargetXUSB::ProcessPendingNotification(WDFQUE
|
||||
reinterpret_cast<PVOID*>(¬ify),
|
||||
nullptr
|
||||
)))
|
||||
{
|
||||
{
|
||||
notify->Size = sizeof(XUSB_REQUEST_NOTIFICATION);
|
||||
notify->SerialNo = this->_SerialNo;
|
||||
notify->LedNumber = this->_LedNumber; // Report last cached value
|
||||
@@ -1119,11 +1117,11 @@ void ViGEm::Bus::Targets::EmulationTargetXUSB::ProcessPendingNotification(WDFQUE
|
||||
notify->SmallMotor = this->_Rumble[4]; // Cached value
|
||||
}
|
||||
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
DumpAsHex("!! XUSB_REQUEST_NOTIFICATION",
|
||||
notify,
|
||||
sizeof(XUSB_REQUEST_NOTIFICATION)
|
||||
);
|
||||
|
||||
|
||||
WdfRequestCompleteWithInformation(request, status, notify->Size);
|
||||
}
|
||||
|
||||
@@ -1138,5 +1136,5 @@ void ViGEm::Bus::Targets::EmulationTargetXUSB::ProcessPendingNotification(WDFQUE
|
||||
}
|
||||
}
|
||||
|
||||
TraceDbg(TRACE_BUSENUM, "%!FUNC! Exit");
|
||||
TraceVerbose(TRACE_BUSENUM, "%!FUNC! Exit");
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
#include "XusbPdo.hpp"
|
||||
#include "Ds4Pdo.hpp"
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
#pragma alloc_text (PAGE, Bus_PlugInDevice)
|
||||
#pragma alloc_text (PAGE, Bus_UnPlugDevice)
|
||||
@@ -84,7 +82,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!", status);
|
||||
return status;
|
||||
@@ -92,7 +90,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
|
||||
if ((sizeof(VIGEM_PLUGIN_TARGET) != plugIn->Size) || (length != plugIn->Size))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"sizeof(VIGEM_PLUGIN_TARGET) buffer size mismatch [%d != %d]",
|
||||
sizeof(VIGEM_PLUGIN_TARGET), plugIn->Size);
|
||||
@@ -101,7 +99,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
|
||||
if (plugIn->SerialNo == 0)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"Serial no. 0 not allowed");
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
@@ -112,7 +110,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
fileObject = WdfRequestGetFileObject(Request);
|
||||
if (fileObject == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfRequestGetFileObject failed to fetch WDFFILEOBJECT from request 0x%p",
|
||||
Request);
|
||||
@@ -122,7 +120,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
pFileData = FileObjectGetData(fileObject);
|
||||
if (pFileData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"FileObjectGetData failed to get context data for 0x%p",
|
||||
fileObject);
|
||||
@@ -199,7 +197,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfChildListAddOrUpdateChildDescriptionAsPresent failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -214,7 +212,7 @@ EXTERN_C NTSTATUS Bus_PlugInDevice(
|
||||
{
|
||||
status = STATUS_INVALID_PARAMETER;
|
||||
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"The described PDO already exists (%!STATUS!)",
|
||||
status);
|
||||
@@ -263,7 +261,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfRequestRetrieveInputBuffer failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -272,7 +270,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
|
||||
if ((sizeof(VIGEM_UNPLUG_TARGET) != unPlug->Size) || (length != unPlug->Size))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"sizeof(VIGEM_UNPLUG_TARGET) buffer size mismatch [%d != %d]",
|
||||
sizeof(VIGEM_UNPLUG_TARGET), unPlug->Size);
|
||||
@@ -285,7 +283,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
fileObject = WdfRequestGetFileObject(Request);
|
||||
if (fileObject == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfRequestGetFileObject failed to fetch WDFFILEOBJECT from request 0x%p",
|
||||
Request);
|
||||
@@ -295,14 +293,14 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
pFileData = FileObjectGetData(fileObject);
|
||||
if (pFileData == NULL)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"FileObjectGetData failed to get context data for 0x%p",
|
||||
fileObject);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"Starting child list traversal");
|
||||
|
||||
@@ -322,7 +320,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
// Error or no more children, end loop
|
||||
if (!NT_SUCCESS(status) || status == STATUS_NO_MORE_ENTRIES)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"WdfChildListRetrieveNextDevice returned with status %!STATUS!",
|
||||
status);
|
||||
@@ -332,7 +330,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
// If unable to retrieve device
|
||||
if (childInfo.Status != WdfChildListRetrieveDeviceSuccess)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"childInfo.Status = %d",
|
||||
childInfo.Status);
|
||||
@@ -342,7 +340,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
// Child isn't the one we looked for, skip
|
||||
if (!unplugAll && description.SerialNo != unPlug->SerialNo)
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"Seeking serial mismatch: %d != %d",
|
||||
description.SerialNo,
|
||||
@@ -350,7 +348,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
continue;
|
||||
}
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"description.SessionId = %d, pFileData->SessionId = %d",
|
||||
description.SessionId,
|
||||
@@ -363,7 +361,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
status = WdfChildListUpdateChildDescriptionAsMissing(list, &description.Header);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_ERROR,
|
||||
TraceError(
|
||||
TRACE_BUSENUM,
|
||||
"WdfChildListUpdateChildDescriptionAsMissing failed with status %!STATUS!",
|
||||
status);
|
||||
@@ -373,7 +371,7 @@ EXTERN_C NTSTATUS Bus_UnPlugDevice(
|
||||
|
||||
WdfChildListEndIteration(list, &iterator);
|
||||
|
||||
TraceEvents(TRACE_LEVEL_VERBOSE,
|
||||
TraceVerbose(
|
||||
TRACE_BUSENUM,
|
||||
"Finished child list traversal");
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "Driver.h"
|
||||
#include "EmulationTargetPDO.hpp"
|
||||
|
||||
#include "Debugging.hpp"
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
#pragma alloc_text(PAGE, Bus_EvtDeviceListCreatePdo)
|
||||
#endif
|
||||
|
||||
24
sys/trace.h
24
sys/trace.h
@@ -44,6 +44,7 @@
|
||||
ViGEmBusTraceGuid, (c5ce18fe,27bd,4049,b0b4,8a47cab1dcd9), \
|
||||
\
|
||||
WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
|
||||
WPP_DEFINE_BIT(DMF_TRACE) \
|
||||
WPP_DEFINE_BIT(TRACE_BUSENUM) \
|
||||
WPP_DEFINE_BIT(TRACE_BUSPDO) \
|
||||
WPP_DEFINE_BIT(TRACE_BYTEARRAY) \
|
||||
@@ -73,9 +74,28 @@
|
||||
// This comment block is scanned by the trace preprocessor to define our
|
||||
// Trace function.
|
||||
//
|
||||
// USEPREFIX and USESUFFIX strip all trailing whitespace, so we need to surround
|
||||
// FuncExit messages with brackets
|
||||
//
|
||||
// begin_wpp config
|
||||
// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
|
||||
// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
|
||||
// FUNC TraceDbg{LEVEL=TRACE_LEVEL_INFORMATION}(FLAGS, MSG, ...);
|
||||
// FUNC FuncEntry{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// FUNC FuncEntryArguments{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExit{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExitVoid{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// FUNC TraceError{LEVEL=TRACE_LEVEL_ERROR}(FLAGS, MSG, ...);
|
||||
// FUNC TraceInformation{LEVEL=TRACE_LEVEL_INFORMATION}(FLAGS, MSG, ...);
|
||||
// FUNC TraceVerbose{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
|
||||
// FUNC FuncExitNoReturn{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
|
||||
// USEPREFIX(FuncEntry, "%!STDPREFIX! [%!FUNC!] --> Entry");
|
||||
// USEPREFIX(FuncEntryArguments, "%!STDPREFIX! [%!FUNC!] --> Entry <");
|
||||
// USEPREFIX(FuncExit, "%!STDPREFIX! [%!FUNC!] <-- Exit <");
|
||||
// USESUFFIX(FuncExit, ">");
|
||||
// USEPREFIX(FuncExitVoid, "%!STDPREFIX! [%!FUNC!] <-- Exit");
|
||||
// USEPREFIX(TraceError, "%!STDPREFIX! [%!FUNC!] ERROR:");
|
||||
// USEPREFIX(TraceEvents, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(TraceInformation, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(TraceVerbose, "%!STDPREFIX! [%!FUNC!] ");
|
||||
// USEPREFIX(FuncExitNoReturn, "%!STDPREFIX! [%!FUNC!] <--");
|
||||
// end_wpp
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user