UsbDk: Introduce UsbDeviceIsHub helper

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
Dmitry Fleytman 2014-04-24 23:24:08 +03:00
parent 527a0b774f
commit 267311dcfe
2 changed files with 16 additions and 0 deletions

View file

@ -249,6 +249,20 @@ NTSTATUS CWdmUsbDeviceAccess::GetConfigurationDescriptor(UCHAR Index, USB_CONFIG
return STATUS_SUCCESS;
}
bool UsbDkWdmUsbDeviceIsHub(PDEVICE_OBJECT PDO)
{
CWdmUsbDeviceAccess pdoAccess(PDO);
USB_DEVICE_DESCRIPTOR DevDescr;
if (!NT_SUCCESS(pdoAccess.GetDeviceDescriptor(DevDescr)))
{
TraceEvents(TRACE_LEVEL_ERROR, TRACE_DEVACCESS, "%!FUNC! Cannot query device descriptor");
return false;
}
return (DevDescr.bDeviceClass == USB_DEVICE_CLASS_HUB);
}
bool UsbDkGetWdmDeviceIdentity(const PDEVICE_OBJECT PDO,
CObjHolder<CRegText> *DeviceID,
CObjHolder<CRegText> *InstanceID)

View file

@ -107,6 +107,8 @@ bool UsbDkGetWdmDeviceIdentity(const PDEVICE_OBJECT PDO,
CObjHolder<CRegText> *DeviceID,
CObjHolder<CRegText> *InstanceID = nullptr);
bool UsbDkWdmUsbDeviceIsHub(PDEVICE_OBJECT PDO);
template <typename TBuffer>
void UsbDkBuildDescriptorRequest(URB &Urb, UCHAR Type, UCHAR Index, TBuffer &Buffer, ULONG BufferLength = sizeof(TBuffer))
{