- Add support function to detect when the boot protocol is still active

svn path=/branches/usb-bringup-trunk/; revision=55361
This commit is contained in:
Johannes Anderwald 2012-02-01 03:02:25 +00:00
parent ba8cbe2e17
commit 2cc2771f69
2 changed files with 74 additions and 1 deletions

View file

@ -1269,7 +1269,7 @@ Hid_SetIdle(
URB_FUNCTION_CLASS_INTERFACE,
sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST),
0,
HID_REPORT_DESCRIPTOR_TYPE,
0,
USB_SET_IDLE_REQUEST, // HID_SET_IDLE
0,
0,
@ -1296,6 +1296,76 @@ Hid_SetIdle(
}
NTSTATUS
Hid_GetProtocol(
IN PDEVICE_OBJECT DeviceObject)
{
PHID_USB_DEVICE_EXTENSION HidDeviceExtension;
PHID_DEVICE_EXTENSION DeviceExtension;
PURB Urb;
NTSTATUS Status;
UCHAR Protocol[1];
//
// get device extension
//
DeviceExtension = (PHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
HidDeviceExtension = (PHID_USB_DEVICE_EXTENSION)DeviceExtension->MiniDeviceExtension;
//
// allocate urb
//
Urb = ExAllocatePool(NonPagedPool, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
if (!Urb)
{
//
// no memory
//
return STATUS_INSUFFICIENT_RESOURCES;
}
//
// zero urb
//
RtlZeroMemory(Urb, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
//
// format urb
//
UsbBuildVendorRequest(Urb,
URB_FUNCTION_CLASS_INTERFACE,
sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST),
USBD_TRANSFER_DIRECTION_IN,
0,
USB_GET_PROTOCOL_REQUEST,
0,
0,
Protocol,
NULL,
1,
NULL);
Protocol[0] = 0xFF;
//
// dispatch urb
//
Status = Hid_DispatchUrb(DeviceObject, Urb);
//
// free urb
//
ExFreePool(Urb);
//
// print status
//
DPRINT1("Status %x Protocol %x\n", Status, Protocol[0] & 0xFF);
//
// assert when boot protocol is still active
//
ASSERT(Protocol[0] == 0x1);
return Status;
}
NTSTATUS
Hid_PnpStart(
@ -1404,6 +1474,7 @@ Hid_PnpStart(
//
Hid_SetIdle(DeviceObject);
Hid_GetProtocol(DeviceObject);
//
// move to next descriptor

View file

@ -84,3 +84,5 @@ Hid_DispatchUrb(
IN PURB Urb);
#define USB_SET_IDLE_REQUEST 0xA
#define USB_GET_PROTOCOL_REQUEST 0x3