diff --git a/reactos/drivers/usb/usbehci/common.c b/reactos/drivers/usb/usbehci/common.c index f03325dc7b8..79ecbadf25f 100644 --- a/reactos/drivers/usb/usbehci/common.c +++ b/reactos/drivers/usb/usbehci/common.c @@ -103,7 +103,6 @@ ForwardIrpAndForget(PDEVICE_OBJECT DeviceObject, PIRP Irp) PDEVICE_OBJECT LowerDevice; LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; -DPRINT1("DeviceObject %x, LowerDevice %x\n", DeviceObject, LowerDevice); ASSERT(LowerDevice); IoSkipCurrentIrpStackLocation(Irp); diff --git a/reactos/drivers/usb/usbehci/fdo.c b/reactos/drivers/usb/usbehci/fdo.c index 433aa2a9648..cb9f166df3f 100644 --- a/reactos/drivers/usb/usbehci/fdo.c +++ b/reactos/drivers/usb/usbehci/fdo.c @@ -84,7 +84,7 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO DPRINT("port tmp %x\n", tmp); GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE); PdoDeviceExtension->ChildDeviceCount++; - //CompletePendingURBRequest(PdoDeviceExtension); + //PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext); } else { diff --git a/reactos/drivers/usb/usbehci/irp.c b/reactos/drivers/usb/usbehci/irp.c index e4bb8d988a7..74030dd18ff 100644 --- a/reactos/drivers/usb/usbehci/irp.c +++ b/reactos/drivers/usb/usbehci/irp.c @@ -81,6 +81,7 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension) DPRINT1("TransferBuffer %x\n", Urb->UrbControlDescriptorRequest.TransferBuffer); DPRINT1("TransferBufferLength %x\n", Urb->UrbControlDescriptorRequest.TransferBufferLength); + DPRINT1("UsbdDeviceHandle = %x\n", Urb->UrbHeader.UsbdDeviceHandle); UsbDevice = Urb->UrbHeader.UsbdDeviceHandle; /* UsbdDeviceHandle of 0 is root hub */ @@ -145,12 +146,14 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension) case USB_STRING_DESCRIPTOR_TYPE: { DPRINT1("Usb String Descriptor not implemented\n"); + break; } default: { DPRINT1("Descriptor Type %x not supported!\n", Urb->UrbControlDescriptorRequest.DescriptorType); } } + break; } case URB_FUNCTION_SELECT_CONFIGURATION: { @@ -318,7 +321,7 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension) Urb->UrbHeader.UsbdDeviceHandle = UsbDevice; Urb->UrbHeader.UsbdFlags = 0; /* Stop handling the URBs now as its not coded yet */ - DeviceExtension->HaltUrbHandling = TRUE; + //DeviceExtension->HaltUrbHandling = TRUE; break; } default: @@ -329,6 +332,75 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension) } break; } + case URB_FUNCTION_CLASS_OTHER: + { + switch (Urb->UrbControlVendorClassRequest.Request) + { + case USB_REQUEST_GET_STATUS: + { + DPRINT1("USB_REQUEST_GET_STATUS\n"); + break; + } + case USB_REQUEST_CLEAR_FEATURE: + { + DPRINT1("USB_REQUEST_CLEAR_FEATURE\n"); + break; + } + case USB_REQUEST_SET_FEATURE: + { + DPRINT1("USB_REQUEST_SET_FEATURE value %x\n", Urb->UrbControlVendorClassRequest.Value); + switch(Urb->UrbControlVendorClassRequest.Value) + { + /* FIXME: Needs research */ + case 0x01: + { + } + } + break; + } + case USB_REQUEST_SET_ADDRESS: + { + DPRINT1("USB_REQUEST_SET_ADDRESS\n"); + break; + } + case USB_REQUEST_GET_DESCRIPTOR: + { + DPRINT1("USB_REQUEST_GET_DESCRIPTOR\n"); + break; + } + case USB_REQUEST_SET_DESCRIPTOR: + { + DPRINT1("USB_REQUEST_SET_DESCRIPTOR\n"); + break; + } + case USB_REQUEST_GET_CONFIGURATION: + { + DPRINT1("USB_REQUEST_GET_CONFIGURATION\n"); + break; + } + case USB_REQUEST_SET_CONFIGURATION: + { + DPRINT1("USB_REQUEST_SET_CONFIGURATION\n"); + break; + } + case USB_REQUEST_GET_INTERFACE: + { + DPRINT1("USB_REQUEST_GET_INTERFACE\n"); + break; + } + case USB_REQUEST_SET_INTERFACE: + { + DPRINT1("USB_REQUEST_SET_INTERFACE\n"); + break; + } + case USB_REQUEST_SYNC_FRAME: + { + DPRINT1("USB_REQUEST_SYNC_FRAME\n"); + break; + } + } + break; + } default: { DPRINT1("Unhandled URB %x\n", Urb->UrbHeader.Function); diff --git a/reactos/drivers/usb/usbehci/pdo.c b/reactos/drivers/usb/usbehci/pdo.c index fd176f7d65e..3ab717f0f56 100644 --- a/reactos/drivers/usb/usbehci/pdo.c +++ b/reactos/drivers/usb/usbehci/pdo.c @@ -82,6 +82,7 @@ UrbWorkerThread(PVOID Context) while (PdoDeviceExtension->HaltUrbHandling == FALSE) { CompletePendingURBRequest(PdoDeviceExtension); + KeStallExecutionProcessor(10); } DPRINT1("Thread terminated\n"); } @@ -106,6 +107,8 @@ PVOID InternalCreateUsbDevice(UCHAR DeviceNumber, ULONG Port, PUSB_DEVICE Parent UsbDevicePointer->Port = Port; UsbDevicePointer->ParentDevice = Parent; + UsbDevicePointer->IsHub = Hub; + return UsbDevicePointer; } @@ -175,6 +178,13 @@ PdoDispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) case IOCTL_INTERNAL_USB_GET_HUB_COUNT: { DPRINT1("IOCTL_INTERNAL_USB_GET_HUB_COUNT\n"); + + if (Stack->Parameters.Others.Argument1) + { + /* FIXME: Determine the number of hubs between the usb device and root hub */ + /* For now return 0 */ + *(PVOID *)Stack->Parameters.Others.Argument1 = 0; + } break; } case IOCTL_INTERNAL_USB_GET_HUB_NAME: @@ -345,10 +355,7 @@ PdoDispatchPnp( FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension; /* Create the root hub */ - RootHubDevice = InternalCreateUsbDevice(0, 0, NULL, TRUE); - - RootHubDevice->Address = 1; - RootHubDevice->Port = 0; + RootHubDevice = InternalCreateUsbDevice(1, 0, NULL, TRUE); RtlCopyMemory(&RootHubDevice->DeviceDescriptor, ROOTHUB2_DEVICE_DESCRIPTOR, diff --git a/reactos/drivers/usb/usbehci/usbehci.c b/reactos/drivers/usb/usbehci/usbehci.c index dd35b0d6dd1..15540694bf1 100644 --- a/reactos/drivers/usb/usbehci/usbehci.c +++ b/reactos/drivers/usb/usbehci/usbehci.c @@ -94,6 +94,7 @@ VOID NTAPI DriverUnload(PDRIVER_OBJECT DriverObject) { DPRINT1("Unloading Driver\n"); + /* FIXME: Clean up */ } NTSTATUS NTAPI diff --git a/reactos/drivers/usb/usbehci/usbehci.h b/reactos/drivers/usb/usbehci/usbehci.h index 0ab5c20c3bc..b52d7c9051a 100644 --- a/reactos/drivers/usb/usbehci/usbehci.h +++ b/reactos/drivers/usb/usbehci/usbehci.h @@ -7,6 +7,7 @@ #include #define NDEBUG #include +#include "usbiffn.h" #include #include @@ -188,6 +189,7 @@ typedef struct _USB_DEVICE UCHAR Address; ULONG Port; PVOID ParentDevice; + BOOLEAN IsHub; USB_DEVICE_DESCRIPTOR DeviceDescriptor; USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; @@ -354,6 +356,8 @@ typedef struct _PDO_DEVICE_EXTENSION HANDLE ThreadHandle; ULONG ChildDeviceCount; BOOLEAN HaltUrbHandling; + PVOID CallbackContext; + PRH_INIT_CALLBACK CallbackRoutine; } PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION; typedef struct _WORKITEM_DATA diff --git a/reactos/drivers/usb/usbehci/usbehci.rbuild b/reactos/drivers/usb/usbehci/usbehci.rbuild index 85d1f1cb3b4..3f6f1e6c8f3 100644 --- a/reactos/drivers/usb/usbehci/usbehci.rbuild +++ b/reactos/drivers/usb/usbehci/usbehci.rbuild @@ -9,6 +9,6 @@ common.c misc.c irp.c - usbiffn.c + usbiffn.c urbreq.c diff --git a/reactos/drivers/usb/usbehci/usbiffn.c b/reactos/drivers/usb/usbehci/usbiffn.c index 165f5daaa13..ddb1763c616 100644 --- a/reactos/drivers/usb/usbehci/usbiffn.c +++ b/reactos/drivers/usb/usbehci/usbiffn.c @@ -185,7 +185,12 @@ NTSTATUS USB_BUSIFFN RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine) { - DPRINT1("RootHubInitNotification\n"); + PPDO_DEVICE_EXTENSION PdoDeviceExtension; + DPRINT1("RootHubInitNotification %x, %x, %x\n", BusContext, CallbackContext, CallbackRoutine); + + PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)BusContext; + PdoDeviceExtension->CallbackContext = CallbackContext; + PdoDeviceExtension->CallbackRoutine = CallbackRoutine; return STATUS_SUCCESS; }