mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:33:10 +00:00
[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:
parent
4556434fc8
commit
c12f915d85
8 changed files with 97 additions and 9 deletions
|
@ -103,7 +103,6 @@ ForwardIrpAndForget(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
PDEVICE_OBJECT LowerDevice;
|
PDEVICE_OBJECT LowerDevice;
|
||||||
|
|
||||||
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||||
DPRINT1("DeviceObject %x, LowerDevice %x\n", DeviceObject, LowerDevice);
|
|
||||||
ASSERT(LowerDevice);
|
ASSERT(LowerDevice);
|
||||||
|
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
|
|
@ -84,7 +84,7 @@ EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVO
|
||||||
DPRINT("port tmp %x\n", tmp);
|
DPRINT("port tmp %x\n", tmp);
|
||||||
GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE);
|
GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE);
|
||||||
PdoDeviceExtension->ChildDeviceCount++;
|
PdoDeviceExtension->ChildDeviceCount++;
|
||||||
//CompletePendingURBRequest(PdoDeviceExtension);
|
//PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,7 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension)
|
||||||
|
|
||||||
DPRINT1("TransferBuffer %x\n", Urb->UrbControlDescriptorRequest.TransferBuffer);
|
DPRINT1("TransferBuffer %x\n", Urb->UrbControlDescriptorRequest.TransferBuffer);
|
||||||
DPRINT1("TransferBufferLength %x\n", Urb->UrbControlDescriptorRequest.TransferBufferLength);
|
DPRINT1("TransferBufferLength %x\n", Urb->UrbControlDescriptorRequest.TransferBufferLength);
|
||||||
|
DPRINT1("UsbdDeviceHandle = %x\n", Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
UsbDevice = Urb->UrbHeader.UsbdDeviceHandle;
|
UsbDevice = Urb->UrbHeader.UsbdDeviceHandle;
|
||||||
/* UsbdDeviceHandle of 0 is root hub */
|
/* UsbdDeviceHandle of 0 is root hub */
|
||||||
|
@ -145,12 +146,14 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension)
|
||||||
case USB_STRING_DESCRIPTOR_TYPE:
|
case USB_STRING_DESCRIPTOR_TYPE:
|
||||||
{
|
{
|
||||||
DPRINT1("Usb String Descriptor not implemented\n");
|
DPRINT1("Usb String Descriptor not implemented\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
DPRINT1("Descriptor Type %x not supported!\n", Urb->UrbControlDescriptorRequest.DescriptorType);
|
DPRINT1("Descriptor Type %x not supported!\n", Urb->UrbControlDescriptorRequest.DescriptorType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case URB_FUNCTION_SELECT_CONFIGURATION:
|
case URB_FUNCTION_SELECT_CONFIGURATION:
|
||||||
{
|
{
|
||||||
|
@ -318,7 +321,7 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension)
|
||||||
Urb->UrbHeader.UsbdDeviceHandle = UsbDevice;
|
Urb->UrbHeader.UsbdDeviceHandle = UsbDevice;
|
||||||
Urb->UrbHeader.UsbdFlags = 0;
|
Urb->UrbHeader.UsbdFlags = 0;
|
||||||
/* Stop handling the URBs now as its not coded yet */
|
/* Stop handling the URBs now as its not coded yet */
|
||||||
DeviceExtension->HaltUrbHandling = TRUE;
|
//DeviceExtension->HaltUrbHandling = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -329,6 +332,75 @@ CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension)
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
{
|
{
|
||||||
DPRINT1("Unhandled URB %x\n", Urb->UrbHeader.Function);
|
DPRINT1("Unhandled URB %x\n", Urb->UrbHeader.Function);
|
||||||
|
|
|
@ -82,6 +82,7 @@ UrbWorkerThread(PVOID Context)
|
||||||
while (PdoDeviceExtension->HaltUrbHandling == FALSE)
|
while (PdoDeviceExtension->HaltUrbHandling == FALSE)
|
||||||
{
|
{
|
||||||
CompletePendingURBRequest(PdoDeviceExtension);
|
CompletePendingURBRequest(PdoDeviceExtension);
|
||||||
|
KeStallExecutionProcessor(10);
|
||||||
}
|
}
|
||||||
DPRINT1("Thread terminated\n");
|
DPRINT1("Thread terminated\n");
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,8 @@ PVOID InternalCreateUsbDevice(UCHAR DeviceNumber, ULONG Port, PUSB_DEVICE Parent
|
||||||
UsbDevicePointer->Port = Port;
|
UsbDevicePointer->Port = Port;
|
||||||
UsbDevicePointer->ParentDevice = Parent;
|
UsbDevicePointer->ParentDevice = Parent;
|
||||||
|
|
||||||
|
UsbDevicePointer->IsHub = Hub;
|
||||||
|
|
||||||
return UsbDevicePointer;
|
return UsbDevicePointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +178,13 @@ PdoDispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
|
case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
|
||||||
{
|
{
|
||||||
DPRINT1("IOCTL_INTERNAL_USB_GET_HUB_COUNT\n");
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case IOCTL_INTERNAL_USB_GET_HUB_NAME:
|
case IOCTL_INTERNAL_USB_GET_HUB_NAME:
|
||||||
|
@ -345,10 +355,7 @@ PdoDispatchPnp(
|
||||||
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
|
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
|
||||||
|
|
||||||
/* Create the root hub */
|
/* Create the root hub */
|
||||||
RootHubDevice = InternalCreateUsbDevice(0, 0, NULL, TRUE);
|
RootHubDevice = InternalCreateUsbDevice(1, 0, NULL, TRUE);
|
||||||
|
|
||||||
RootHubDevice->Address = 1;
|
|
||||||
RootHubDevice->Port = 0;
|
|
||||||
|
|
||||||
RtlCopyMemory(&RootHubDevice->DeviceDescriptor,
|
RtlCopyMemory(&RootHubDevice->DeviceDescriptor,
|
||||||
ROOTHUB2_DEVICE_DESCRIPTOR,
|
ROOTHUB2_DEVICE_DESCRIPTOR,
|
||||||
|
|
|
@ -94,6 +94,7 @@ VOID NTAPI
|
||||||
DriverUnload(PDRIVER_OBJECT DriverObject)
|
DriverUnload(PDRIVER_OBJECT DriverObject)
|
||||||
{
|
{
|
||||||
DPRINT1("Unloading Driver\n");
|
DPRINT1("Unloading Driver\n");
|
||||||
|
/* FIXME: Clean up */
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include "usbiffn.h"
|
||||||
#include <usbioctl.h>
|
#include <usbioctl.h>
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
|
|
||||||
|
@ -188,6 +189,7 @@ typedef struct _USB_DEVICE
|
||||||
UCHAR Address;
|
UCHAR Address;
|
||||||
ULONG Port;
|
ULONG Port;
|
||||||
PVOID ParentDevice;
|
PVOID ParentDevice;
|
||||||
|
BOOLEAN IsHub;
|
||||||
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
|
||||||
USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
|
USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
|
||||||
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
|
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
|
||||||
|
@ -354,6 +356,8 @@ typedef struct _PDO_DEVICE_EXTENSION
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
ULONG ChildDeviceCount;
|
ULONG ChildDeviceCount;
|
||||||
BOOLEAN HaltUrbHandling;
|
BOOLEAN HaltUrbHandling;
|
||||||
|
PVOID CallbackContext;
|
||||||
|
PRH_INIT_CALLBACK CallbackRoutine;
|
||||||
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||||
|
|
||||||
typedef struct _WORKITEM_DATA
|
typedef struct _WORKITEM_DATA
|
||||||
|
|
|
@ -185,7 +185,12 @@ NTSTATUS
|
||||||
USB_BUSIFFN
|
USB_BUSIFFN
|
||||||
RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine)
|
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;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue