Rename IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE to IOCTL_INTERNAL_USB_GET_PARENT_HUB_IN...
authorHervé Poussineau <hpoussin@reactos.org>
Mon, 15 May 2006 16:38:49 +0000 (16:38 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Mon, 15 May 2006 16:38:49 +0000 (16:38 +0000)
svn path=/trunk/; revision=21909

reactos/drivers/usb/miniport/common/main.c
reactos/drivers/usb/miniport/common/pdo.c
reactos/drivers/usb/miniport/common/usbcommon.h
reactos/drivers/usb/miniport/sys/linuxwrapper.c
reactos/drivers/usb/miniport/usb_wrapper.h
reactos/drivers/usb/usbhub/pdo.c
reactos/drivers/usb/usbhub/usbhub.c
reactos/drivers/usb/usbhub/usbhub.h

index e85401c..5d2386c 100644 (file)
@@ -381,7 +381,7 @@ DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
        if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
                return UsbMpFdoDeviceControl(DeviceObject, Irp);
        else
-               return UsbMpPdoDeviceControl(DeviceObject, Irp);
+               return IrpStub(DeviceObject, Irp);
 }
 
 static NTSTATUS NTAPI
index e4854fc..bebe1c4 100644 (file)
@@ -60,7 +60,7 @@ UsbMpPdoCleanup(
 }
 
 NTSTATUS
-UsbMpPdoDeviceControl(
+UsbMpPdoInternalDeviceControlCore(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
@@ -68,18 +68,18 @@ UsbMpPdoDeviceControl(
        ULONG_PTR Information = 0;
        NTSTATUS Status;
 
-       DPRINT("UsbMpDeviceControlPdo() called\n");
+       DPRINT("UsbMpPdoInternalDeviceControl() called\n");
 
        Stack = IoGetCurrentIrpStackLocation(Irp);
        Status = Irp->IoStatus.Status;
 
        switch (Stack->Parameters.DeviceIoControl.IoControlCode)
        {
-               case IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE:
+               case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO:
                {
                        PUSBMP_DEVICE_EXTENSION DeviceExtension;
 
-                       DPRINT("IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE\n");
+                       DPRINT("IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
                        if (Irp->AssociatedIrp.SystemBuffer == NULL
                                || Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID))
                        {
@@ -609,9 +609,7 @@ UsbMpPdoInternalDeviceControl(
        }
        else
        {
-               DPRINT("We got IOCTL for UsbCore\n");
-               IoCompleteRequest(Irp, IO_NO_INCREMENT);
-               return STATUS_SUCCESS;
+               return UsbMpPdoInternalDeviceControlCore(DeviceObject, Irp);
        }
 
 
index 2f5090e..f48c224 100644 (file)
@@ -90,7 +90,7 @@ UsbMpPdoPnp(
        IN PIRP Irp);
 
 NTSTATUS
-UsbMpPdoDeviceControl(
+UsbMpInternalPdoDeviceControl(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
 
index bc7c26c..376b37f 100644 (file)
@@ -198,7 +198,7 @@ int my_driver_register(struct device_driver *driver)
 
        if (drvs_num<MAX_DRVS)
        {
-               printk("driver_register %i: %p %p",drvs_num,driver,driver->probe);  
+               printk("driver_register %i: %p %p\n",drvs_num,driver,driver->probe);  
 
                m_drivers[drvs_num++]=driver;
                return 0;
index 52c9b08..f8af806 100644 (file)
@@ -46,5 +46,3 @@ int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
 #include "linux/usb.h"
 #include "linux/pci_ids.h"
 
-#define IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE \
-       CTL_CODE(FILE_DEVICE_USB, 4000, METHOD_BUFFERED, FILE_ANY_ACCESS)
index d7d117f..60b5c2b 100644 (file)
@@ -4,7 +4,7 @@
  * FILE:            drivers/usb/cromwell/hub/pdo.c
  * PURPOSE:         IRP_MJ_PNP operations for PDOs
  *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com)
+ * PROGRAMMERS:     Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
  */
 
 #define NDEBUG
@@ -14,7 +14,7 @@
 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
 
 NTSTATUS
-UsbhubDeviceControlPdo(
+UsbhubInternalDeviceControlPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
 {
@@ -22,18 +22,18 @@ UsbhubDeviceControlPdo(
        ULONG_PTR Information = 0;
        NTSTATUS Status;
        
-       DPRINT("Usbhub: UsbhubDeviceControlPdo() called\n");
+       DPRINT("Usbhub: UsbhubInternalDeviceControlPdo() called\n");
        
        Stack = IoGetCurrentIrpStackLocation(Irp);
        Status = Irp->IoStatus.Status;
        
        switch (Stack->Parameters.DeviceIoControl.IoControlCode)
        {
-               case IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE:
+               case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO:
                {
                        PHUB_DEVICE_EXTENSION DeviceExtension;
                        
-                       DPRINT("Usbhub: IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE\n");
+                       DPRINT("Usbhub: IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
                        if (Irp->AssociatedIrp.SystemBuffer == NULL
                                || Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID))
                        {
index 1cd193b..2b86dfe 100644 (file)
@@ -38,7 +38,7 @@ GetRootHubPointer(
        
        KeInitializeEvent (&Event, NotificationEvent, FALSE);
        
-       Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE,
+       Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO,
                Pdo,
                NULL, sizeof(NULL),
                RootHubPointer, sizeof(*RootHubPointer),
@@ -52,6 +52,7 @@ GetRootHubPointer(
        }
        
        /* Initialize the status block before sending the IRP */
+       IoGetNextIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
        IoStatus.Status = STATUS_NOT_SUPPORTED;
        IoStatus.Information = 0;
        
@@ -94,7 +95,7 @@ UsbhubAddDevice(
        RtlZeroMemory(DeviceExtension, sizeof(HUB_DEVICE_EXTENSION));
        
        /* Get a pointer to the linux structure created by the USB controller,
-        * by sending IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE to lower device.
+        * by sending IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO to lower device.
         */
        Status = GetRootHubPointer(Pdo, (PVOID*)&DeviceExtension->dev);
        if (!NT_SUCCESS(Status))
@@ -159,7 +160,16 @@ DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
        if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
                return UsbhubDeviceControlFdo(DeviceObject, Irp);
        else
-               return UsbhubDeviceControlPdo(DeviceObject, Irp);
+               return IrpStub(DeviceObject, Irp);
+}
+
+static NTSTATUS STDCALL
+DispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
+{
+       if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
+               return IrpStub(DeviceObject, Irp);
+       else
+               return UsbhubInternalDeviceControlPdo(DeviceObject, Irp);
 }
 
 static NTSTATUS STDCALL
@@ -190,6 +200,7 @@ DriverEntry(
        DriverObject->MajorFunction[IRP_MJ_CLOSE] = UsbhubClose;
        DriverObject->MajorFunction[IRP_MJ_CLEANUP] = UsbhubCleanup;
        DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
+       DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = DispatchInternalDeviceControl;
        DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
        
        return STATUS_SUCCESS;
index ed8c456..763c06c 100644 (file)
@@ -80,6 +80,6 @@ UsbhubPnpPdo(
        IN PIRP Irp);
 
 NTSTATUS
-UsbhubDeviceControlPdo(
+UsbhubInternalDeviceControlPdo(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);