Author: mjmartin Date: Sun Feb 21 12:34:54 2010 New Revision: 45647
URL: http://svn.reactos.org/svn/reactos?rev=45647&view=rev Log: [usb/usbehci] - Add missing break's in CompletePendingURBRequest that caused crashes.- Add some debugging for Urb Function URB_FUNCTION_CLASS_OTHER. - Implement IOCTL_INTERNAL_USB_GET_HUB_COUNT returning only 0 Hubs for now. - Implement RootHubInitNotification. - Misc cleanup.
Modified: trunk/reactos/drivers/usb/usbehci/common.c trunk/reactos/drivers/usb/usbehci/fdo.c trunk/reactos/drivers/usb/usbehci/irp.c trunk/reactos/drivers/usb/usbehci/pdo.c trunk/reactos/drivers/usb/usbehci/usbehci.c trunk/reactos/drivers/usb/usbehci/usbehci.h trunk/reactos/drivers/usb/usbehci/usbehci.rbuild trunk/reactos/drivers/usb/usbehci/usbiffn.c
Modified: trunk/reactos/drivers/usb/usbehci/common.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/common.... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/common.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/common.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -103,7 +103,6 @@ PDEVICE_OBJECT LowerDevice;
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; -DPRINT1("DeviceObject %x, LowerDevice %x\n", DeviceObject, LowerDevice); ASSERT(LowerDevice);
IoSkipCurrentIrpStackLocation(Irp);
Modified: trunk/reactos/drivers/usb/usbehci/fdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/fdo.c?r... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -84,7 +84,7 @@ DPRINT("port tmp %x\n", tmp); GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE); PdoDeviceExtension->ChildDeviceCount++; - //CompletePendingURBRequest(PdoDeviceExtension); + //PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext); } else {
Modified: trunk/reactos/drivers/usb/usbehci/irp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/irp.c?r... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -81,6 +81,7 @@
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 @@ 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,13 +321,82 @@ 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: { DPRINT1("Unhandled URB request for class device\n"); Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION; + } + } + 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;
Modified: trunk/reactos/drivers/usb/usbehci/pdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/pdo.c?r... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -82,6 +82,7 @@ while (PdoDeviceExtension->HaltUrbHandling == FALSE) { CompletePendingURBRequest(PdoDeviceExtension); + KeStallExecutionProcessor(10); } DPRINT1("Thread terminated\n"); } @@ -106,6 +107,8 @@ UsbDevicePointer->Port = Port; UsbDevicePointer->ParentDevice = Parent;
+ UsbDevicePointer->IsHub = Hub; + return UsbDevicePointer; }
@@ -175,6 +178,13 @@ 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 @@ 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,
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehci... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/usbehci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usbehci.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -94,6 +94,7 @@ DriverUnload(PDRIVER_OBJECT DriverObject) { DPRINT1("Unloading Driver\n"); + /* FIXME: Clean up */ }
NTSTATUS NTAPI
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehci... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -7,6 +7,7 @@ #include <stdio.h> #define NDEBUG #include <debug.h> +#include "usbiffn.h" #include <usbioctl.h> #include <usb.h>
@@ -188,6 +189,7 @@ UCHAR Address; ULONG Port; PVOID ParentDevice; + BOOLEAN IsHub; USB_DEVICE_DESCRIPTOR DeviceDescriptor; USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; @@ -354,6 +356,8 @@ HANDLE ThreadHandle; ULONG ChildDeviceCount; BOOLEAN HaltUrbHandling; + PVOID CallbackContext; + PRH_INIT_CALLBACK CallbackRoutine; } PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
typedef struct _WORKITEM_DATA
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehci... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/usbehci.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usbehci.rbuild [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -9,6 +9,6 @@ <file>common.c</file> <file>misc.c</file> <file>irp.c</file> - <file>usbiffn.c</file> + <file>usbiffn.c</file> <file>urbreq.c</file> </module>
Modified: trunk/reactos/drivers/usb/usbehci/usbiffn.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbiffn... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] Sun Feb 21 12:34:54 2010 @@ -185,7 +185,12 @@ 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; }