UsbDk: Drop ping IOCTL and children dump logic
Debugging code removed. Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
parent
2bdf99483e
commit
653ce6b4ad
8 changed files with 0 additions and 92 deletions
|
|
@ -53,28 +53,6 @@ void CUsbDkControlDeviceQueue::DeviceControl(WDFQUEUE Queue,
|
|||
|
||||
switch (IoControlCode)
|
||||
{
|
||||
case IOCTL_USBDK_PING:
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_CONTROLDEVICE, "Called IOCTL_USBDK_PING\n");
|
||||
|
||||
//TEMP: Dump children devices
|
||||
{
|
||||
auto devExt = UsbDkControlGetContext(WdfIoQueueGetDevice(Queue));
|
||||
devExt->UsbDkControl->DumpAllChildren();
|
||||
}
|
||||
|
||||
LPTSTR outBuff;
|
||||
size_t outBuffLen;
|
||||
status = WdfRequestRetrieveOutputBuffer(Request, 0, (PVOID *)&outBuff, &outBuffLen);
|
||||
if (!NT_SUCCESS(status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
wcsncpy(outBuff, TEXT("Pong!"), outBuffLen/sizeof(TCHAR));
|
||||
WdfRequestSetInformation(Request, outBuffLen);
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_USBDK_COUNT_DEVICES:
|
||||
{
|
||||
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_CONTROLDEVICE, "Called IOCTL_USBDK_COUNT_DEVICES\n");
|
||||
|
|
@ -187,13 +165,6 @@ NTSTATUS CUsbDkControlDeviceQueue::ResetDevice(WDFREQUEST Request, WDFQUEUE Queu
|
|||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void CUsbDkControlDevice::DumpAllChildren()
|
||||
{
|
||||
UsbDevicesForEachIf(ConstTrue,
|
||||
[](CUsbDkChildDevice *Child) -> bool { Child->Dump(); return true; });
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
ULONG CUsbDkControlDevice::CountDevices()
|
||||
{
|
||||
ULONG numberDevices = 0;
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ public:
|
|||
void UnregisterFilter(CUsbDkFilterDevice &FilterDevice)
|
||||
{ m_FilterDevices.Remove(&FilterDevice); }
|
||||
|
||||
//TODO: Temporary, until enumeration implementation
|
||||
void DumpAllChildren();
|
||||
ULONG CountDevices();
|
||||
bool EnumerateDevices(USB_DK_DEVICE_ID *outBuff, size_t numberAllocatedDevices, size_t &numberExistingDevices);
|
||||
NTSTATUS ResetUsbDevice(const USB_DK_DEVICE_ID &DeviceId);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ DEFINE_GUID (GUID_DEVINTERFACE_UsbDk,
|
|||
#define USBDK_DEVICE_TYPE 50000
|
||||
|
||||
// UsbDk Control Device IOCTLs
|
||||
#define IOCTL_USBDK_PING \
|
||||
ULONG(CTL_CODE( USBDK_DEVICE_TYPE, 0x850, METHOD_BUFFERED, FILE_READ_ACCESS ))
|
||||
#define IOCTL_USBDK_COUNT_DEVICES \
|
||||
ULONG(CTL_CODE( USBDK_DEVICE_TYPE, 0x851, METHOD_BUFFERED, FILE_READ_ACCESS ))
|
||||
#define IOCTL_USBDK_ENUM_DEVICES \
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ void ShowUsage()
|
|||
tcout << endl;
|
||||
tcout << TEXT("UsbDkController -i - install UsbDk driver") << endl;
|
||||
tcout << TEXT("UsbDkController -u - uninstall UsbDk driver") << endl;
|
||||
tcout << TEXT("UsbDkController -p - TEMP: ping driver (verify control device is functional)") << endl;
|
||||
tcout << TEXT("UsbDkController -n - enumerate USB devices") << endl;
|
||||
tcout << TEXT("UsbDkController -r ID SN - Reset USB device by ID and serial number") << endl;
|
||||
tcout << endl;
|
||||
|
|
@ -58,21 +57,6 @@ int __cdecl _tmain(int argc, _TCHAR* argv[])
|
|||
tcout << TEXT("UsbDk driver uninstall failed") << endl;
|
||||
}
|
||||
}
|
||||
else if (_tcsicmp(L"-p", argv[1]) == 0)
|
||||
{
|
||||
//TODO: Ping logic is temporary, to be removed after enumeration
|
||||
//logic implemented
|
||||
TCHAR Reply[10];
|
||||
tcout << TEXT("Pinging UsbDk driver") << endl;
|
||||
if (PingDriver(Reply, TBUF_SIZEOF(Reply)))
|
||||
{
|
||||
tcout << TEXT("UsbDk driver replied \"") << Reply << TEXT("\"") << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcout << TEXT("UsbDk ping failed") << endl;
|
||||
}
|
||||
}
|
||||
else if (_tcsicmp(L"-n", argv[1]) == 0)
|
||||
{
|
||||
PUSB_DK_DEVICE_ID devicesArray;
|
||||
|
|
|
|||
|
|
@ -27,27 +27,6 @@ UsbDkDriverAccess::~UsbDkDriverAccess()
|
|||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
tstring UsbDkDriverAccess::Ping()
|
||||
{
|
||||
std::vector<TCHAR> reply(10);
|
||||
DWORD replySize;
|
||||
|
||||
if(!DeviceIoControl(m_hDriver,
|
||||
IOCTL_USBDK_PING,
|
||||
nullptr,
|
||||
0,
|
||||
&reply[0],
|
||||
reply.size() * sizeof(TCHAR),
|
||||
&replySize,
|
||||
NULL))
|
||||
{
|
||||
throw UsbDkDriverAccessException(TEXT("Ping failed"));
|
||||
}
|
||||
|
||||
return tstring(reply.begin(), reply.end());
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
void UsbDkDriverAccess::GetDevicesList(PUSB_DK_DEVICE_ID &DevicesArray, ULONG &NumberDevice)
|
||||
{
|
||||
DevicesArray = nullptr;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ public:
|
|||
UsbDkDriverAccess();
|
||||
virtual ~UsbDkDriverAccess();
|
||||
|
||||
tstring Ping();
|
||||
void GetDevicesList(PUSB_DK_DEVICE_ID &DevicesArray, ULONG &NumberDevice);
|
||||
static void ReleaseDeviceList(PUSB_DK_DEVICE_ID DevicesArray);
|
||||
bool ResetDevice(USB_DK_DEVICE_ID &DeviceID);
|
||||
|
|
|
|||
|
|
@ -47,26 +47,6 @@ BOOL UninstallDriver()
|
|||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
BOOL PingDriver(LPTSTR ReplyBuffer, size_t ReplyBufferLen)
|
||||
{
|
||||
try
|
||||
{
|
||||
UsbDkDriverAccess driver;
|
||||
auto reply = driver.Ping();
|
||||
|
||||
wcsncpy_s(ReplyBuffer, ReplyBufferLen, reply.c_str(), ReplyBufferLen);
|
||||
ReplyBuffer[ReplyBufferLen - 1] = TEXT('\0');
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
catch (const exception &e)
|
||||
{
|
||||
printExceptionString(e.what());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
BOOL GetDevicesList(PUSB_DK_DEVICE_ID *DevicesArray, ULONG *NumberDevices)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ extern "C"
|
|||
{
|
||||
DLL InstallResult InstallDriver();
|
||||
DLL BOOL UninstallDriver();
|
||||
DLL BOOL PingDriver(LPTSTR ReplyBuffer, size_t ReplyBufferLen);
|
||||
DLL BOOL GetDevicesList(PUSB_DK_DEVICE_ID *DevicesArray, ULONG *NumberDevices);
|
||||
DLL void ReleaseDeviceList(PUSB_DK_DEVICE_ID DevicesArray);
|
||||
DLL BOOL ResetDevice(PUSB_DK_DEVICE_ID DeviceID);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue