Author: janderwald
Date: Fri May 24 17:36:14 2013
New Revision: 59080
URL:
http://svn.reactos.org/svn/reactos?rev=59080&view=rev
Log:
[HIDCLASS]
- Implement HidClass_Power
[USBCCGP]
- Remove superflous spaces
- Implement IRP_MJ_SYSTEM_CONTROL
- Fix bug in IRP_MJ_POWER handler
- Add driver unload routine
[USBEHCI,USBOHCI, USBUHCI]
- Support Win2k3 usbhub.sys, which uses null device handle for the root usb hub
- Based on a patch by Thomas Faber
Modified:
trunk/reactos/drivers/hid/hidclass/hidclass.c
trunk/reactos/drivers/hid/hidclass/precomp.h
trunk/reactos/drivers/usb/usbccgp/fdo.c
trunk/reactos/drivers/usb/usbccgp/pdo.c
trunk/reactos/drivers/usb/usbccgp/usbccgp.c
trunk/reactos/lib/drivers/hidparser/api.c
trunk/reactos/lib/drivers/libusb/hub_controller.cpp
Modified: trunk/reactos/drivers/hid/hidclass/hidclass.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/hidcl…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/hidclass.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/hidclass.c [iso-8859-1] Fri May 24 17:36:14 2013
@@ -971,8 +971,21 @@
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
- UNIMPLEMENTED
- return STATUS_NOT_IMPLEMENTED;
+ PHIDCLASS_COMMON_DEVICE_EXTENSION CommonDeviceExtension;
+ CommonDeviceExtension = DeviceObject->DeviceExtension;
+
+ if (CommonDeviceExtension->IsFDO)
+ {
+ IoCopyCurrentIrpStackLocationToNext(Irp);
+ return HidClassFDO_DispatchRequest(DeviceObject, Irp);
+ }
+ else
+ {
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ PoStartNextPowerIrp(Irp);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
+ }
}
NTSTATUS
Modified: trunk/reactos/drivers/hid/hidclass/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/preco…
==============================================================================
--- trunk/reactos/drivers/hid/hidclass/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/hid/hidclass/precomp.h [iso-8859-1] Fri May 24 17:36:14 2013
@@ -186,6 +186,11 @@
IN PIRP Irp);
NTSTATUS
+HidClassFDO_DispatchRequest(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+NTSTATUS
HidClassFDO_DispatchRequestSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
Modified: trunk/reactos/drivers/usb/usbccgp/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/fdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/fdo.c [iso-8859-1] Fri May 24 17:36:14 2013
@@ -97,7 +97,7 @@
NTSTATUS
FDO_DeviceRelations(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
ULONG DeviceCount = 0;
@@ -238,7 +238,7 @@
NTSTATUS
FDO_StartDevice(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
NTSTATUS Status;
@@ -565,7 +565,7 @@
/* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
- if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_RESET_PORT ||
+ if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_RESET_PORT ||
IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_CYCLE_PORT)
{
/* Handle reset / cycle ports */
@@ -586,12 +586,33 @@
}
NTSTATUS
+FDO_HandleSystemControl(
+ PDEVICE_OBJECT DeviceObject,
+ PIRP Irp)
+{
+ PFDO_DEVICE_EXTENSION FDODeviceExtension;
+
+ /* Get device extension */
+ FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ ASSERT(FDODeviceExtension->Common.IsFDO);
+
+ /* Forward and forget request */
+ IoSkipCurrentIrpStackLocation(Irp);
+ return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
+}
+
+NTSTATUS
FDO_Dispatch(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
NTSTATUS Status;
+ PFDO_DEVICE_EXTENSION FDODeviceExtension;
+
+ /* Get device extension */
+ FDODeviceExtension = DeviceObject->DeviceExtension;
+ ASSERT(FDODeviceExtension->Common.IsFDO);
/* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -600,8 +621,14 @@
{
case IRP_MJ_PNP:
return FDO_HandlePnp(DeviceObject, Irp);
- case IRP_MJ_INTERNAL_DEVICE_CONTROL:
+ case IRP_MJ_INTERNAL_DEVICE_CONTROL:
return FDO_HandleInternalDeviceControl(DeviceObject, Irp);
+ case IRP_MJ_POWER:
+ PoStartNextPowerIrp(Irp);
+ IoSkipCurrentIrpStackLocation(Irp);
+ return PoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
+ case IRP_MJ_SYSTEM_CONTROL:
+ return FDO_HandleSystemControl(DeviceObject, Irp);
default:
DPRINT1("FDO_Dispatch Function %x not implemented\n",
IoStack->MajorFunction);
ASSERT(FALSE);
Modified: trunk/reactos/drivers/usb/usbccgp/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/pdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/pdo.c [iso-8859-1] Fri May 24 17:36:14 2013
@@ -1076,6 +1076,11 @@
return PDO_HandlePnp(DeviceObject, Irp);
case IRP_MJ_INTERNAL_DEVICE_CONTROL:
return PDO_HandleInternalDeviceControl(DeviceObject, Irp);
+ case IRP_MJ_POWER:
+ PoStartNextPowerIrp(Irp);
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
default:
DPRINT1("PDO_Dispatch Function %x not implemented\n",
IoStack->MajorFunction);
Status = Irp->IoStatus.Status;
Modified: trunk/reactos/drivers/usb/usbccgp/usbccgp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/usbccg…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/usbccgp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/usbccgp.c [iso-8859-1] Fri May 24 17:36:14 2013
@@ -160,7 +160,8 @@
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = USBCCGP_Dispatch;
DriverObject->MajorFunction[IRP_MJ_POWER] = USBCCGP_Dispatch;
DriverObject->MajorFunction[IRP_MJ_PNP] = USBCCGP_Dispatch;
- DriverObject->DriverUnload = USBCCGP_Unload;
+ DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = USBCCGP_Dispatch;
+ DriverObject->DriverUnload = USBCCGP_Unload;
/* FIMXE query GenericCompositeUSBDeviceString */
Modified: trunk/reactos/lib/drivers/hidparser/api.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/hidparser/api.…
==============================================================================
--- trunk/reactos/lib/drivers/hidparser/api.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/hidparser/api.c [iso-8859-1] Fri May 24 17:36:14 2013
@@ -757,7 +757,7 @@
}
else
{
- // HACK: logical boundaries are absolute values
+ // logical boundaries are absolute values
return HIDPARSER_STATUS_BAD_LOG_PHY_VALUES;
}
Modified: trunk/reactos/lib/drivers/libusb/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/hub_con…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] Fri May 24 17:36:14
2013
@@ -839,7 +839,7 @@
//
// Is the Request for the root hub
//
- if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
+ if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) ||
Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
ASSERT(m_PendingSCEIrp == NULL);
if (QueryStatusChageEndpoint(Irp))
@@ -1189,7 +1189,7 @@
DeviceStatus = (PUSHORT)Urb->UrbControlGetStatusRequest.TransferBuffer;
- if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
+ if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) ||
Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// FIXME need more flags ?
@@ -1319,7 +1319,7 @@
case USB_DEVICE_CLASS_RESERVED: // FALL THROUGH
case USB_DEVICE_CLASS_HUB:
{
- if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
+ if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) ||
Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// sanity checks
@@ -1525,7 +1525,7 @@
PC_ASSERT(Urb->UrbControlDescriptorRequest.TransferBufferLength >=
sizeof(USB_DEVICE_DESCRIPTOR));
PC_ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer);
- if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
+ if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) ||
Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// copy root hub device descriptor
@@ -1578,7 +1578,7 @@
BufferLength = Urb->UrbControlDescriptorRequest.TransferBufferLength;
Buffer = (PUCHAR) Urb->UrbControlDescriptorRequest.TransferBuffer;
- if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this))
+ if (Urb->UrbHeader.UsbdDeviceHandle == PVOID(this) ||
Urb->UrbHeader.UsbdDeviceHandle == NULL)
{
//
// request is for the root bus controller