Author: janderwald
Date: Wed Feb 1 03:02:25 2012
New Revision: 55361
URL:
http://svn.reactos.org/svn/reactos?rev=55361&view=rev
Log:
[HIDUSB]
- Add support function to detect when the boot protocol is still active
Modified:
branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.c
branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.h
Modified: branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/hid/h…
==============================================================================
--- branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.c [iso-8859-1] Wed Feb 1
03:02:25 2012
@@ -1269,7 +1269,7 @@
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 @@
}
+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_SetIdle(DeviceObject);
+ Hid_GetProtocol(DeviceObject);
//
// move to next descriptor
Modified: branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/hid/h…
==============================================================================
--- branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.h [iso-8859-1] Wed Feb 1
03:02:25 2012
@@ -84,3 +84,5 @@
IN PURB Urb);
#define USB_SET_IDLE_REQUEST 0xA
+#define USB_GET_PROTOCOL_REQUEST 0x3
+