mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 04:26:32 +00:00
[HIDUSB]
- 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:
parent
ba8cbe2e17
commit
2cc2771f69
2 changed files with 74 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -84,3 +84,5 @@ Hid_DispatchUrb(
|
|||
IN PURB Urb);
|
||||
|
||||
#define USB_SET_IDLE_REQUEST 0xA
|
||||
#define USB_GET_PROTOCOL_REQUEST 0x3
|
||||
|
||||
|
|
Loading…
Reference in a new issue