Author: janderwald
Date: Sun Mar 4 02:17:13 2012
New Revision: 55983
URL:
http://svn.reactos.org/svn/reactos?rev=55983&view=rev
Log:
[USBHUB]
- Implement retrieving USB_BUS_INTERFACE_USBDI_GUID interface
[KS]
- Add PnP hack for IoSetDeviceInterfaceState
Modified:
trunk/reactos/drivers/ksfilter/ks/device.c
trunk/reactos/drivers/usb/usbhub/fdo.c
trunk/reactos/drivers/usb/usbhub/misc.c
trunk/reactos/drivers/usb/usbhub/pdo.c
trunk/reactos/drivers/usb/usbhub/usbhub.h
Modified: trunk/reactos/drivers/ksfilter/ks/device.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/device…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] Sun Mar 4 02:17:13 2012
@@ -605,6 +605,16 @@
/* get device header */
DeviceHeader = DeviceExtension->DeviceHeader;
+ if (IoStack->FileObject->FileName.Buffer == NULL)
+ {
+ // ReactOS PnPMgr still sucks
+ ASSERT(IoStack->FileObject->FileName.Length == 0);
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ DPRINT1("ReactOS PnP hack\n");
+ return STATUS_SUCCESS;
+ }
+
/* acquire list lock */
IKsDevice_fnAcquireDevice((IKsDevice*)&DeviceHeader->BasicHeader.OuterUnknown);
Modified: trunk/reactos/drivers/usb/usbhub/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub/fdo.c?r…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub/fdo.c [iso-8859-1] Sun Mar 4 02:17:13 2012
@@ -1198,6 +1198,10 @@
UsbChildExtension->ParentDeviceObject = UsbHubDeviceObject;
UsbChildExtension->PortNumber = PortId;
+ // copy device interface
+ RtlCopyMemory(&UsbChildExtension->DeviceInterface,
&HubDeviceExtension->DeviceInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
+
+
//
// Create the UsbDeviceObject
//
@@ -1211,6 +1215,12 @@
DPRINT1("USBHUB: CreateUsbDevice failed with status %x\n", Status);
goto Cleanup;
}
+
+ // copy device interface
+ RtlCopyMemory(&UsbChildExtension->DeviceInterface,
&HubDeviceExtension->DeviceInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
+
+ // FIXME replace buscontext
+ UsbChildExtension->DeviceInterface.BusContext =
UsbChildExtension->UsbDeviceHandle;
//
// Initialize UsbDevice
@@ -1806,6 +1816,9 @@
HubDeviceExtension->ConfigurationHandle =
ConfigUrb->UrbSelectConfiguration.ConfigurationHandle;
HubDeviceExtension->PipeHandle =
ConfigUrb->UrbSelectConfiguration.Interface.Pipes[0].PipeHandle;
DPRINT("Configuration Handle %x\n",
HubDeviceExtension->ConfigurationHandle);
+
+ FDO_QueryInterface(DeviceObject, &HubDeviceExtension->DeviceInterface);
+
// free urb
ExFreePool(ConfigUrb);
Modified: trunk/reactos/drivers/usb/usbhub/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub/misc.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub/misc.c [iso-8859-1] Sun Mar 4 02:17:13 2012
@@ -208,3 +208,84 @@
return Status;
}
+
+NTSTATUS
+NTAPI
+FDO_QueryInterfaceCompletionRoutine(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PVOID Context)
+{
+ /* Set event */
+ KeSetEvent((PRKEVENT)Context, 0, FALSE);
+
+ /* Completion is done in the HidClassFDO_QueryCapabilities routine */
+ return STATUS_MORE_PROCESSING_REQUIRED;
+}
+
+NTSTATUS
+FDO_QueryInterface(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PUSB_BUS_INTERFACE_USBDI_V2 Interface)
+{
+ PIRP Irp;
+ KEVENT Event;
+ NTSTATUS Status;
+ PIO_STACK_LOCATION IoStack;
+ PHUB_DEVICE_EXTENSION HubDeviceExtension;
+
+ /* Get device extension */
+ HubDeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ ASSERT(HubDeviceExtension->Common.IsFDO);
+
+ /* Init event */
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+
+ /* Now allocte the irp */
+ Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
+ if (!Irp)
+ {
+ /* No memory */
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* Get next stack location */
+ IoStack = IoGetNextIrpStackLocation(Irp);
+
+ /* Init stack location */
+ IoStack->MajorFunction = IRP_MJ_PNP;
+ IoStack->MinorFunction = IRP_MN_QUERY_INTERFACE;
+ IoStack->Parameters.QueryInterface.Interface = (PINTERFACE)Interface;
+ IoStack->Parameters.QueryInterface.InterfaceType =
&USB_BUS_INTERFACE_USBDI_GUID;
+ IoStack->Parameters.QueryInterface.Version = USB_BUSIF_USBDI_VERSION_2;
+ IoStack->Parameters.QueryInterface.Size = sizeof(USB_BUS_INTERFACE_USBDI_V2);
+
+
+ /* Set completion routine */
+ IoSetCompletionRoutine(Irp,
+ FDO_QueryInterfaceCompletionRoutine,
+ (PVOID)&Event,
+ TRUE,
+ TRUE,
+ TRUE);
+
+ /* Pnp irps have default completion code */
+ Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
+
+ /* Call lower device */
+ Status = IoCallDriver(HubDeviceExtension->LowerDeviceObject, Irp);
+ if (Status == STATUS_PENDING)
+ {
+ /* Wait for completion */
+ KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
+ }
+
+ /* Get status */
+ Status = Irp->IoStatus.Status;
+
+ /* Complete request */
+ IoFreeIrp(Irp);
+
+ /* Done */
+ return Status;
+}
Modified: trunk/reactos/drivers/usb/usbhub/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub/pdo.c?r…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub/pdo.c [iso-8859-1] Sun Mar 4 02:17:13 2012
@@ -713,6 +713,21 @@
Information = 0;
break;
}
+ case IRP_MN_QUERY_INTERFACE:
+ {
+ DPRINT1("IRP_MN_QUERY_INTERFACE\n");
+ if (IsEqualGUIDAligned(Stack->Parameters.QueryInterface.InterfaceType,
&USB_BUS_INTERFACE_USBDI_GUID))
+ {
+ DPRINT1("USB_BUS_INTERFACE_USBDI_GUID\n");
+ RtlCopyMemory(Stack->Parameters.QueryInterface.Interface,
&UsbChildExtension->DeviceInterface, Stack->Parameters.QueryInterface.Size);
+ Status = STATUS_SUCCESS;
+ break;
+ }
+
+ // pass irp down
+ IoSkipCurrentIrpStackLocation(Irp);
+ return IoCallDriver(UsbChildExtension->ParentDeviceObject, Irp);
+ }
default:
{
DPRINT1("PDO IRP_MJ_PNP / unknown minor function 0x%lx\n",
MinorFunction);
Modified: trunk/reactos/drivers/usb/usbhub/usbhub.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub/usbhub.…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub/usbhub.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub/usbhub.h [iso-8859-1] Sun Mar 4 02:17:13 2012
@@ -67,6 +67,7 @@
USB_DEVICE_DESCRIPTOR DeviceDesc;
PUSB_CONFIGURATION_DESCRIPTOR FullConfigDesc;
UNICODE_STRING SymbolicLinkName;
+ USB_BUS_INTERFACE_USBDI_V2 DeviceInterface;
} HUB_CHILDDEVICE_EXTENSION, *PHUB_CHILDDEVICE_EXTENSION;
typedef struct _HUB_DEVICE_EXTENSION
@@ -100,6 +101,8 @@
USBD_CONFIGURATION_HANDLE ConfigurationHandle;
USBD_PIPE_HANDLE PipeHandle;
PVOID RootHubHandle;
+ USB_BUS_INTERFACE_USBDI_V2 DeviceInterface;
+
UNICODE_STRING SymbolicLinkName;
} HUB_DEVICE_EXTENSION, *PHUB_DEVICE_EXTENSION;
@@ -149,6 +152,11 @@
OUT PVOID OutParameter1,
OUT PVOID OutParameter2);
+NTSTATUS
+FDO_QueryInterface(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PUSB_BUS_INTERFACE_USBDI_V2 Interface);
+
// pdo.c
NTSTATUS
USBHUB_PdoHandlePnp(