- 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
PDEVICE_OBJECT LowerDevice;
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
-DPRINT1("DeviceObject %x, LowerDevice %x\n", DeviceObject, LowerDevice);
ASSERT(LowerDevice);
IoSkipCurrentIrpStackLocation(Irp);
DPRINT("port tmp %x\n", tmp);
GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE);
PdoDeviceExtension->ChildDeviceCount++;
- //CompletePendingURBRequest(PdoDeviceExtension);
+ //PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
}
else
{
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 */
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:
{
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:
}
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);
while (PdoDeviceExtension->HaltUrbHandling == FALSE)
{
CompletePendingURBRequest(PdoDeviceExtension);
+ KeStallExecutionProcessor(10);
}
DPRINT1("Thread terminated\n");
}
UsbDevicePointer->Port = Port;
UsbDevicePointer->ParentDevice = Parent;
+ UsbDevicePointer->IsHub = Hub;
+
return UsbDevicePointer;
}
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:
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,
DriverUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT1("Unloading Driver\n");
+ /* FIXME: Clean up */
}
NTSTATUS NTAPI
#include <stdio.h>
#define NDEBUG
#include <debug.h>
+#include "usbiffn.h"
#include <usbioctl.h>
#include <usb.h>
UCHAR Address;
ULONG Port;
PVOID ParentDevice;
+ BOOLEAN IsHub;
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
HANDLE ThreadHandle;
ULONG ChildDeviceCount;
BOOLEAN HaltUrbHandling;
+ PVOID CallbackContext;
+ PRH_INIT_CALLBACK CallbackRoutine;
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
typedef struct _WORKITEM_DATA
<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>
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;
}