[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.


svn path=/trunk/; revision=45647
This commit is contained in:
Michael Martin 2010-02-21 11:34:54 +00:00
parent 4556434fc8
commit c12f915d85
8 changed files with 97 additions and 9 deletions

View file

@ -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);

View file

@ -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
{

View file

@ -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);

View file

@ -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,

View file

@ -94,6 +94,7 @@ VOID NTAPI
DriverUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT1("Unloading Driver\n");
/* FIXME: Clean up */
}
NTSTATUS NTAPI

View file

@ -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 @@ 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

View file

@ -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>

View file

@ -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;
}