Author: janderwald
Date: Thu Feb 2 10:17:14 2012
New Revision: 55372
URL:
http://svn.reactos.org/svn/reactos?rev=55372&view=rev
Log:
[USBCCGP]
- Remove hacks used for broken usbd driver
- Implement IRP_MN_REMOVE for FDO & PDO
Modified:
branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c
branches/usb-bringup-trunk/drivers/usb/usbccgp/fdo.c
branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/descriptor.c [iso-8859-1] Thu Feb 2
10:17:14 2012
@@ -259,8 +259,6 @@
return STATUS_SUCCESS;
}
-
-
NTSTATUS
NTAPI
USBCCGP_ScanConfigurationDescriptor(
@@ -281,7 +279,7 @@
//
// count all interface descriptors
//
- DescriptorCount = CountInterfaceDescriptors(ConfigurationDescriptor);
+ DescriptorCount = ConfigurationDescriptor->bNumInterfaces;
//
// allocate array holding the interface descriptors
@@ -302,6 +300,7 @@
// parse configuration descriptor
//
InterfaceDescriptor =
USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor,
InterfaceIndex, -1, -1, -1, -1);
+ ASSERT(InterfaceDescriptor);
if (InterfaceDescriptor)
{
//
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/fdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/fdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/fdo.c [iso-8859-1] Thu Feb 2 10:17:14
2012
@@ -279,6 +279,7 @@
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 @@
// 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:
{
//
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/pdo.c [iso-8859-1] Thu Feb 2 10:17:14
2012
@@ -307,6 +307,7 @@
PIO_STACK_LOCATION IoStack;
PPDO_DEVICE_EXTENSION PDODeviceExtension;
NTSTATUS Status;
+ ULONG Index;
//
// get current stack location
@@ -351,15 +352,31 @@
}
case IRP_MN_REMOVE_DEVICE:
{
- DPRINT1("IRP_MN_REMOVE_DEVICE\n");
-
- /* Complete the IRP */
+ //
+ // 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
+ //
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:
Modified: branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] Thu Feb 2
10:17:14 2012
@@ -55,6 +55,7 @@
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 */