Modified: trunk/reactos/bootdata/hivesys.inf
Modified: trunk/reactos/drivers/usb/miniport/common/fdo.c
Modified: trunk/reactos/drivers/usb/miniport/common/pdo.c
Modified: trunk/reactos/drivers/usb/usbhub/pdo.c
Modified: trunk/reactos/drivers/usb/usbport/usbport.def
Modified: trunk/reactos/media/inf/usbport.inf
--- trunk/reactos/bootdata/hivesys.inf 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/bootdata/hivesys.inf 2005-09-19 10:04:07 UTC (rev 17930)
@@ -630,6 +630,7 @@
HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","DisplayName",0x00000000,"ReactOS USB HUB cromwell-type driver"
;hard coded values
HKLM,"SYSTEM\CurrentControlSet\Enum\USB\ROOT_HUB\0000","Service",0x0000000,"usbhub"
+HKLM,"SYSTEM\CurrentControlSet\Enum\USB\ROOT_HUB20\0000","Service",0x0000000,"usbhub"
; ReactOS PCNet NIC driver
; To use the AMD supplied driver change the driver name to pcntn5m.sys
--- trunk/reactos/drivers/usb/miniport/common/fdo.c 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/drivers/usb/miniport/common/fdo.c 2005-09-19 10:04:07 UTC (rev 17930)
@@ -190,7 +190,7 @@
switch (MinorFunction)
{
- case IRP_MN_START_DEVICE:
+ case IRP_MN_START_DEVICE: /* 0x00 */
{
Status = ForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
@@ -198,12 +198,15 @@
break;
}
- case IRP_MN_REMOVE_DEVICE:
- case IRP_MN_QUERY_REMOVE_DEVICE:
- case IRP_MN_CANCEL_REMOVE_DEVICE:
- case IRP_MN_SURPRISE_REMOVAL:
+ case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */
+ case IRP_MN_CANCEL_REMOVE_DEVICE: /* 0x03 */
+ {
+ return ForwardIrpAndForget(DeviceObject, Irp);
+ }
- case IRP_MN_STOP_DEVICE:
+ case IRP_MN_REMOVE_DEVICE: /* 0x02 */
+ case IRP_MN_STOP_DEVICE: /* 0x04 */
+ case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */
{
Status = ForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status))
@@ -211,8 +214,9 @@
IoDeleteDevice(DeviceObject); // just delete device for now
break;
}
- case IRP_MN_QUERY_STOP_DEVICE:
- case IRP_MN_CANCEL_STOP_DEVICE:
+
+ case IRP_MN_QUERY_STOP_DEVICE: /* 0x05 */
+ case IRP_MN_CANCEL_STOP_DEVICE: /* 0x06 */
{
Status = STATUS_SUCCESS;
break;
@@ -244,7 +248,7 @@
default:
{
- DPRINT1("USBMP: unknown minor function 0x%lx\n", MinorFunction);
+ DPRINT1("USBMP: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
return ForwardIrpAndForget(DeviceObject, Irp);
}
}
--- trunk/reactos/drivers/usb/miniport/common/pdo.c 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/drivers/usb/miniport/common/pdo.c 2005-09-19 10:04:07 UTC (rev 17930)
@@ -80,36 +80,49 @@
ULONG IdType;
UNICODE_STRING SourceString;
UNICODE_STRING String;
+ struct usb_device *roothub;
NTSTATUS Status = STATUS_SUCCESS;
IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
RtlInitUnicodeString(&String, NULL);
+ DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceExtension->FunctionalDeviceObject->DeviceExtension;
+ roothub = ((struct usb_hcd*)DeviceExtension->pdev->data)->self.root_hub;
switch (IdType)
{
case BusQueryDeviceID:
{
DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
- RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB");
+ if (roothub->speed == USB_SPEED_LOW || roothub->speed == USB_SPEED_FULL)
+ RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB"); /* USB 1.1 */
+ else
+ RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB20"); /* USB 2.0 */
break;
}
case BusQueryHardwareIDs:
{
- //CHAR Buffer[2][40];
+ CHAR Buffer[2][40];
+ PCHAR RootHubName;
+ USHORT Vendor, Product, Revision;
+
DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
- /*FIXME: sprintf(Buffer[0], "USB\\VID%04X&PID%04X&REV%04X",
- VENDOR,
- PRODUCT,
- REV);
+ Vendor = DeviceExtension->pdev->vendor;
+ Product = DeviceExtension->pdev->device;
+ Revision = 0; /* FIXME */
+
+ sprintf(Buffer[0], "USB\\VID%04X&PID%04X&REV%04X",
+ Vendor, Product, Revision);
sprintf(Buffer[1], "USB\\VID%04X&PID%04X",
- VENDOR,
- PRODUCT);
+ Vendor, Product);
+ if (roothub->speed == USB_SPEED_LOW || roothub->speed == USB_SPEED_FULL)
+ RootHubName = "USB\\ROOT_HUB"; /* USB 1.1 */
+ else
+ RootHubName = "USB\\ROOT_HUB20"; /* USB 2.0 */
Status = UsbMpInitMultiSzString(
&SourceString,
- Buffer[0], Buffer[1], "USB\\ROOT_HUB", NULL);*/
- Status = UsbMpInitMultiSzString(&SourceString, "USB\\ROOT_HUB", NULL);
+ Buffer[0], Buffer[1], RootHubName, NULL);
break;
}
case BusQueryCompatibleIDs:
--- trunk/reactos/drivers/usb/usbhub/pdo.c 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/drivers/usb/usbhub/pdo.c 2005-09-19 10:04:07 UTC (rev 17930)
@@ -133,6 +133,61 @@
return Status;
}
+static NTSTATUS
+UsbhubPdoQueryDeviceText(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ OUT ULONG_PTR* Information)
+{
+ PHUB_DEVICE_EXTENSION DeviceExtension;
+ DEVICE_TEXT_TYPE DeviceTextType;
+ LCID LocaleId;
+
+ DeviceTextType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.DeviceTextType;
+ LocaleId = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.LocaleId;
+ DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+ switch (DeviceTextType)
+ {
+ /*case DeviceTextDescription:
+ {
+ DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
+ return STATUS_NOT_IMPLEMENTED;
+ }*/
+ case DeviceTextLocationInformation:
+ {
+ int size;
+ char *buf;
+
+ DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextLocationInformation\n");
+ if (!DeviceExtension->dev->descriptor.iProduct)
+ return STATUS_NOT_SUPPORTED;
+
+ size = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, NULL, 0);
+ if (size < 2)
+ {
+ DPRINT("Usbhub: usb_get_string() failed\n");
+ return STATUS_IO_DEVICE_ERROR;
+ }
+ buf = ExAllocatePool(PagedPool, size);
+ if (buf == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+ size = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, buf, size);
+ if (size < 0)
+ {
+ DPRINT("Usbhub: usb_get_string() failed\n");
+ ExFreePool(buf);
+ return STATUS_IO_DEVICE_ERROR;
+ }
+ *Information = (ULONG_PTR)buf;
+ return STATUS_SUCCESS;
+ }
+ default:
+ DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown device text type 0x%lx\n", DeviceTextType);
+ return STATUS_NOT_SUPPORTED;
+ }
+}
+
NTSTATUS STDCALL
UsbhubPnpPdo(
IN PDEVICE_OBJECT DeviceObject,
@@ -154,6 +209,82 @@
Status = UsbhubPdoStartDevice(DeviceObject, Irp);
break;
}
+ case IRP_MN_QUERY_CAPABILITIES: /* 0x09 */
+ {
+ PDEVICE_CAPABILITIES DeviceCapabilities;
+ ULONG i;
+ DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
+
+ DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
+ /* FIXME: capabilities can change with connected device */
+ DeviceCapabilities->LockSupported = TRUE;
+ DeviceCapabilities->EjectSupported = FALSE;
+ DeviceCapabilities->Removable = FALSE;
+ DeviceCapabilities->DockDevice = FALSE;
+ DeviceCapabilities->UniqueID = FALSE;
+ DeviceCapabilities->SilentInstall = TRUE;
+ DeviceCapabilities->RawDeviceOK = FALSE;
+ DeviceCapabilities->SurpriseRemovalOK = FALSE;
+ DeviceCapabilities->HardwareDisabled = FALSE; /* FIXME */
+ //DeviceCapabilities->NoDisplayInUI = FALSE; /* FIXME */
+ DeviceCapabilities->DeviceState[0] = PowerDeviceD0; /* FIXME */
+ for (i = 0; i < PowerSystemMaximum; i++)
+ DeviceCapabilities->DeviceState[i] = PowerDeviceD3; /* FIXME */
+ //DeviceCapabilities->DeviceWake = PowerDeviceUndefined; /* FIXME */
+ DeviceCapabilities->D1Latency = 0; /* FIXME */
+ DeviceCapabilities->D2Latency = 0; /* FIXME */
+ DeviceCapabilities->D3Latency = 0; /* FIXME */
+ Status = STATUS_SUCCESS;
+ break;
+ }
+ case IRP_MN_QUERY_RESOURCES: /* 0x0a */
+ {
+ PCM_RESOURCE_LIST ResourceList;
+
+ DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
+ ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST));
+ if (!ResourceList)
+ {
+ DPRINT("Usbhub: ExAllocatePool() failed\n");
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ }
+ else
+ {
+ ResourceList->Count = 0;
+ Information = (ULONG_PTR)ResourceList;
+ Status = STATUS_SUCCESS;
+ }
+ break;
+ }
+ case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0x0b */
+ {
+ PIO_RESOURCE_REQUIREMENTS_LIST ResourceList;
+
+ DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
+ ResourceList = ExAllocatePool(PagedPool, sizeof(IO_RESOURCE_REQUIREMENTS_LIST));
+ if (!ResourceList)
+ {
+ DPRINT("Usbhub: ExAllocatePool() failed\n");
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ }
+ else
+ {
+ RtlZeroMemory(ResourceList, sizeof(IO_RESOURCE_REQUIREMENTS_LIST));
+ ResourceList->ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
+ ResourceList->AlternativeLists = 1;
+ ResourceList->List->Version = 1;
+ ResourceList->List->Revision = 1;
+ ResourceList->List->Count = 0;
+ Information = (ULONG_PTR)ResourceList;
+ Status = STATUS_SUCCESS;
+ }
+ break;
+ }
+ case IRP_MN_QUERY_DEVICE_TEXT: /* 0x0c */
+ {
+ Status = UsbhubPdoQueryDeviceText(DeviceObject, Irp, &Information);
+ break;
+ }
case IRP_MN_QUERY_ID: /* 0x13 */
{
Status = UsbhubPdoQueryId(DeviceObject, Irp, &Information);
--- trunk/reactos/drivers/usb/usbport/usbport.def 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/drivers/usb/usbport/usbport.def 2005-09-19 10:04:07 UTC (rev 17930)
@@ -7,6 +7,7 @@
usb_init_urb@4
usb_alloc_urb@8
usb_free_urb@4
+usb_get_string
usb_get_urb@4
usb_get_dev@4
usb_submit_urb@8
--- trunk/reactos/media/inf/usbport.inf 2005-09-19 08:11:43 UTC (rev 17929)
+++ trunk/reactos/media/inf/usbport.inf 2005-09-19 10:04:07 UTC (rev 17930)
@@ -31,6 +31,7 @@
%PCI\CC_0C0310.DeviceDesc%=OHCI_Inst,PCI\CC_0C0310
%PCI\CC_0C0320.DeviceDesc%=EHCI_Inst,PCI\CC_0C0320
%USB\ROOT_HUB.DeviceDesc%=RootHub_Inst,USB\ROOT_HUB
+%USB\ROOT_HUB.DeviceDesc%=RootHub_Inst,USB\ROOT_HUB20
[IntelMfg]
%PCI\VEN_8086&DEV_7112&CC_0C0300.DeviceDesc%=UHCI_Inst,PCI\VEN_8086&DEV_7112&CC_0C0300
@@ -41,7 +42,7 @@
CopyFiles = UHCI_CopyFiles
[UHCI_CopyFiles.NT]
-usbcore.sys
+usbport.sys
usbuhci.sys
[UHCI_Inst.NT.Services]
@@ -60,7 +61,7 @@
CopyFiles = OHCI_CopyFiles
[OHCI_CopyFiles.NT]
-usbcore.sys
+usbport.sys
usbohci.sys
[OHCI_Inst.NT.Services]
@@ -79,7 +80,7 @@
CopyFiles = EHCI_CopyFiles
[EHCI_CopyFiles.NT]
-usbcore.sys
+usbport.sys
usbehci.sys
[EHCI_Inst.NT.Services]
@@ -98,6 +99,7 @@
CopyFiles = RootHub_CopyFiles
[RootHub_CopyFiles.NT]
+usbport.sys
usbhub.sys
[RootHub_Inst.NT.Services]