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
This commit is contained in:
Hervé Poussineau 2006-05-15 16:38:49 +00:00
parent 1d77bcb312
commit 57fca2edb7
8 changed files with 28 additions and 21 deletions

View file

@ -381,7 +381,7 @@ DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO) if (((PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
return UsbMpFdoDeviceControl(DeviceObject, Irp); return UsbMpFdoDeviceControl(DeviceObject, Irp);
else else
return UsbMpPdoDeviceControl(DeviceObject, Irp); return IrpStub(DeviceObject, Irp);
} }
static NTSTATUS NTAPI static NTSTATUS NTAPI

View file

@ -60,7 +60,7 @@ UsbMpPdoCleanup(
} }
NTSTATUS NTSTATUS
UsbMpPdoDeviceControl( UsbMpPdoInternalDeviceControlCore(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
{ {
@ -68,18 +68,18 @@ UsbMpPdoDeviceControl(
ULONG_PTR Information = 0; ULONG_PTR Information = 0;
NTSTATUS Status; NTSTATUS Status;
DPRINT("UsbMpDeviceControlPdo() called\n"); DPRINT("UsbMpPdoInternalDeviceControl() called\n");
Stack = IoGetCurrentIrpStackLocation(Irp); Stack = IoGetCurrentIrpStackLocation(Irp);
Status = Irp->IoStatus.Status; Status = Irp->IoStatus.Status;
switch (Stack->Parameters.DeviceIoControl.IoControlCode) 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; 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 if (Irp->AssociatedIrp.SystemBuffer == NULL
|| Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID)) || Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID))
{ {
@ -609,9 +609,7 @@ UsbMpPdoInternalDeviceControl(
} }
else else
{ {
DPRINT("We got IOCTL for UsbCore\n"); return UsbMpPdoInternalDeviceControlCore(DeviceObject, Irp);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
} }

View file

@ -90,7 +90,7 @@ UsbMpPdoPnp(
IN PIRP Irp); IN PIRP Irp);
NTSTATUS NTSTATUS
UsbMpPdoDeviceControl( UsbMpInternalPdoDeviceControl(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp); IN PIRP Irp);

View file

@ -198,7 +198,7 @@ int my_driver_register(struct device_driver *driver)
if (drvs_num<MAX_DRVS) 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; m_drivers[drvs_num++]=driver;
return 0; return 0;

View file

@ -46,5 +46,3 @@ int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
#include "linux/usb.h" #include "linux/usb.h"
#include "linux/pci_ids.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)

View file

@ -4,7 +4,7 @@
* FILE: drivers/usb/cromwell/hub/pdo.c * FILE: drivers/usb/cromwell/hub/pdo.c
* PURPOSE: IRP_MJ_PNP operations for PDOs * PURPOSE: IRP_MJ_PNP operations for PDOs
* *
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com) * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
*/ */
#define NDEBUG #define NDEBUG
@ -14,7 +14,7 @@
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003) #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
NTSTATUS NTSTATUS
UsbhubDeviceControlPdo( UsbhubInternalDeviceControlPdo(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp) IN PIRP Irp)
{ {
@ -22,18 +22,18 @@ UsbhubDeviceControlPdo(
ULONG_PTR Information = 0; ULONG_PTR Information = 0;
NTSTATUS Status; NTSTATUS Status;
DPRINT("Usbhub: UsbhubDeviceControlPdo() called\n"); DPRINT("Usbhub: UsbhubInternalDeviceControlPdo() called\n");
Stack = IoGetCurrentIrpStackLocation(Irp); Stack = IoGetCurrentIrpStackLocation(Irp);
Status = Irp->IoStatus.Status; Status = Irp->IoStatus.Status;
switch (Stack->Parameters.DeviceIoControl.IoControlCode) 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; 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 if (Irp->AssociatedIrp.SystemBuffer == NULL
|| Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID)) || Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PVOID))
{ {

View file

@ -38,7 +38,7 @@ GetRootHubPointer(
KeInitializeEvent (&Event, NotificationEvent, FALSE); KeInitializeEvent (&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_ROOT_USB_DEVICE, Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO,
Pdo, Pdo,
NULL, sizeof(NULL), NULL, sizeof(NULL),
RootHubPointer, sizeof(*RootHubPointer), RootHubPointer, sizeof(*RootHubPointer),
@ -52,6 +52,7 @@ GetRootHubPointer(
} }
/* Initialize the status block before sending the IRP */ /* Initialize the status block before sending the IRP */
IoGetNextIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
IoStatus.Status = STATUS_NOT_SUPPORTED; IoStatus.Status = STATUS_NOT_SUPPORTED;
IoStatus.Information = 0; IoStatus.Information = 0;
@ -94,7 +95,7 @@ UsbhubAddDevice(
RtlZeroMemory(DeviceExtension, sizeof(HUB_DEVICE_EXTENSION)); RtlZeroMemory(DeviceExtension, sizeof(HUB_DEVICE_EXTENSION));
/* Get a pointer to the linux structure created by the USB controller, /* 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); Status = GetRootHubPointer(Pdo, (PVOID*)&DeviceExtension->dev);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -159,7 +160,16 @@ DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO) if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
return UsbhubDeviceControlFdo(DeviceObject, Irp); return UsbhubDeviceControlFdo(DeviceObject, Irp);
else 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 static NTSTATUS STDCALL
@ -190,6 +200,7 @@ DriverEntry(
DriverObject->MajorFunction[IRP_MJ_CLOSE] = UsbhubClose; DriverObject->MajorFunction[IRP_MJ_CLOSE] = UsbhubClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = UsbhubCleanup; DriverObject->MajorFunction[IRP_MJ_CLEANUP] = UsbhubCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = DispatchInternalDeviceControl;
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp; DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -80,6 +80,6 @@ UsbhubPnpPdo(
IN PIRP Irp); IN PIRP Irp);
NTSTATUS NTSTATUS
UsbhubDeviceControlPdo( UsbhubInternalDeviceControlPdo(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp); IN PIRP Irp);