mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
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:
parent
1d77bcb312
commit
57fca2edb7
8 changed files with 28 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ UsbMpPdoPnp(
|
|||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS
|
||||
UsbMpPdoDeviceControl(
|
||||
UsbMpInternalPdoDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -80,6 +80,6 @@ UsbhubPnpPdo(
|
|||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS
|
||||
UsbhubDeviceControlPdo(
|
||||
UsbhubInternalDeviceControlPdo(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
|
Loading…
Reference in a new issue