Author: janderwald
Date: Tue Jan 31 18:37:49 2012
New Revision: 55356
URL:
http://svn.reactos.org/svn/reactos?rev=55356&view=rev
Log:
[HIDCLASS]
- Implement set idle request. The device should only send data when there is actual data.
May also fix the mouse debug flood when mouse is ejected
- Not yet supported in OHCI
- Add missing constants
Modified:
branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.c
branches/usb-bringup-trunk/drivers/hid/hidusb/hidusb.h
branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp
branches/usb-bringup-trunk/include/ddk/hidport.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] Tue Jan 31
18:37:49 2012
@@ -1230,6 +1230,72 @@
return Status;
}
+NTSTATUS
+Hid_SetIdle(
+ IN PDEVICE_OBJECT DeviceObject)
+{
+ PHID_USB_DEVICE_EXTENSION HidDeviceExtension;
+ PHID_DEVICE_EXTENSION DeviceExtension;
+ PURB Urb;
+ NTSTATUS Status;
+
+ //
+ // 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),
+ 0,
+ HID_REPORT_DESCRIPTOR_TYPE,
+ USB_SET_IDLE_REQUEST, // HID_SET_IDLE
+ 0,
+ 0,
+ NULL,
+ NULL,
+ 0,
+ NULL);
+
+ //
+ // dispatch urb
+ //
+ Status = Hid_DispatchUrb(DeviceObject, Urb);
+
+ //
+ // free urb
+ //
+ ExFreePool(Urb);
+
+ //
+ // print status
+ //
+ DPRINT1("Status %x\n", Status);
+ return Status;
+}
+
+
NTSTATUS
Hid_PnpStart(
@@ -1332,6 +1398,12 @@
ASSERT(InterfaceDescriptor->bInterfaceClass == USB_DEVICE_CLASS_HUMAN_INTERFACE);
ASSERT(InterfaceDescriptor->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE);
ASSERT(InterfaceDescriptor->bLength == sizeof(USB_INTERFACE_DESCRIPTOR));
+
+ //
+ // now set the device idle
+ //
+ Hid_SetIdle(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] Tue Jan 31
18:37:49 2012
@@ -11,6 +11,8 @@
#include <usbioctl.h>
#include <usb.h>
#include <usbdlib.h>
+
+#include <hidport.h>
typedef struct
{
@@ -80,3 +82,5 @@
Hid_DispatchUrb(
IN PDEVICE_OBJECT DeviceObject,
IN PURB Urb);
+
+#define USB_SET_IDLE_REQUEST 0xA
Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp [iso-8859-1] Tue Jan
31 18:37:49 2012
@@ -1731,7 +1731,10 @@
if (Urb->UrbControlVendorClassRequest.TransferBufferLength == 0)
{
- DPRINT1("Invalid request length\n");
+ //
+ // FIXME: support requests w/o data stage
+ //;
+ ASSERT(FALSE);
return STATUS_SUCCESS;
}
Modified: branches/usb-bringup-trunk/include/ddk/hidport.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/include/ddk/h…
==============================================================================
--- branches/usb-bringup-trunk/include/ddk/hidport.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/include/ddk/hidport.h [iso-8859-1] Tue Jan 31 18:37:49
2012
@@ -47,6 +47,11 @@
#include <poppack.h>
+#define HID_HID_DESCRIPTOR_TYPE 0x21
+#define HID_REPORT_DESCRIPTOR_TYPE 0x22
+#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
+
+
typedef
VOID