mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
[USBCCGP]
- Remove hacks used for broken usbd driver - Implement IRP_MN_REMOVE for FDO & PDO svn path=/branches/usb-bringup-trunk/; revision=55372
This commit is contained in:
parent
aa485d63fd
commit
820049768b
4 changed files with 48 additions and 8 deletions
|
@ -259,8 +259,6 @@ AllocateInterfaceDescriptorsArray(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
USBCCGP_ScanConfigurationDescriptor(
|
USBCCGP_ScanConfigurationDescriptor(
|
||||||
|
@ -281,7 +279,7 @@ USBCCGP_ScanConfigurationDescriptor(
|
||||||
//
|
//
|
||||||
// count all interface descriptors
|
// count all interface descriptors
|
||||||
//
|
//
|
||||||
DescriptorCount = CountInterfaceDescriptors(ConfigurationDescriptor);
|
DescriptorCount = ConfigurationDescriptor->bNumInterfaces;
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate array holding the interface descriptors
|
// allocate array holding the interface descriptors
|
||||||
|
@ -302,6 +300,7 @@ USBCCGP_ScanConfigurationDescriptor(
|
||||||
// parse configuration descriptor
|
// parse configuration descriptor
|
||||||
//
|
//
|
||||||
InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, InterfaceIndex, -1, -1, -1, -1);
|
InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, InterfaceIndex, -1, -1, -1, -1);
|
||||||
|
ASSERT(InterfaceDescriptor);
|
||||||
if (InterfaceDescriptor)
|
if (InterfaceDescriptor)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -279,6 +279,7 @@ FDO_CreateChildPdo(
|
||||||
PDODeviceExtension->FunctionDescriptor = &FDODeviceExtension->FunctionDescriptor[Index];
|
PDODeviceExtension->FunctionDescriptor = &FDODeviceExtension->FunctionDescriptor[Index];
|
||||||
PDODeviceExtension->NextDeviceObject = FDODeviceExtension->NextDeviceObject; //DeviceObject; HACK
|
PDODeviceExtension->NextDeviceObject = FDODeviceExtension->NextDeviceObject; //DeviceObject; HACK
|
||||||
PDODeviceExtension->FunctionIndex = Index;
|
PDODeviceExtension->FunctionIndex = Index;
|
||||||
|
PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
|
||||||
PDODeviceExtension->InterfaceList = FDODeviceExtension->InterfaceList;
|
PDODeviceExtension->InterfaceList = FDODeviceExtension->InterfaceList;
|
||||||
PDODeviceExtension->InterfaceListCount = FDODeviceExtension->InterfaceListCount;
|
PDODeviceExtension->InterfaceListCount = FDODeviceExtension->InterfaceListCount;
|
||||||
PDODeviceExtension->ConfigurationHandle = FDODeviceExtension->ConfigurationHandle;
|
PDODeviceExtension->ConfigurationHandle = FDODeviceExtension->ConfigurationHandle;
|
||||||
|
@ -426,6 +427,28 @@ FDO_HandlePnp(
|
||||||
DPRINT1("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
|
DPRINT1("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
|
||||||
switch(IoStack->MinorFunction)
|
switch(IoStack->MinorFunction)
|
||||||
{
|
{
|
||||||
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
|
{
|
||||||
|
/* Send the IRP down the stack */
|
||||||
|
Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detach from the device stack
|
||||||
|
//
|
||||||
|
IoDetachDevice(FDODeviceExtension->NextDeviceObject);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Delete the device object
|
||||||
|
//
|
||||||
|
IoDeleteDevice(DeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// request completed
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -307,6 +307,7 @@ PDO_HandlePnp(
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
PPDO_DEVICE_EXTENSION PDODeviceExtension;
|
PPDO_DEVICE_EXTENSION PDODeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
ULONG Index;
|
||||||
|
|
||||||
//
|
//
|
||||||
// get current stack location
|
// get current stack location
|
||||||
|
@ -351,15 +352,31 @@ PDO_HandlePnp(
|
||||||
}
|
}
|
||||||
case IRP_MN_REMOVE_DEVICE:
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
{
|
{
|
||||||
DPRINT1("IRP_MN_REMOVE_DEVICE\n");
|
//
|
||||||
|
// remove us from the fdo's pdo list
|
||||||
|
//
|
||||||
|
for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->FunctionDescriptorCount; Index++)
|
||||||
|
{
|
||||||
|
if (PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] == DeviceObject)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// remove us
|
||||||
|
//
|
||||||
|
PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Complete the IRP */
|
//
|
||||||
|
// Complete the IRP
|
||||||
|
//
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
/* Delete the device object */
|
//
|
||||||
|
// Delete the device object
|
||||||
|
//
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
|
|
|
@ -55,6 +55,7 @@ typedef struct
|
||||||
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
|
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
|
||||||
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
|
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
|
||||||
ULONG InterfaceListCount; // interface list count
|
ULONG InterfaceListCount; // interface list count
|
||||||
|
PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to fdo's pdo list
|
||||||
}PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
}PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||||
|
|
||||||
/* descriptor.c */
|
/* descriptor.c */
|
||||||
|
|
Loading…
Reference in a new issue