Author: hpoussin
Date: Fri May 5 14:12:59 2006
New Revision: 21797
URL:
http://svn.reactos.ru/svn/reactos?rev=21797&view=rev
Log:
Legacy device objects created for USB keyboard and mouse support should be treated as
FDOs, not PDOs.
Modified:
trunk/reactos/drivers/usb/miniport/common/fdo.c
trunk/reactos/drivers/usb/miniport/common/main.c
Modified: trunk/reactos/drivers/usb/miniport/common/fdo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/common…
==============================================================================
--- trunk/reactos/drivers/usb/miniport/common/fdo.c (original)
+++ trunk/reactos/drivers/usb/miniport/common/fdo.c Fri May 5 14:12:59 2006
@@ -211,7 +211,11 @@
{
case IRP_MN_START_DEVICE: /* 0x00 */
{
- Status = ForwardIrpAndWait(DeviceObject, Irp);
+ if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject
!= NULL)
+ /* HACK due to the lack of lower device for legacy USB keyboard and mouse */
+ Status = ForwardIrpAndWait(DeviceObject, Irp);
+ else
+ Status = STATUS_SUCCESS;
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
Status = UsbMpFdoStartDevice(DeviceObject, Irp);
break;
@@ -227,7 +231,11 @@
case IRP_MN_STOP_DEVICE: /* 0x04 */
case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */
{
- Status = ForwardIrpAndWait(DeviceObject, Irp);
+ if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->NextDeviceObject
!= NULL)
+ /* HACK due to the lack of lower device for legacy USB keyboard and mouse */
+ Status = ForwardIrpAndWait(DeviceObject, Irp);
+ else
+ Status = STATUS_SUCCESS;
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
Status = STATUS_SUCCESS;
IoDeleteDevice(DeviceObject); // just delete device for now
Modified: trunk/reactos/drivers/usb/miniport/common/main.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/common…
==============================================================================
--- trunk/reactos/drivers/usb/miniport/common/main.c (original)
+++ trunk/reactos/drivers/usb/miniport/common/main.c Fri May 5 14:12:59 2006
@@ -118,6 +118,7 @@
IN PDEVICE_OBJECT Pdo)
{
UNICODE_STRING DeviceName =
RTL_CONSTANT_STRING(L"\\Device\\KeyboardPortUSB");
+ PUSBMP_DEVICE_EXTENSION DeviceExtension;
PDEVICE_OBJECT Fdo;
NTSTATUS Status;
@@ -129,7 +130,7 @@
}
Status = IoCreateDevice(DriverObject,
- 8, // debug
+ sizeof(USBMP_DEVICE_EXTENSION),
&DeviceName,
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_SECURE_OPEN,
@@ -141,6 +142,9 @@
DPRINT1("USBMP: IoCreateDevice() for usb keyboard driver failed with status
0x%08lx\n", Status);
return Status;
}
+ DeviceExtension = (PUSBMP_DEVICE_EXTENSION)Fdo->DeviceExtension;
+ RtlZeroMemory(DeviceExtension, sizeof(USBMP_DEVICE_EXTENSION));
+ DeviceExtension->IsFDO = TRUE;
KeyboardFdo = Fdo;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
DPRINT("USBMP: Created keyboard Fdo: %p\n", Fdo);
@@ -154,6 +158,7 @@
IN PDEVICE_OBJECT Pdo)
{
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\PointerPortUSB");
+ PUSBMP_DEVICE_EXTENSION DeviceExtension;
PDEVICE_OBJECT Fdo;
NTSTATUS Status;
@@ -165,7 +170,7 @@
}
Status = IoCreateDevice(DriverObject,
- 8, // debug
+ sizeof(USBMP_DEVICE_EXTENSION),
&DeviceName,
FILE_DEVICE_MOUSE,
FILE_DEVICE_SECURE_OPEN,
@@ -177,6 +182,9 @@
DPRINT1("USBMP: IoCreateDevice() for usb mouse driver failed with status
0x%08lx\n", Status);
return Status;
}
+ DeviceExtension = (PUSBMP_DEVICE_EXTENSION)Fdo->DeviceExtension;
+ RtlZeroMemory(DeviceExtension, sizeof(USBMP_DEVICE_EXTENSION));
+ DeviceExtension->IsFDO = TRUE;
MouseFdo = Fdo;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
DPRINT("USBMP: Created mouse Fdo: %p\n", Fdo);