mirror of
https://github.com/reactos/reactos.git
synced 2024-07-22 12:18:04 +00:00
[usb/usbhub]
- Start rewrite of usbhub driver using the old and dead usbhub driver in trunk. - Implement QueryRootHub for sending USB request to miniport driver. - Implement new IRP_MN_START_DEVICE. Get the roothubs PDO and FDO and forward the start device down to start the PDO. Get USBDI and HUB interfaces. Set all ports as returned by DCI GetExtendedHubInformation to powered and reset. - Temporary add some usb specific defines until header is fixed. - Fix Formatting. svn path=/trunk/; revision=48705
This commit is contained in:
parent
639f26f1b5
commit
74d5088c7d
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
||||||
* FILE: drivers/usb/cromwell/hub/misc.c
|
* FILE: drivers/usb/cromwell/hub/misc.c
|
||||||
* PURPOSE: Misceallenous operations
|
* PURPOSE: Misceallenous operations
|
||||||
*
|
*
|
||||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com),
|
* PROGRAMMERS: Herv<EFBFBD> Poussineau (hpoussin@reactos.com),
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
@ -13,54 +13,50 @@
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ForwardIrpAndWaitCompletion(
|
ForwardIrpAndWaitCompletion(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
IN PVOID Context)
|
IN PVOID Context)
|
||||||
{
|
{
|
||||||
if (Irp->PendingReturned)
|
if (Irp->PendingReturned)
|
||||||
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
|
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
|
||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
ForwardIrpAndWait(
|
ForwardIrpAndWait(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT LowerDevice = ((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
KEVENT Event;
|
||||||
KEVENT Event;
|
NTSTATUS Status;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
ASSERT(LowerDevice);
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
|
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||||
|
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
|
||||||
|
|
||||||
DPRINT("UHCI: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
Status = IoCallDriver(DeviceObject, Irp);
|
||||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
if (Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
Status = Irp->IoStatus.Status;
|
||||||
|
}
|
||||||
|
|
||||||
Status = IoCallDriver(LowerDevice, Irp);
|
return Status;
|
||||||
if (Status == STATUS_PENDING)
|
|
||||||
{
|
|
||||||
Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
Status = Irp->IoStatus.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
ForwardIrpAndForget(
|
ForwardIrpAndForget(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT LowerDevice = ((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
PDEVICE_OBJECT LowerDevice = ((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||||
|
|
||||||
ASSERT(LowerDevice);
|
ASSERT(LowerDevice);
|
||||||
|
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
return IoCallDriver(LowerDevice, Irp);
|
return IoCallDriver(LowerDevice, Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I really want PCSZ strings as last arguments because
|
/* I really want PCSZ strings as last arguments because
|
||||||
|
@ -68,99 +64,99 @@ ForwardIrpAndForget(
|
||||||
* identification */
|
* identification */
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
UsbhubInitMultiSzString(
|
UsbhubInitMultiSzString(
|
||||||
OUT PUNICODE_STRING Destination,
|
OUT PUNICODE_STRING Destination,
|
||||||
... /* list of PCSZ */)
|
... /* list of PCSZ */)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
PCSZ Source;
|
PCSZ Source;
|
||||||
ANSI_STRING AnsiString;
|
ANSI_STRING AnsiString;
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
ULONG DestinationSize = 0;
|
ULONG DestinationSize = 0;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
ASSERT(Destination);
|
ASSERT(Destination);
|
||||||
|
|
||||||
/* Calculate length needed for destination unicode string */
|
/* Calculate length needed for destination unicode string */
|
||||||
va_start(args, Destination);
|
va_start(args, Destination);
|
||||||
Source = va_arg(args, PCSZ);
|
Source = va_arg(args, PCSZ);
|
||||||
while (Source != NULL)
|
while (Source != NULL)
|
||||||
{
|
{
|
||||||
RtlInitAnsiString(&AnsiString, Source);
|
RtlInitAnsiString(&AnsiString, Source);
|
||||||
DestinationSize += RtlAnsiStringToUnicodeSize(&AnsiString)
|
DestinationSize += RtlAnsiStringToUnicodeSize(&AnsiString)
|
||||||
+ sizeof(WCHAR) /* final NULL */;
|
+ sizeof(WCHAR) /* final NULL */;
|
||||||
Source = va_arg(args, PCSZ);
|
Source = va_arg(args, PCSZ);
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (DestinationSize == 0)
|
if (DestinationSize == 0)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(Destination, NULL);
|
RtlInitUnicodeString(Destination, NULL);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize destination string */
|
/* Initialize destination string */
|
||||||
DestinationSize += sizeof(WCHAR); // final NULL
|
DestinationSize += sizeof(WCHAR); // final NULL
|
||||||
Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, USB_HUB_TAG);
|
Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, USB_HUB_TAG);
|
||||||
if (!Destination->Buffer)
|
if (!Destination->Buffer)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
Destination->Length = 0;
|
Destination->Length = 0;
|
||||||
Destination->MaximumLength = (USHORT)DestinationSize;
|
Destination->MaximumLength = (USHORT)DestinationSize;
|
||||||
|
|
||||||
/* Copy arguments to destination string */
|
/* Copy arguments to destination string */
|
||||||
/* Use a temporary unicode string, which buffer is shared with
|
/* Use a temporary unicode string, which buffer is shared with
|
||||||
* destination string, to copy arguments */
|
* destination string, to copy arguments */
|
||||||
UnicodeString.Length = Destination->Length;
|
UnicodeString.Length = Destination->Length;
|
||||||
UnicodeString.MaximumLength = Destination->MaximumLength;
|
UnicodeString.MaximumLength = Destination->MaximumLength;
|
||||||
UnicodeString.Buffer = Destination->Buffer;
|
UnicodeString.Buffer = Destination->Buffer;
|
||||||
va_start(args, Destination);
|
va_start(args, Destination);
|
||||||
Source = va_arg(args, PCSZ);
|
Source = va_arg(args, PCSZ);
|
||||||
while (Source != NULL)
|
while (Source != NULL)
|
||||||
{
|
{
|
||||||
RtlInitAnsiString(&AnsiString, Source);
|
RtlInitAnsiString(&AnsiString, Source);
|
||||||
Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
|
Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(Destination->Buffer, USB_HUB_TAG);
|
ExFreePoolWithTag(Destination->Buffer, USB_HUB_TAG);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Destination->Length += UnicodeString.Length + sizeof(WCHAR);
|
Destination->Length += UnicodeString.Length + sizeof(WCHAR);
|
||||||
UnicodeString.MaximumLength -= UnicodeString.Length + sizeof(WCHAR);
|
UnicodeString.MaximumLength -= UnicodeString.Length + sizeof(WCHAR);
|
||||||
UnicodeString.Buffer += UnicodeString.Length / sizeof(WCHAR) + 1;
|
UnicodeString.Buffer += UnicodeString.Length / sizeof(WCHAR) + 1;
|
||||||
UnicodeString.Length = 0;
|
UnicodeString.Length = 0;
|
||||||
Source = va_arg(args, PCSZ);
|
Source = va_arg(args, PCSZ);
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Finish multi-sz string */
|
/* Finish multi-sz string */
|
||||||
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = L'\0';
|
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = L'\0';
|
||||||
Destination->Length += sizeof(WCHAR);
|
Destination->Length += sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
UsbhubDuplicateUnicodeString(
|
UsbhubDuplicateUnicodeString(
|
||||||
OUT PUNICODE_STRING Destination,
|
OUT PUNICODE_STRING Destination,
|
||||||
IN PUNICODE_STRING Source,
|
IN PUNICODE_STRING Source,
|
||||||
IN POOL_TYPE PoolType)
|
IN POOL_TYPE PoolType)
|
||||||
{
|
{
|
||||||
ASSERT(Destination);
|
ASSERT(Destination);
|
||||||
|
|
||||||
if (Source == NULL)
|
if (Source == NULL)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(Destination, NULL);
|
RtlInitUnicodeString(Destination, NULL);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
|
Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
|
||||||
if (Destination->Buffer == NULL)
|
if (Destination->Buffer == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Destination->MaximumLength = Source->MaximumLength;
|
Destination->MaximumLength = Source->MaximumLength;
|
||||||
Destination->Length = Source->Length;
|
Destination->Length = Source->Length;
|
||||||
RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
|
RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* PURPOSE: IRP_MJ_PNP operations for PDOs
|
* PURPOSE: IRP_MJ_PNP operations for PDOs
|
||||||
*
|
*
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
|
* 2010 Michael Martin (michael.martin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
@ -22,7 +23,7 @@ UsbhubInternalDeviceControlPdo(
|
||||||
ULONG_PTR Information = 0;
|
ULONG_PTR Information = 0;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("Usbhub: UsbhubInternalDeviceControlPdo() called\n");
|
DPRINT1("Usbhub: UsbhubInternalDeviceControlPdo() called\n");
|
||||||
|
|
||||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
|
@ -33,7 +34,7 @@ UsbhubInternalDeviceControlPdo(
|
||||||
{
|
{
|
||||||
PHUB_DEVICE_EXTENSION DeviceExtension;
|
PHUB_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
DPRINT("Usbhub: IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
|
DPRINT1("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))
|
||||||
{
|
{
|
||||||
|
@ -71,28 +72,30 @@ UsbhubPdoStartDevice(
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PHUB_DEVICE_EXTENSION DeviceExtension;
|
PHUB_DEVICE_EXTENSION DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
/* Register and activate device interface */
|
/* Register and activate device interface */
|
||||||
|
/*
|
||||||
Status = IoRegisterDeviceInterface(
|
Status = IoRegisterDeviceInterface(
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
DeviceExtension->dev->descriptor.bDeviceClass == USB_CLASS_HUB ?
|
DeviceExtension->dev->descriptor.bDeviceClass == USB_CLASS_HUB ?
|
||||||
&GUID_DEVINTERFACE_USB_HUB :
|
&GUID_DEVINTERFACE_USB_HUB :
|
||||||
&GUID_DEVINTERFACE_USB_DEVICE,
|
&GUID_DEVINTERFACE_USB_DEVICE,
|
||||||
NULL, /* Reference string */
|
NULL,
|
||||||
&DeviceExtension->SymbolicLinkName);
|
&DeviceExtension->SymbolicLinkName);
|
||||||
|
*/
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
|
DPRINT1("Usbhub: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IoSetDeviceInterfaceState(&DeviceExtension->SymbolicLinkName, TRUE);
|
//Status = IoSetDeviceInterfaceState(&DeviceExtension->SymbolicLinkName, TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
DPRINT1("Usbhub: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,25 +122,25 @@ UsbhubPdoQueryId(
|
||||||
{
|
{
|
||||||
case BusQueryDeviceID:
|
case BusQueryDeviceID:
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
|
||||||
SourceString = &DeviceExtension->DeviceId;
|
SourceString = &DeviceExtension->DeviceId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BusQueryHardwareIDs:
|
case BusQueryHardwareIDs:
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
|
||||||
SourceString = &DeviceExtension->HardwareIds;
|
SourceString = &DeviceExtension->HardwareIds;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BusQueryCompatibleIDs:
|
case BusQueryCompatibleIDs:
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
|
||||||
SourceString = &DeviceExtension->CompatibleIds;
|
SourceString = &DeviceExtension->CompatibleIds;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BusQueryInstanceID:
|
case BusQueryInstanceID:
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
|
||||||
SourceString = &DeviceExtension->InstanceId;
|
SourceString = &DeviceExtension->InstanceId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -167,57 +170,20 @@ UsbhubPdoQueryDeviceText(
|
||||||
DeviceTextType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.DeviceTextType;
|
DeviceTextType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.DeviceTextType;
|
||||||
LocaleId = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.LocaleId;
|
LocaleId = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.LocaleId;
|
||||||
DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
DPRINT1("Usbhub: UsbhubPdoQueryDeviceText\n");
|
||||||
switch (DeviceTextType)
|
switch (DeviceTextType)
|
||||||
{
|
{
|
||||||
case DeviceTextDescription:
|
case DeviceTextDescription:
|
||||||
case DeviceTextLocationInformation:
|
case DeviceTextLocationInformation:
|
||||||
{
|
{
|
||||||
unsigned short size;
|
|
||||||
int ret;
|
|
||||||
PWCHAR buf;
|
|
||||||
PWCHAR bufret;
|
|
||||||
|
|
||||||
if (DeviceTextType == DeviceTextDescription)
|
if (DeviceTextType == DeviceTextDescription)
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
|
||||||
else
|
else
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextLocationInformation\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextLocationInformation\n");
|
||||||
|
|
||||||
if (!DeviceExtension->dev->descriptor.iProduct)
|
/* if (!DeviceExtension->dev->descriptor.iProduct)
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;*/
|
||||||
|
|
||||||
ret = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, &size, sizeof(size));
|
|
||||||
if (ret < 2)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: usb_get_string() failed with error %d\n", ret);
|
|
||||||
return STATUS_IO_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
size &= 0xff;
|
|
||||||
buf = ExAllocatePool(PagedPool, size);
|
|
||||||
if (buf == NULL)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: ExAllocatePool() failed\n");
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
ret = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, buf, size);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: usb_get_string() failed with error %d\n", ret);
|
|
||||||
ExFreePool(buf);
|
|
||||||
return STATUS_IO_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
bufret = ExAllocatePool(PagedPool, size - 2 /* size of length identifier */ + 2 /* final NULL */);
|
|
||||||
if (bufret == NULL)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: ExAllocatePool() failed\n");
|
|
||||||
ExFreePool(buf);
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(bufret, &buf[1], size - 2);
|
|
||||||
bufret[(size - 1) / sizeof(WCHAR)] = 0;
|
|
||||||
*Information = (ULONG_PTR)bufret;
|
|
||||||
ExFreePool(buf);
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -243,7 +209,7 @@ UsbhubPnpPdo(
|
||||||
{
|
{
|
||||||
case IRP_MN_START_DEVICE: /* 0x0 */
|
case IRP_MN_START_DEVICE: /* 0x0 */
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||||
Status = UsbhubPdoStartDevice(DeviceObject, Irp);
|
Status = UsbhubPdoStartDevice(DeviceObject, Irp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +217,7 @@ UsbhubPnpPdo(
|
||||||
{
|
{
|
||||||
PDEVICE_CAPABILITIES DeviceCapabilities;
|
PDEVICE_CAPABILITIES DeviceCapabilities;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
|
||||||
|
|
||||||
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
|
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
|
||||||
/* FIXME: capabilities can change with connected device */
|
/* FIXME: capabilities can change with connected device */
|
||||||
|
@ -279,11 +245,11 @@ UsbhubPnpPdo(
|
||||||
{
|
{
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
|
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
|
||||||
ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST));
|
ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST));
|
||||||
if (!ResourceList)
|
if (!ResourceList)
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: ExAllocatePool() failed\n");
|
DPRINT1("Usbhub: ExAllocatePool() failed\n");
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -298,11 +264,11 @@ UsbhubPnpPdo(
|
||||||
{
|
{
|
||||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceList;
|
PIO_RESOURCE_REQUIREMENTS_LIST ResourceList;
|
||||||
|
|
||||||
DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
|
DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
|
||||||
ResourceList = ExAllocatePool(PagedPool, sizeof(IO_RESOURCE_REQUIREMENTS_LIST));
|
ResourceList = ExAllocatePool(PagedPool, sizeof(IO_RESOURCE_REQUIREMENTS_LIST));
|
||||||
if (!ResourceList)
|
if (!ResourceList)
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: ExAllocatePool() failed\n");
|
DPRINT1("Usbhub: ExAllocatePool() failed\n");
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
* ReactOS USB hub driver
|
* ReactOS USB hub driver
|
||||||
* Copyright (C) 2004 Aleksey Bragin
|
* Copyright (C) 2004 Aleksey Bragin
|
||||||
* (C) 2005 Mark Tempel
|
* (C) 2005 Mark Tempel
|
||||||
* (C) 2005 Hervé Poussineau
|
* (C) 2005 Herv<EFBFBD> Poussineau
|
||||||
|
* (C) 2010 Michael Martin
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -26,159 +27,107 @@
|
||||||
|
|
||||||
/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/
|
/* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/
|
||||||
|
|
||||||
static NTSTATUS
|
|
||||||
GetRootHubPointer(
|
|
||||||
IN PDEVICE_OBJECT Pdo,
|
|
||||||
OUT PVOID* RootHubPointer)
|
|
||||||
{
|
|
||||||
KEVENT Event;
|
|
||||||
PIRP Irp;
|
|
||||||
IO_STATUS_BLOCK IoStatus;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
|
||||||
|
|
||||||
Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO,
|
|
||||||
Pdo,
|
|
||||||
NULL, sizeof(NULL),
|
|
||||||
RootHubPointer, sizeof(*RootHubPointer),
|
|
||||||
FALSE,
|
|
||||||
&Event,
|
|
||||||
&IoStatus);
|
|
||||||
if (Irp == NULL)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: IoBuildDeviceIoControlRequest() failed\n");
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the status block before sending the IRP */
|
|
||||||
IoGetNextIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
|
|
||||||
IoStatus.Status = STATUS_NOT_SUPPORTED;
|
|
||||||
IoStatus.Information = 0;
|
|
||||||
|
|
||||||
Status = IoCallDriver(Pdo, Irp);
|
|
||||||
|
|
||||||
if (Status == STATUS_PENDING)
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: Operation pending\n");
|
|
||||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
|
||||||
Status = IoStatus.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
UsbhubAddDevice(
|
UsbhubAddDevice(
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PDEVICE_OBJECT Pdo)
|
IN PDEVICE_OBJECT Pdo)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT Fdo;
|
PDEVICE_OBJECT Fdo;
|
||||||
PHUB_DEVICE_EXTENSION DeviceExtension;
|
PHUB_DEVICE_EXTENSION DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = IoCreateDevice(DriverObject,
|
Status = IoCreateDevice(DriverObject,
|
||||||
sizeof(HUB_DEVICE_EXTENSION),
|
sizeof(HUB_DEVICE_EXTENSION),
|
||||||
NULL, /* DeviceName */
|
NULL, /* DeviceName */
|
||||||
FILE_DEVICE_BUS_EXTENDER,
|
FILE_DEVICE_BUS_EXTENDER,
|
||||||
0,
|
FILE_AUTOGENERATED_DEVICE_NAME,
|
||||||
FALSE,
|
FALSE,
|
||||||
&Fdo);
|
&Fdo);
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Usbhub: IoCreateDevice() failed with status 0x%08lx\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// zerofill device extension
|
if (!NT_SUCCESS(Status))
|
||||||
DeviceExtension = (PHUB_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
{
|
||||||
RtlZeroMemory(DeviceExtension, sizeof(HUB_DEVICE_EXTENSION));
|
DPRINT1("Usbhub: IoCreateDevice() failed with status 0x%08lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get a pointer to the linux structure created by the USB controller,
|
// zerofill device extension
|
||||||
* by sending IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO to lower device.
|
DeviceExtension = (PHUB_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||||
*/
|
RtlZeroMemory(DeviceExtension, sizeof(HUB_DEVICE_EXTENSION));
|
||||||
Status = GetRootHubPointer(Pdo, (PVOID*)&DeviceExtension->dev);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Usbhub: GetRootHubPointer() failed with status 0x%08lx\n", Status);
|
|
||||||
IoDeleteDevice(Fdo);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
DeviceExtension->dev->dev.dev_ext = Pdo;
|
|
||||||
|
|
||||||
DeviceExtension->IsFDO = TRUE;
|
DeviceExtension->IsFDO = TRUE;
|
||||||
Fdo->Flags |= DO_POWER_PAGABLE;
|
Fdo->Flags |= DO_POWER_PAGABLE;
|
||||||
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
|
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Usbhub: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
|
DPRINT("Usbhub: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
|
||||||
IoDeleteDevice(Fdo);
|
IoDeleteDevice(Fdo);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
Fdo->Flags |= DO_BUFFERED_IO;
|
Fdo->Flags |= DO_BUFFERED_IO;
|
||||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
IrpStub(
|
IrpStub(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||||
{
|
{
|
||||||
DPRINT1("Usbhub: FDO stub for major function 0x%lx\n",
|
DPRINT1("Usbhub: FDO stub for major function 0x%lx\n",
|
||||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
||||||
|
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We can't forward request to the lower driver, because
|
||||||
|
* we are a Pdo, so we don't have lower driver...
|
||||||
|
*/
|
||||||
|
DPRINT1("Usbhub: PDO stub for major function 0x%lx\n",
|
||||||
|
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
#endif
|
#endif
|
||||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We can't forward request to the lower driver, because
|
|
||||||
* we are a Pdo, so we don't have lower driver...
|
|
||||||
*/
|
|
||||||
DPRINT1("Usbhub: PDO stub for major function 0x%lx\n",
|
|
||||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
|
||||||
#ifndef NDEBUG
|
|
||||||
DbgBreakPoint();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
DPRINT1("Usbhub: DispatchDeviceControl\n");
|
||||||
return UsbhubDeviceControlFdo(DeviceObject, Irp);
|
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||||
else
|
return UsbhubDeviceControlFdo(DeviceObject, Irp);
|
||||||
return IrpStub(DeviceObject, Irp);
|
else
|
||||||
|
return IrpStub(DeviceObject, Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
DispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
DispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
DPRINT1("Usbhub: DispatchInternalDeviceControl\n");
|
||||||
return IrpStub(DeviceObject, Irp);
|
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||||
else
|
return IrpStub(DeviceObject, Irp);
|
||||||
return UsbhubInternalDeviceControlPdo(DeviceObject, Irp);
|
else
|
||||||
|
return UsbhubInternalDeviceControlPdo(DeviceObject, Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
DPRINT1("Usbhub: DispatchPnp\n");
|
||||||
return UsbhubPnpFdo(DeviceObject, Irp);
|
if (((PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||||
else
|
return UsbhubPnpFdo(DeviceObject, Irp);
|
||||||
return UsbhubPnpPdo(DeviceObject, Irp);
|
else
|
||||||
|
return UsbhubPnpPdo(DeviceObject, Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -186,23 +135,24 @@ DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
DriverEntry(
|
DriverEntry(
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PUNICODE_STRING RegistryPath)
|
IN PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
DriverObject->DriverExtension->AddDevice = UsbhubAddDevice;
|
DriverObject->DriverExtension->AddDevice = UsbhubAddDevice;
|
||||||
|
DPRINT1("Usbhub: DriverEntry\n");
|
||||||
|
|
||||||
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||||
DriverObject->MajorFunction[i] = IrpStub;
|
DriverObject->MajorFunction[i] = IrpStub;
|
||||||
|
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = UsbhubCreate;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = UsbhubCreate;
|
||||||
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_INTERNAL_DEVICE_CONTROL] = DispatchInternalDeviceControl;
|
||||||
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
|
DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,98 @@
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
|
#include <hubbusif.h>
|
||||||
|
#include <usbbusif.h>
|
||||||
#include <usbioctl.h>
|
#include <usbioctl.h>
|
||||||
|
#include <usb.h>
|
||||||
#include "../miniport/usb_wrapper.h"
|
#include <debug.h>
|
||||||
#include "../usbport/hub.h"
|
//BROKEN: #include <usbprotocoldefs.h>
|
||||||
|
|
||||||
#define USB_HUB_TAG 'hbsu'
|
#define USB_HUB_TAG 'hbsu'
|
||||||
|
#define USB_MAXCHILDREN 127
|
||||||
|
|
||||||
|
/* Lifted from broken header above */
|
||||||
|
#define C_HUB_LOCAL_POWER 0
|
||||||
|
#define C_HUB_OVER_CURRENT 1
|
||||||
|
#define PORT_CONNECTION 0
|
||||||
|
#define PORT_ENABLE 1
|
||||||
|
#define PORT_SUSPEND 2
|
||||||
|
#define PORT_OVER_CURRENT 3
|
||||||
|
#define PORT_RESET 4
|
||||||
|
#define PORT_POWER 8
|
||||||
|
#define PORT_LOW_SPEED 9
|
||||||
|
#define C_PORT_CONNECTION 16
|
||||||
|
#define C_PORT_ENABLE 17
|
||||||
|
#define C_PORT_SUSPEND 18
|
||||||
|
#define C_PORT_OVER_CURRENT 19
|
||||||
|
#define C_PORT_RESET 20
|
||||||
|
#define PORT_TEST 21
|
||||||
|
#define PORT_INDICATOR 22
|
||||||
|
|
||||||
|
typedef struct _USB_ENDPOINT
|
||||||
|
{
|
||||||
|
ULONG Flags;
|
||||||
|
LIST_ENTRY UrbList;
|
||||||
|
struct _USB_INTERFACE *Interface;
|
||||||
|
USB_ENDPOINT_DESCRIPTOR EndPointDescriptor;
|
||||||
|
} USB_ENDPOINT, *PUSB_ENDPOINT;
|
||||||
|
|
||||||
|
typedef struct _USB_INTERFACE
|
||||||
|
{
|
||||||
|
struct _USB_CONFIGURATION *Config;
|
||||||
|
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
|
||||||
|
USB_ENDPOINT *EndPoints[];
|
||||||
|
} USB_INTERFACE, *PUSB_INTERFACE;
|
||||||
|
|
||||||
|
typedef struct _USB_CONFIGURATION
|
||||||
|
{
|
||||||
|
struct _USB_DEVICE *Device;
|
||||||
|
USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
|
||||||
|
USB_INTERFACE *Interfaces[];
|
||||||
|
} USB_CONFIGURATION, *PUSB_CONFIGURATION;
|
||||||
|
|
||||||
|
typedef struct _USB_DEVICE
|
||||||
|
{
|
||||||
|
UCHAR Address;
|
||||||
|
ULONG Port;
|
||||||
|
PVOID ParentDevice;
|
||||||
|
BOOLEAN IsHub;
|
||||||
|
USB_DEVICE_SPEED DeviceSpeed;
|
||||||
|
USB_DEVICE_TYPE DeviceType;
|
||||||
|
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
||||||
|
USB_CONFIGURATION *ActiveConfig;
|
||||||
|
USB_INTERFACE *ActiveInterface;
|
||||||
|
USB_CONFIGURATION **Configs;
|
||||||
|
|
||||||
|
} USB_DEVICE, *PUSB_DEVICE;
|
||||||
|
|
||||||
typedef struct _HUB_DEVICE_EXTENSION
|
typedef struct _HUB_DEVICE_EXTENSION
|
||||||
{
|
{
|
||||||
BOOLEAN IsFDO;
|
BOOLEAN IsFDO;
|
||||||
struct usb_device* dev;
|
USB_DEVICE* dev;
|
||||||
PDEVICE_OBJECT LowerDevice;
|
PDEVICE_OBJECT LowerDevice;
|
||||||
|
ULONG ChildCount;
|
||||||
PDEVICE_OBJECT Children[USB_MAXCHILDREN];
|
PDEVICE_OBJECT Children[USB_MAXCHILDREN];
|
||||||
|
|
||||||
/* Fields valid only when IsFDO == FALSE */
|
PUSB_DEVICE RootHubUsbDevice;
|
||||||
UNICODE_STRING DeviceId; // REG_SZ
|
|
||||||
UNICODE_STRING InstanceId; // REG_SZ
|
PDEVICE_OBJECT RootHubPdo;
|
||||||
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
|
PDEVICE_OBJECT RootHubFdo;
|
||||||
UNICODE_STRING CompatibleIds; // REG_MULTI_SZ
|
|
||||||
UNICODE_STRING SymbolicLinkName;
|
ULONG HubCount;
|
||||||
|
|
||||||
|
USB_BUS_INTERFACE_HUB_V5 HubInterface;
|
||||||
|
USB_BUS_INTERFACE_USBDI_V2 UsbDInterface;
|
||||||
|
|
||||||
|
USB_HUB_DESCRIPTOR HubDescriptor;
|
||||||
|
USB_DEVICE_DESCRIPTOR HubDeviceDescriptor;
|
||||||
|
USB_CONFIGURATION_DESCRIPTOR HubConfig;
|
||||||
|
USB_EXTHUB_INFORMATION_0 UsbExtHubInfo;
|
||||||
|
|
||||||
|
/* Fields valid only when IsFDO == FALSE */
|
||||||
|
UNICODE_STRING DeviceId; // REG_SZ
|
||||||
|
UNICODE_STRING InstanceId; // REG_SZ
|
||||||
|
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
|
||||||
|
UNICODE_STRING CompatibleIds; // REG_MULTI_SZ
|
||||||
|
UNICODE_STRING SymbolicLinkName;
|
||||||
} HUB_DEVICE_EXTENSION, *PHUB_DEVICE_EXTENSION;
|
} HUB_DEVICE_EXTENSION, *PHUB_DEVICE_EXTENSION;
|
||||||
|
|
||||||
/* createclose.c */
|
/* createclose.c */
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
<module name="usbhub" type="kernelmodedriver" installbase="system32/drivers" installname="usbhub.sys">
|
<module name="usbhub" type="kernelmodedriver" installbase="system32/drivers" installname="usbhub.sys">
|
||||||
<include>../miniport/linux</include>
|
|
||||||
<library>sys_base</library>
|
|
||||||
<library>ntoskrnl</library>
|
<library>ntoskrnl</library>
|
||||||
<library>hal</library>
|
<library>hal</library>
|
||||||
<library>usbport</library>
|
|
||||||
<file>createclose.c</file>
|
<file>createclose.c</file>
|
||||||
<file>fdo.c</file>
|
<file>fdo.c</file>
|
||||||
<file>misc.c</file>
|
<file>misc.c</file>
|
||||||
|
|
Loading…
Reference in a new issue