From 57fca2edb7c8e09863332e6abca2df64e96978c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Mon, 15 May 2006 16:38:49 +0000 Subject: [PATCH] Rename IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE to IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO, and send it with major code IRP_MJ_INTERNAL_DEVICE_CONTROL svn path=/trunk/; revision=21909 --- reactos/drivers/usb/miniport/common/main.c | 2 +- reactos/drivers/usb/miniport/common/pdo.c | 12 +++++------- reactos/drivers/usb/miniport/common/usbcommon.h | 2 +- reactos/drivers/usb/miniport/sys/linuxwrapper.c | 2 +- reactos/drivers/usb/miniport/usb_wrapper.h | 2 -- reactos/drivers/usb/usbhub/pdo.c | 10 +++++----- reactos/drivers/usb/usbhub/usbhub.c | 17 ++++++++++++++--- reactos/drivers/usb/usbhub/usbhub.h | 2 +- 8 files changed, 28 insertions(+), 21 deletions(-) diff --git a/reactos/drivers/usb/miniport/common/main.c b/reactos/drivers/usb/miniport/common/main.c index e85401c6c67..5d2386c9295 100644 --- a/reactos/drivers/usb/miniport/common/main.c +++ b/reactos/drivers/usb/miniport/common/main.c @@ -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 diff --git a/reactos/drivers/usb/miniport/common/pdo.c b/reactos/drivers/usb/miniport/common/pdo.c index e4854fc611e..bebe1c4629b 100644 --- a/reactos/drivers/usb/miniport/common/pdo.c +++ b/reactos/drivers/usb/miniport/common/pdo.c @@ -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); } diff --git a/reactos/drivers/usb/miniport/common/usbcommon.h b/reactos/drivers/usb/miniport/common/usbcommon.h index 2f5090efa77..f48c2244a42 100644 --- a/reactos/drivers/usb/miniport/common/usbcommon.h +++ b/reactos/drivers/usb/miniport/common/usbcommon.h @@ -90,7 +90,7 @@ UsbMpPdoPnp( IN PIRP Irp); NTSTATUS -UsbMpPdoDeviceControl( +UsbMpInternalPdoDeviceControl( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); diff --git a/reactos/drivers/usb/miniport/sys/linuxwrapper.c b/reactos/drivers/usb/miniport/sys/linuxwrapper.c index bc7c26c4b50..376b37fd1d2 100644 --- a/reactos/drivers/usb/miniport/sys/linuxwrapper.c +++ b/reactos/drivers/usb/miniport/sys/linuxwrapper.c @@ -198,7 +198,7 @@ int my_driver_register(struct device_driver *driver) if (drvs_numprobe); + printk("driver_register %i: %p %p\n",drvs_num,driver,driver->probe); m_drivers[drvs_num++]=driver; return 0; diff --git a/reactos/drivers/usb/miniport/usb_wrapper.h b/reactos/drivers/usb/miniport/usb_wrapper.h index 52c9b085cf3..f8af80646ed 100644 --- a/reactos/drivers/usb/miniport/usb_wrapper.h +++ b/reactos/drivers/usb/miniport/usb_wrapper.h @@ -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) diff --git a/reactos/drivers/usb/usbhub/pdo.c b/reactos/drivers/usb/usbhub/pdo.c index d7d117fcb46..60b5c2b96c1 100644 --- a/reactos/drivers/usb/usbhub/pdo.c +++ b/reactos/drivers/usb/usbhub/pdo.c @@ -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)) { diff --git a/reactos/drivers/usb/usbhub/usbhub.c b/reactos/drivers/usb/usbhub/usbhub.c index 1cd193b0214..2b86dfe0bca 100644 --- a/reactos/drivers/usb/usbhub/usbhub.c +++ b/reactos/drivers/usb/usbhub/usbhub.c @@ -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; diff --git a/reactos/drivers/usb/usbhub/usbhub.h b/reactos/drivers/usb/usbhub/usbhub.h index ed8c456d37d..763c06cdd02 100644 --- a/reactos/drivers/usb/usbhub/usbhub.h +++ b/reactos/drivers/usb/usbhub/usbhub.h @@ -80,6 +80,6 @@ UsbhubPnpPdo( IN PIRP Irp); NTSTATUS -UsbhubDeviceControlPdo( +UsbhubInternalDeviceControlPdo( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);