mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[USBHUB]
- Implement retrieving USB_BUS_INTERFACE_USBDI_GUID interface [KS] - Add PnP hack for IoSetDeviceInterfaceState svn path=/trunk/; revision=55983
This commit is contained in:
parent
9732b09bc6
commit
0b301f3da8
|
@ -605,6 +605,16 @@ IKsDevice_Create(
|
|||
/* 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);
|
||||
|
||||
|
|
|
@ -1198,6 +1198,10 @@ CreateUsbChildDeviceObject(
|
|||
UsbChildExtension->ParentDeviceObject = UsbHubDeviceObject;
|
||||
UsbChildExtension->PortNumber = PortId;
|
||||
|
||||
// copy device interface
|
||||
RtlCopyMemory(&UsbChildExtension->DeviceInterface, &HubDeviceExtension->DeviceInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
|
||||
|
||||
|
||||
//
|
||||
// Create the UsbDeviceObject
|
||||
//
|
||||
|
@ -1212,6 +1216,12 @@ CreateUsbChildDeviceObject(
|
|||
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
|
||||
//
|
||||
|
@ -1807,6 +1817,9 @@ USBHUB_FdoStartDevice(
|
|||
HubDeviceExtension->PipeHandle = ConfigUrb->UrbSelectConfiguration.Interface.Pipes[0].PipeHandle;
|
||||
DPRINT("Configuration Handle %x\n", HubDeviceExtension->ConfigurationHandle);
|
||||
|
||||
FDO_QueryInterface(DeviceObject, &HubDeviceExtension->DeviceInterface);
|
||||
|
||||
|
||||
// free urb
|
||||
ExFreePool(ConfigUrb);
|
||||
|
||||
|
|
|
@ -208,3 +208,84 @@ SubmitRequestToRootHub(
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -713,6 +713,21 @@ USBHUB_PdoHandlePnp(
|
|||
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);
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct _HUB_CHILDDEVICE_EXTENSION
|
|||
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 @@ typedef struct _HUB_DEVICE_EXTENSION
|
|||
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 @@ SubmitRequestToRootHub(
|
|||
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(
|
||||
|
|
Loading…
Reference in a new issue