[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:
Johannes Anderwald 2012-02-02 10:17:14 +00:00
parent aa485d63fd
commit 820049768b
4 changed files with 48 additions and 8 deletions

View file

@ -259,8 +259,6 @@ AllocateInterfaceDescriptorsArray(
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
USBCCGP_ScanConfigurationDescriptor(
@ -281,7 +279,7 @@ USBCCGP_ScanConfigurationDescriptor(
//
// count all interface descriptors
//
DescriptorCount = CountInterfaceDescriptors(ConfigurationDescriptor);
DescriptorCount = ConfigurationDescriptor->bNumInterfaces;
//
// allocate array holding the interface descriptors
@ -302,6 +300,7 @@ USBCCGP_ScanConfigurationDescriptor(
// parse configuration descriptor
//
InterfaceDescriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, InterfaceIndex, -1, -1, -1, -1);
ASSERT(InterfaceDescriptor);
if (InterfaceDescriptor)
{
//

View file

@ -279,6 +279,7 @@ FDO_CreateChildPdo(
PDODeviceExtension->FunctionDescriptor = &FDODeviceExtension->FunctionDescriptor[Index];
PDODeviceExtension->NextDeviceObject = FDODeviceExtension->NextDeviceObject; //DeviceObject; HACK
PDODeviceExtension->FunctionIndex = Index;
PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
PDODeviceExtension->InterfaceList = FDODeviceExtension->InterfaceList;
PDODeviceExtension->InterfaceListCount = FDODeviceExtension->InterfaceListCount;
PDODeviceExtension->ConfigurationHandle = FDODeviceExtension->ConfigurationHandle;
@ -423,9 +424,31 @@ FDO_HandlePnp(
// get stack location
IoStack = IoGetCurrentIrpStackLocation(Irp);
DPRINT1("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
DPRINT1("[USBCCGP] PnP Minor %x\n", 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:
{
//

View file

@ -307,6 +307,7 @@ PDO_HandlePnp(
PIO_STACK_LOCATION IoStack;
PPDO_DEVICE_EXTENSION PDODeviceExtension;
NTSTATUS Status;
ULONG Index;
//
// get current stack location
@ -351,15 +352,31 @@ PDO_HandlePnp(
}
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;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
/* Delete the device object */
//
// Delete the device object
//
IoDeleteDevice(DeviceObject);
return STATUS_SUCCESS;
}
case IRP_MN_QUERY_CAPABILITIES:

View file

@ -55,6 +55,7 @@ typedef struct
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
ULONG InterfaceListCount; // interface list count
PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to fdo's pdo list
}PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
/* descriptor.c */