[USB-BRINGUP]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Wed, 28 Dec 2011 17:18:56 +0000 (17:18 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Wed, 28 Dec 2011 17:18:56 +0000 (17:18 +0000)
- Fix up / down button detection
- Fix move detection. Mouse changes are now detected
- Mouse does not yet work in Vbox, as mouclass driver is for unknown reasons not connecting to the mouhid, needs to be investigated
- Tested in VBox 4.1.4 + ReactOS mouhid.sys

svn path=/branches/usb-bringup/; revision=54775

drivers/hid/mouhid/mouhid.c

index d58c51a..4087b4b 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "mouhid.h"
 
 
 #include "mouhid.h"
 
-static USHORT MouHid_ButtonDownFlags[] = 
+static USHORT MouHid_ButtonUpFlags[] = 
 {
     MOUSE_LEFT_BUTTON_DOWN,
     MOUSE_RIGHT_BUTTON_DOWN,
 {
     MOUSE_LEFT_BUTTON_DOWN,
     MOUSE_RIGHT_BUTTON_DOWN,
@@ -19,7 +19,7 @@ static USHORT MouHid_ButtonDownFlags[] =
     MOUSE_BUTTON_5_DOWN
 };
 
     MOUSE_BUTTON_5_DOWN
 };
 
-static USHORT MouHid_ButtonUpFlags[] = 
+static USHORT MouHid_ButtonDownFlags[] = 
 {
     MOUSE_LEFT_BUTTON_UP,
     MOUSE_RIGHT_BUTTON_UP,
 {
     MOUSE_LEFT_BUTTON_UP,
     MOUSE_RIGHT_BUTTON_UP,
@@ -41,12 +41,12 @@ MouHid_GetButtonMove(
     *LastY = 0;
 
     /* get scaled usage value x */
     *LastY = 0;
 
     /* get scaled usage value x */
-    Status =  HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_GENERIC_X, (PLONG)&LastX, DeviceExtension->PreparsedData, DeviceExtension->Report, DeviceExtension->ReportLength);
+    Status =  HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_GENERIC_X, (PLONG)LastX, DeviceExtension->PreparsedData, DeviceExtension->Report, DeviceExtension->ReportLength);
     /* FIXME handle error */
     ASSERT(Status == HIDP_STATUS_SUCCESS);
 
     /* get scaled usage value y */
     /* FIXME handle error */
     ASSERT(Status == HIDP_STATUS_SUCCESS);
 
     /* get scaled usage value y */
-    Status =  HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_GENERIC_Y, (PLONG)&LastY, DeviceExtension->PreparsedData, DeviceExtension->Report, DeviceExtension->ReportLength);
+    Status =  HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_GENERIC_Y, (PLONG)LastY, DeviceExtension->PreparsedData, DeviceExtension->Report, DeviceExtension->ReportLength);
     /* FIXME handle error */
     ASSERT(Status == HIDP_STATUS_SUCCESS);
 
     /* FIXME handle error */
     ASSERT(Status == HIDP_STATUS_SUCCESS);
 
@@ -225,7 +225,7 @@ MouHid_ReadCompletion(
         }
     }
 
         }
     }
 
-    DPRINT1("[MOUHID] LastX %lu LastY %lu Flags %x ButtonData %x\n", MouseInputData.LastX, MouseInputData.LastY, MouseInputData.ButtonFlags, MouseInputData.ButtonData);
+    DPRINT1("[MOUHID] LastX %ld LastY %ld Flags %x ButtonData %x\n", MouseInputData.LastX, MouseInputData.LastY, MouseInputData.ButtonFlags, MouseInputData.ButtonData);
 
     /* dispatch mouse action */
     MouHid_DispatchInputData(DeviceExtension, &MouseInputData);
 
     /* dispatch mouse action */
     MouHid_DispatchInputData(DeviceExtension, &MouseInputData);
@@ -412,6 +412,8 @@ MouHid_DeviceControl(
     /* get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     /* get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
+    DPRINT1("[MOUHID] DeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
+
     /* get device extension */
     DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
     /* get device extension */
     DeviceExtension = (PMOUHID_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
@@ -750,6 +752,7 @@ MouHid_Pnp(
 
     /* get current irp stack */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     /* get current irp stack */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
+    DPRINT1("[MOUHID] IRP_MJ_PNP Request: %x\n", IoStack->MinorFunction);
 
     if (IoStack->MinorFunction == IRP_MN_STOP_DEVICE || IoStack->MinorFunction == IRP_MN_CANCEL_REMOVE_DEVICE || IoStack->MinorFunction == IRP_MN_QUERY_STOP_DEVICE || IoStack->MinorFunction == IRP_MN_CANCEL_STOP_DEVICE)
     {
 
     if (IoStack->MinorFunction == IRP_MN_STOP_DEVICE || IoStack->MinorFunction == IRP_MN_CANCEL_REMOVE_DEVICE || IoStack->MinorFunction == IRP_MN_QUERY_STOP_DEVICE || IoStack->MinorFunction == IRP_MN_CANCEL_STOP_DEVICE)
     {
@@ -896,7 +899,6 @@ MouHid_Unload(
     IN PDRIVER_OBJECT DriverObject)
 {
     UNIMPLEMENTED
     IN PDRIVER_OBJECT DriverObject)
 {
     UNIMPLEMENTED
-    ASSERT(FALSE);
 }
 
 
 }