Implemented USBD_ParseConfigurationDescriptorEx and USBD_ParseDescriptors for bulkusb driver testing.

svn path=/trunk/; revision=17382
This commit is contained in:
James Tabor 2005-08-14 13:18:50 +00:00
parent 6f3cd1ce3e
commit 7d093589b4

View file

@ -21,7 +21,7 @@
* USBD_GetPdoRegistryParameters (implemented) * USBD_GetPdoRegistryParameters (implemented)
*/ */
#include <windows.h> #include <ddk/ntddk.h>
#include <ddk/usbdi.h> #include <ddk/usbdi.h>
#ifndef PLUGPLAY_REGKEY_DRIVER #ifndef PLUGPLAY_REGKEY_DRIVER
#define PLUGPLAY_REGKEY_DRIVER 2 #define PLUGPLAY_REGKEY_DRIVER 2
@ -368,6 +368,31 @@ USBD_GetInterfaceLength(
return Length; return Length;
} }
/*
* @unimplemented
*/
PUSB_COMMON_DESCRIPTOR STDCALL
USBD_ParseDescriptors(
PVOID DescriptorBuffer,
ULONG TotalLength,
PVOID StartPosition,
LONG DescriptorType
)
{
PUSB_COMMON_DESCRIPTOR PComDes = StartPosition;
while(PComDes)
{
if (PComDes >= (PUSB_COMMON_DESCRIPTOR)
((PLONG)DescriptorBuffer + TotalLength) ) break;
if (PComDes->bDescriptorType == DescriptorType) return PComDes;
if (PComDes->bLength == 0) break;
PComDes = PComDes + PComDes->bLength;
}
return NULL;
}
/* /*
* @unimplemented * @unimplemented
*/ */
@ -382,7 +407,46 @@ USBD_ParseConfigurationDescriptorEx(
LONG InterfaceProtocol LONG InterfaceProtocol
) )
{ {
return NULL; int x = 0;
PUSB_INTERFACE_DESCRIPTOR UsbInterfaceDesc = StartPosition;
while(UsbInterfaceDesc)
{
UsbInterfaceDesc = (PUSB_INTERFACE_DESCRIPTOR)
USBD_ParseDescriptors(ConfigurationDescriptor,
ConfigurationDescriptor->wTotalLength,
UsbInterfaceDesc,
USB_INTERFACE_DESCRIPTOR_TYPE);
if (!UsbInterfaceDesc) break;
if(InterfaceNumber != -1)
{
if(InterfaceNumber != UsbInterfaceDesc->bInterfaceNumber) x = 1;
}
if(AlternateSetting != -1)
{
if(AlternateSetting != UsbInterfaceDesc->bAlternateSetting) x = 1;
}
if(InterfaceClass != -1)
{
if(InterfaceClass != UsbInterfaceDesc->bInterfaceClass) x = 1;
}
if(InterfaceSubClass != -1)
{
if(InterfaceSubClass != UsbInterfaceDesc->bInterfaceSubClass) x = 1;
}
if(InterfaceProtocol != -1)
{
if(InterfaceProtocol != UsbInterfaceDesc->bInterfaceProtocol) x = 1;
}
if (!x) return UsbInterfaceDesc;
if (UsbInterfaceDesc->bLength == 0) break;
UsbInterfaceDesc = UsbInterfaceDesc + UsbInterfaceDesc->bLength;
}
return NULL;
} }
/* /*
@ -400,19 +464,6 @@ USBD_ParseConfigurationDescriptor(
-1, -1, -1); -1, -1, -1);
} }
/*
* @unimplemented
*/
PUSB_COMMON_DESCRIPTOR STDCALL
USBD_ParseDescriptors(
PVOID DescriptorBuffer,
ULONG TotalLength,
PVOID StartPosition,
LONG DescriptorType
)
{
return NULL;
}
/* /*
* @implemented * @implemented