2 * PROJECT: ReactOS Universal Serial Bus Hub Driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/usbhub/fdo.c
7 * Hervé Poussineau (hpoussin@reactos.org)
8 * Michael Martin (michael.martin@reactos.org)
9 * Johannes Anderwald (johannes.anderwald@reactos.org)
19 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
24 PDEVICE_OBJECT DeviceObject
,
29 DPRINT("Entered Urb Completion\n");
32 // Get the original Irp
34 OriginalIrp
= (PIRP
)Context
;
37 // Update it to match what was returned for the IRP that was passed to RootHub
39 OriginalIrp
->IoStatus
.Status
= Irp
->IoStatus
.Status
;
40 OriginalIrp
->IoStatus
.Information
= Irp
->IoStatus
.Information
;
41 DPRINT("Status %x, Information %x\n", Irp
->IoStatus
.Status
, Irp
->IoStatus
.Information
);
44 // Complete the original Irp
46 IoCompleteRequest(OriginalIrp
, IO_NO_INCREMENT
);
49 // Return this status so the IO Manager doesnt mess with the Irp
51 return STATUS_MORE_PROCESSING_REQUIRED
;
56 PDEVICE_OBJECT RootHubDeviceObject
,
57 IN ULONG IoControlCode
,
59 OUT PVOID OutParameter1
,
60 OUT PVOID OutParameter2
)
63 IO_STATUS_BLOCK IoStatus
;
64 PIO_STACK_LOCATION ForwardStack
, CurrentStack
;
68 // Get the current stack location for the Irp
70 CurrentStack
= IoGetCurrentIrpStackLocation(Irp
);
74 // Pull the Urb from that stack, it will be reused in the Irp sent to RootHub
76 Urb
= (PURB
)CurrentStack
->Parameters
.Others
.Argument1
;
80 // Create the Irp to forward to RootHub
82 ForwardIrp
= IoBuildAsynchronousFsdRequest(IRP_MJ_SHUTDOWN
,
90 DPRINT1("Failed to allocate IRP\n");
91 return STATUS_INSUFFICIENT_RESOURCES
;
95 // Get the new Irps next stack
97 ForwardStack
= IoGetNextIrpStackLocation(ForwardIrp
);
100 // Copy the stack for the current irp into the next stack of new irp
102 RtlCopyMemory(ForwardStack
, CurrentStack
, sizeof(IO_STACK_LOCATION
));
104 IoStatus
.Status
= STATUS_NOT_SUPPORTED
;
105 IoStatus
.Information
= 0;
108 // Mark the Irp from upper driver as pending
110 IoMarkIrpPending(Irp
);
113 // Now set the completion routine for the new Irp.
115 IoSetCompletionRoutine(ForwardIrp
,
122 IoCallDriver(RootHubDeviceObject
, ForwardIrp
);
125 // Always return pending as the completion routine will take care of it
127 return STATUS_PENDING
;
132 IN PDEVICE_OBJECT DeviceObject
)
135 PHUB_DEVICE_EXTENSION HubDeviceExtension
;
136 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
139 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
140 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
141 HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)ChildDeviceExtension
->ParentDeviceObject
->DeviceExtension
;
143 for(Index
= 0; Index
< USB_MAXCHILDREN
; Index
++)
145 if (HubDeviceExtension
->ChildDeviceObject
[Index
] == DeviceObject
)
158 USBHUB_PdoHandleInternalDeviceControl(
159 IN PDEVICE_OBJECT DeviceObject
,
163 PIO_STACK_LOCATION Stack
;
164 ULONG_PTR Information
= 0;
165 PHUB_DEVICE_EXTENSION HubDeviceExtension
;
166 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
167 PDEVICE_OBJECT RootHubDeviceObject
;
170 //DPRINT1("UsbhubInternalDeviceControlPdo(%x) called\n", DeviceObject);
173 // get current stack location
175 Stack
= IoGetCurrentIrpStackLocation(Irp
);
179 // Set default status
181 Status
= Irp
->IoStatus
.Status
;
183 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
184 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
185 HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)ChildDeviceExtension
->ParentDeviceObject
->DeviceExtension
;
186 RootHubDeviceObject
= HubDeviceExtension
->RootHubPhysicalDeviceObject
;
188 if(!IsValidPDO(DeviceObject
))
190 DPRINT1("[USBHUB] Request for removed device object %p\n", DeviceObject
);
191 Irp
->IoStatus
.Status
= STATUS_DEVICE_NOT_CONNECTED
;
192 Irp
->IoStatus
.Information
= 0;
193 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
194 return STATUS_DEVICE_NOT_CONNECTED
;
197 switch (Stack
->Parameters
.DeviceIoControl
.IoControlCode
)
199 case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO
:
201 DPRINT("IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
202 if (Irp
->AssociatedIrp
.SystemBuffer
== NULL
203 || Stack
->Parameters
.DeviceIoControl
.OutputBufferLength
!= sizeof(PVOID
))
205 Status
= STATUS_INVALID_PARAMETER
;
211 pHubPointer
= (PVOID
*)Irp
->AssociatedIrp
.SystemBuffer
;
214 Information
= sizeof(PVOID
);
215 Status
= STATUS_SUCCESS
;
219 case IOCTL_INTERNAL_USB_SUBMIT_URB
:
221 //DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB\n");
226 Urb
= (PURB
)Stack
->Parameters
.Others
.Argument1
;
230 // Set the real device handle
232 //DPRINT("UsbdDeviceHandle %x, ChildDeviceHandle %x\n", Urb->UrbHeader.UsbdDeviceHandle, ChildDeviceExtension->UsbDeviceHandle);
234 Urb
->UrbHeader
.UsbdDeviceHandle
= ChildDeviceExtension
->UsbDeviceHandle
;
239 switch (Urb
->UrbHeader
.Function
)
244 case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
:
245 DPRINT("URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n");
247 case URB_FUNCTION_CLASS_DEVICE
:
248 DPRINT("URB_FUNCTION_CLASS_DEVICE\n");
250 case URB_FUNCTION_GET_STATUS_FROM_DEVICE
:
251 DPRINT("URB_FUNCTION_GET_STATUS_FROM_DEVICE\n");
253 case URB_FUNCTION_SELECT_CONFIGURATION
:
254 DPRINT("URB_FUNCTION_SELECT_CONFIGURATION\n");
256 case URB_FUNCTION_SELECT_INTERFACE
:
257 DPRINT("URB_FUNCTION_SELECT_INTERFACE\n");
259 case URB_FUNCTION_CLASS_OTHER
:
260 DPRINT("URB_FUNCTION_CLASS_OTHER\n");
262 case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
:
265 DPRINT1("URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n");
266 DPRINT1("PipeHandle %x\n", Urb->UrbBulkOrInterruptTransfer.PipeHandle);
267 DPRINT1("TransferFlags %x\n", Urb->UrbBulkOrInterruptTransfer.TransferFlags);
268 DPRINT1("Buffer %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBuffer);
269 DPRINT1("BufferMDL %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
270 DPRINT1("Length %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
271 DPRINT1("UrbLink %x\n", Urb->UrbBulkOrInterruptTransfer.UrbLink);
272 DPRINT1("hca %x\n", Urb->UrbBulkOrInterruptTransfer.hca);
273 if (Urb->UrbBulkOrInterruptTransfer.TransferFlags == USBD_SHORT_TRANSFER_OK)
280 case URB_FUNCTION_CLASS_INTERFACE
:
281 DPRINT("URB_FUNCTION_CLASS_INTERFACE\n");
283 case URB_FUNCTION_VENDOR_DEVICE
:
284 DPRINT("URB_FUNCTION_VENDOR_DEVICE\n");
287 DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x NOT IMPLEMENTED\n", Urb
->UrbHeader
.Function
);
290 Urb
->UrbHeader
.UsbdDeviceHandle
= ChildDeviceExtension
->UsbDeviceHandle
;
291 //DPRINT1("Stack->CompletionRoutine %x\n", Stack->CompletionRoutine);
293 // Send the request to RootHub
295 Status
= FowardUrbToRootHub(RootHubDeviceObject
, IOCTL_INTERNAL_USB_SUBMIT_URB
, Irp
, Urb
, NULL
);
300 // FIXME: Can these be sent to RootHub?
302 case IOCTL_INTERNAL_USB_RESET_PORT
:
303 DPRINT1("IOCTL_INTERNAL_USB_RESET_PORT\n");
305 case IOCTL_INTERNAL_USB_GET_PORT_STATUS
:
307 PORT_STATUS_CHANGE PortStatus
;
309 PUCHAR PortStatusBits
;
311 PortStatusBits
= (PUCHAR
)Stack
->Parameters
.Others
.Argument1
;
313 // USBD_PORT_ENABLED (bit 0) or USBD_PORT_CONNECTED (bit 1)
315 DPRINT1("IOCTL_INTERNAL_USB_GET_PORT_STATUS\n");
316 DPRINT("Arg1 %x\n", *PortStatusBits
);
318 if (Stack
->Parameters
.Others
.Argument1
)
320 for (PortId
= 1; PortId
<= HubDeviceExtension
->UsbExtHubInfo
.NumberOfPorts
; PortId
++)
322 Status
= GetPortStatusAndChange(RootHubDeviceObject
, PortId
, &PortStatus
);
323 if (NT_SUCCESS(Status
))
325 DPRINT("Connect %x\n", ((PortStatus
.Status
& USB_PORT_STATUS_CONNECT
) << 1) << ((PortId
- 1) * 2));
326 DPRINT("Enable %x\n", ((PortStatus
.Status
& USB_PORT_STATUS_ENABLE
) >> 1) << ((PortId
- 1) * 2));
328 (((PortStatus
.Status
& USB_PORT_STATUS_CONNECT
) << 1) << ((PortId
- 1) * 2)) +
329 (((PortStatus
.Status
& USB_PORT_STATUS_ENABLE
) >> 1) << ((PortId
- 1) * 2));
335 DPRINT1("Arg1 %x\n", *PortStatusBits
);
336 Status
= STATUS_SUCCESS
;
339 case IOCTL_INTERNAL_USB_ENABLE_PORT
:
340 DPRINT1("IOCTL_INTERNAL_USB_ENABLE_PORT\n");
342 case IOCTL_INTERNAL_USB_CYCLE_PORT
:
343 DPRINT1("IOCTL_INTERNAL_USB_CYCLE_PORT\n");
345 case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE
:
347 DPRINT1("IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE\n");
348 if (Stack
->Parameters
.Others
.Argument1
)
350 // store device handle
351 *(PVOID
*)Stack
->Parameters
.Others
.Argument1
= (PVOID
)ChildDeviceExtension
->UsbDeviceHandle
;
352 Status
= STATUS_SUCCESS
;
357 Status
= STATUS_INVALID_PARAMETER
;
361 case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO
:
363 if (Stack
->Parameters
.Others
.Argument1
)
365 // inform caller that it is a real usb hub
366 *(PVOID
*)Stack
->Parameters
.Others
.Argument1
= NULL
;
369 if (Stack
->Parameters
.Others
.Argument2
)
371 // output device object
372 *(PVOID
*)Stack
->Parameters
.Others
.Argument2
= DeviceObject
;
376 Status
= STATUS_SUCCESS
;
381 DPRINT1("Unknown IOCTL code 0x%lx\n", Stack
->Parameters
.DeviceIoControl
.IoControlCode
);
382 Information
= Irp
->IoStatus
.Information
;
383 Status
= Irp
->IoStatus
.Status
;
387 if (Status
!= STATUS_PENDING
)
389 Irp
->IoStatus
.Information
= Information
;
390 Irp
->IoStatus
.Status
= Status
;
391 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
397 USBHUB_PdoStartDevice(
398 IN PDEVICE_OBJECT DeviceObject
,
401 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
403 DPRINT("USBHUB_PdoStartDevice %x\n", DeviceObject
);
404 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
407 // This should be a PDO
409 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
412 // FIXME: Fow now assume success
416 return STATUS_SUCCESS
;
421 IN PDEVICE_OBJECT DeviceObject
,
423 OUT ULONG_PTR
* Information
)
425 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
427 PUNICODE_STRING SourceString
= NULL
;
428 PWCHAR ReturnString
= NULL
;
429 NTSTATUS Status
= STATUS_SUCCESS
;
431 IdType
= IoGetCurrentIrpStackLocation(Irp
)->Parameters
.QueryId
.IdType
;
432 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
436 case BusQueryDeviceID
:
438 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
439 SourceString
= &ChildDeviceExtension
->usDeviceId
;
442 case BusQueryHardwareIDs
:
444 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
445 SourceString
= &ChildDeviceExtension
->usHardwareIds
;
448 case BusQueryCompatibleIDs
:
450 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
451 SourceString
= &ChildDeviceExtension
->usCompatibleIds
;
454 case BusQueryInstanceID
:
456 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
457 SourceString
= &ChildDeviceExtension
->usInstanceId
;
461 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType
);
462 return STATUS_NOT_SUPPORTED
;
470 ReturnString
= ExAllocatePool(PagedPool
, SourceString
->MaximumLength
);
476 return STATUS_INSUFFICIENT_RESOURCES
;
482 RtlCopyMemory(ReturnString
, SourceString
->Buffer
, SourceString
->MaximumLength
);
485 *Information
= (ULONG_PTR
)ReturnString
;
491 USBHUB_PdoQueryDeviceText(
492 IN PDEVICE_OBJECT DeviceObject
,
494 OUT ULONG_PTR
* Information
)
496 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
497 DEVICE_TEXT_TYPE DeviceTextType
;
498 PUNICODE_STRING SourceString
= NULL
;
499 PWCHAR ReturnString
= NULL
;
500 NTSTATUS Status
= STATUS_SUCCESS
;
502 DeviceTextType
= IoGetCurrentIrpStackLocation(Irp
)->Parameters
.QueryDeviceText
.DeviceTextType
;
503 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
509 switch (DeviceTextType
)
511 case DeviceTextDescription
:
512 case DeviceTextLocationInformation
:
514 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
517 // does the device provide a text description
519 if (ChildDeviceExtension
->usTextDescription
.Buffer
&& ChildDeviceExtension
->usTextDescription
.Length
)
524 SourceString
= &ChildDeviceExtension
->usTextDescription
;
530 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown device text type 0x%lx\n", DeviceTextType
);
531 Status
= STATUS_NOT_SUPPORTED
;
538 ReturnString
= ExAllocatePool(PagedPool
, SourceString
->MaximumLength
);
539 RtlCopyMemory(ReturnString
, SourceString
->Buffer
, SourceString
->MaximumLength
);
540 DPRINT1("%S\n", ReturnString
);
541 *Information
= (ULONG_PTR
)ReturnString
;
549 IN PDEVICE_OBJECT DeviceObject
,
554 PIO_STACK_LOCATION Stack
;
555 ULONG_PTR Information
= 0;
556 PHUB_CHILDDEVICE_EXTENSION UsbChildExtension
;
559 PDEVICE_RELATIONS DeviceRelation
;
560 PDEVICE_OBJECT ParentDevice
;
562 UsbChildExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
563 Stack
= IoGetCurrentIrpStackLocation(Irp
);
564 MinorFunction
= Stack
->MinorFunction
;
566 switch (MinorFunction
)
568 case IRP_MN_START_DEVICE
:
570 DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
571 Status
= USBHUB_PdoStartDevice(DeviceObject
, Irp
);
574 case IRP_MN_QUERY_CAPABILITIES
:
576 PDEVICE_CAPABILITIES DeviceCapabilities
;
578 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
580 DeviceCapabilities
= (PDEVICE_CAPABILITIES
)Stack
->Parameters
.DeviceCapabilities
.Capabilities
;
581 // FIXME: capabilities can change with connected device
582 DeviceCapabilities
->LockSupported
= FALSE
;
583 DeviceCapabilities
->EjectSupported
= FALSE
;
584 DeviceCapabilities
->Removable
= TRUE
;
585 DeviceCapabilities
->DockDevice
= FALSE
;
586 DeviceCapabilities
->UniqueID
= FALSE
;
587 DeviceCapabilities
->SilentInstall
= FALSE
;
588 DeviceCapabilities
->RawDeviceOK
= FALSE
;
589 DeviceCapabilities
->SurpriseRemovalOK
= FALSE
;
590 DeviceCapabilities
->HardwareDisabled
= FALSE
;
591 //DeviceCapabilities->NoDisplayInUI = FALSE;
592 DeviceCapabilities
->Address
= UsbChildExtension
->PortNumber
;
593 DeviceCapabilities
->UINumber
= 0;
594 DeviceCapabilities
->DeviceState
[0] = PowerDeviceD0
;
595 for (i
= 1; i
< PowerSystemMaximum
; i
++)
596 DeviceCapabilities
->DeviceState
[i
] = PowerDeviceD3
;
597 //DeviceCapabilities->DeviceWake = PowerDeviceUndefined;
598 DeviceCapabilities
->D1Latency
= 0;
599 DeviceCapabilities
->D2Latency
= 0;
600 DeviceCapabilities
->D3Latency
= 0;
601 Status
= STATUS_SUCCESS
;
604 case IRP_MN_QUERY_RESOURCES
:
606 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
608 Information
= Irp
->IoStatus
.Information
;
609 Status
= Irp
->IoStatus
.Status
;
612 case IRP_MN_QUERY_RESOURCE_REQUIREMENTS
:
614 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
616 Information
= Irp
->IoStatus
.Information
;
617 Status
= Irp
->IoStatus
.Status
;
620 case IRP_MN_QUERY_DEVICE_TEXT
:
622 Status
= USBHUB_PdoQueryDeviceText(DeviceObject
, Irp
, &Information
);
625 case IRP_MN_QUERY_ID
:
627 Status
= USBHUB_PdoQueryId(DeviceObject
, Irp
, &Information
);
630 case IRP_MN_QUERY_BUS_INFORMATION
:
632 PPNP_BUS_INFORMATION BusInfo
;
633 BusInfo
= (PPNP_BUS_INFORMATION
)ExAllocatePool(PagedPool
, sizeof(PNP_BUS_INFORMATION
));
634 RtlCopyMemory(&BusInfo
->BusTypeGuid
,
636 sizeof(BusInfo
->BusTypeGuid
));
637 BusInfo
->LegacyBusType
= PNPBus
;
639 BusInfo
->BusNumber
= 0;
640 Information
= (ULONG_PTR
)BusInfo
;
641 Status
= STATUS_SUCCESS
;
644 case IRP_MN_REMOVE_DEVICE
:
646 PHUB_DEVICE_EXTENSION HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)UsbChildExtension
->ParentDeviceObject
->DeviceExtension
;
647 PUSB_BUS_INTERFACE_HUB_V5 HubInterface
= &HubDeviceExtension
->HubInterface
;
648 ParentDevice
= UsbChildExtension
->ParentDeviceObject
;
650 DPRINT("IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
652 /* remove us from pdo list */
654 for(Index
= 0; Index
< USB_MAXCHILDREN
; Index
++)
656 if (HubDeviceExtension
->ChildDeviceObject
[Index
] == DeviceObject
)
658 /* Remove the device */
659 Status
= HubInterface
->RemoveUsbDevice(HubDeviceExtension
->UsbDInterface
.BusContext
, UsbChildExtension
->UsbDeviceHandle
, 0);
661 /* FIXME handle error */
662 ASSERT(Status
== STATUS_SUCCESS
);
665 HubDeviceExtension
->ChildDeviceObject
[Index
] = NULL
;
671 /* Complete the IRP */
672 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
673 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
676 IoDeleteDevice(DeviceObject
);
680 /* invalidate device relations */
681 IoInvalidateDeviceRelations(ParentDevice
, BusRelations
);
684 return STATUS_SUCCESS
;
686 case IRP_MN_QUERY_DEVICE_RELATIONS
:
688 /* only target relations are supported */
689 if (Stack
->Parameters
.QueryDeviceRelations
.Type
!= TargetDeviceRelation
)
692 Status
= Irp
->IoStatus
.Status
;
696 /* allocate device relations */
697 DeviceRelation
= (PDEVICE_RELATIONS
)ExAllocatePool(NonPagedPool
, sizeof(DEVICE_RELATIONS
));
701 Status
= STATUS_INSUFFICIENT_RESOURCES
;
705 /* init device relation */
706 DeviceRelation
->Count
= 1;
707 DeviceRelation
->Objects
[0] = DeviceObject
;
708 ObReferenceObject(DeviceRelation
->Objects
[0]);
711 Irp
->IoStatus
.Information
= (ULONG_PTR
)DeviceRelation
;
712 Status
= STATUS_SUCCESS
;
715 case IRP_MN_QUERY_STOP_DEVICE
:
716 case IRP_MN_QUERY_REMOVE_DEVICE
:
718 /* Sure, no problem */
719 Status
= STATUS_SUCCESS
;
723 case IRP_MN_QUERY_INTERFACE
:
725 DPRINT1("IRP_MN_QUERY_INTERFACE\n");
726 if (IsEqualGUIDAligned(Stack
->Parameters
.QueryInterface
.InterfaceType
, &USB_BUS_INTERFACE_USBDI_GUID
))
728 DPRINT1("USB_BUS_INTERFACE_USBDI_GUID\n");
729 RtlCopyMemory(Stack
->Parameters
.QueryInterface
.Interface
, &UsbChildExtension
->DeviceInterface
, Stack
->Parameters
.QueryInterface
.Size
);
730 Status
= STATUS_SUCCESS
;
735 IoSkipCurrentIrpStackLocation(Irp
);
736 return IoCallDriver(UsbChildExtension
->ParentDeviceObject
, Irp
);
738 case IRP_MN_SURPRISE_REMOVAL
:
740 DPRINT("[USBHUB] HandlePnp IRP_MN_SURPRISE_REMOVAL\n");
741 Status
= STATUS_SUCCESS
;
746 DPRINT1("PDO IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction
);
747 Information
= Irp
->IoStatus
.Information
;
748 Status
= Irp
->IoStatus
.Status
;
752 Irp
->IoStatus
.Information
= Information
;
753 Irp
->IoStatus
.Status
= Status
;
754 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);