/*
* PROJECT: ReactOS Universal Serial Bus Hub Driver
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: drivers/usb/usbhub/fdo.c
+ * FILE: drivers/usb/usbhub/misc.c
* PURPOSE: Misc helper functions
* PROGRAMMERS:
* Michael Martin (michael.martin@reactos.org)
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;
-}