Author: hpoussin Date: Mon May 15 20:38:49 2006 New Revision: 21909
URL: http://svn.reactos.ru/svn/reactos?rev=21909&view=rev Log: 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
Modified: trunk/reactos/drivers/usb/miniport/common/main.c trunk/reactos/drivers/usb/miniport/common/pdo.c trunk/reactos/drivers/usb/miniport/common/usbcommon.h trunk/reactos/drivers/usb/miniport/sys/linuxwrapper.c trunk/reactos/drivers/usb/miniport/usb_wrapper.h trunk/reactos/drivers/usb/usbhub/pdo.c trunk/reactos/drivers/usb/usbhub/usbhub.c trunk/reactos/drivers/usb/usbhub/usbhub.h
Modified: trunk/reactos/drivers/usb/miniport/common/main.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/common/... ============================================================================== --- trunk/reactos/drivers/usb/miniport/common/main.c (original) +++ trunk/reactos/drivers/usb/miniport/common/main.c Mon May 15 20:38:49 2006 @@ -381,7 +381,7 @@ if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO) return UsbMpFdoDeviceControl(DeviceObject, Irp); else - return UsbMpPdoDeviceControl(DeviceObject, Irp); + return IrpStub(DeviceObject, Irp); }
static NTSTATUS NTAPI
Modified: trunk/reactos/drivers/usb/miniport/common/pdo.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/common/... ============================================================================== --- trunk/reactos/drivers/usb/miniport/common/pdo.c (original) +++ trunk/reactos/drivers/usb/miniport/common/pdo.c Mon May 15 20:38:49 2006 @@ -60,7 +60,7 @@ }
NTSTATUS -UsbMpPdoDeviceControl( +UsbMpPdoInternalDeviceControlCore( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { @@ -68,18 +68,18 @@ 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 @@ } else { - DPRINT("We got IOCTL for UsbCore\n"); - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; + return UsbMpPdoInternalDeviceControlCore(DeviceObject, Irp); }
Modified: trunk/reactos/drivers/usb/miniport/common/usbcommon.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/common/... ============================================================================== --- trunk/reactos/drivers/usb/miniport/common/usbcommon.h (original) +++ trunk/reactos/drivers/usb/miniport/common/usbcommon.h Mon May 15 20:38:49 2006 @@ -90,7 +90,7 @@ IN PIRP Irp);
NTSTATUS -UsbMpPdoDeviceControl( +UsbMpInternalPdoDeviceControl( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
Modified: trunk/reactos/drivers/usb/miniport/sys/linuxwrapper.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/sys/lin... ============================================================================== --- trunk/reactos/drivers/usb/miniport/sys/linuxwrapper.c (original) +++ trunk/reactos/drivers/usb/miniport/sys/linuxwrapper.c Mon May 15 20:38:49 2006 @@ -198,7 +198,7 @@
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;
Modified: trunk/reactos/drivers/usb/miniport/usb_wrapper.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/miniport/usb_wra... ============================================================================== --- trunk/reactos/drivers/usb/miniport/usb_wrapper.h (original) +++ trunk/reactos/drivers/usb/miniport/usb_wrapper.h Mon May 15 20:38:49 2006 @@ -46,5 +46,3 @@ #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)
Modified: trunk/reactos/drivers/usb/usbhub/pdo.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbhub/pdo.c?rev... ============================================================================== --- trunk/reactos/drivers/usb/usbhub/pdo.c (original) +++ trunk/reactos/drivers/usb/usbhub/pdo.c Mon May 15 20:38:49 2006 @@ -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 @@ 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)) {
Modified: trunk/reactos/drivers/usb/usbhub/usbhub.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbhub/usbhub.c?... ============================================================================== --- trunk/reactos/drivers/usb/usbhub/usbhub.c (original) +++ trunk/reactos/drivers/usb/usbhub/usbhub.c Mon May 15 20:38:49 2006 @@ -38,7 +38,7 @@ 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 @@ } /* 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 @@ 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 @@ 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 @@ 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;
Modified: trunk/reactos/drivers/usb/usbhub/usbhub.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/usb/usbhub/usbhub.h?... ============================================================================== --- trunk/reactos/drivers/usb/usbhub/usbhub.h (original) +++ trunk/reactos/drivers/usb/usbhub/usbhub.h Mon May 15 20:38:49 2006 @@ -80,6 +80,6 @@ IN PIRP Irp);
NTSTATUS -UsbhubDeviceControlPdo( +UsbhubInternalDeviceControlPdo( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);