ReactOS  0.4.14-dev-50-g13bb5e2
hub_controller.cpp File Reference
#include "libusb.h"
#include <debug.h>
Include dependency graph for hub_controller.cpp:

Go to the source code of this file.

Classes

class  CHubController
 
struct  USBDEVICE_ENTRY
 

Macros

#define NDEBUG
 

Typedefs

typedef struct USBDEVICE_ENTRYPUSBDEVICE_ENTRY
 

Functions

VOID NTAPI StatusChangeEndpointCallBack (PVOID Context)
 
VOID USB_BUSIFFN USBI_InterfaceReference (PVOID BusContext)
 
VOID USB_BUSIFFN USBI_InterfaceDereference (PVOID BusContext)
 
NTSTATUS USB_BUSIFFN USBHI_CreateUsbDevice (PVOID BusContext, PUSB_DEVICE_HANDLE *NewDevice, PUSB_DEVICE_HANDLE HubDeviceHandle, USHORT PortStatus, USHORT PortNumber)
 
NTSTATUS USB_BUSIFFN USBHI_InitializeUsbDevice (PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle)
 
NTSTATUS USB_BUSIFFN USBHI_GetUsbDescriptors (PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, PUCHAR DeviceDescriptorBuffer, PULONG DeviceDescriptorBufferLength, PUCHAR ConfigDescriptorBuffer, PULONG ConfigDescriptorBufferLength)
 
NTSTATUS USB_BUSIFFN USBHI_RemoveUsbDevice (PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags)
 
NTSTATUS USB_BUSIFFN USBHI_RestoreUsbDevice (PVOID BusContext, PUSB_DEVICE_HANDLE OldDeviceHandle, PUSB_DEVICE_HANDLE NewDeviceHandle)
 
NTSTATUS USB_BUSIFFN USBHI_QueryDeviceInformation (PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, PVOID DeviceInformationBuffer, ULONG DeviceInformationBufferLength, PULONG LengthReturned)
 
NTSTATUS USB_BUSIFFN USBHI_GetControllerInformation (PVOID BusContext, PVOID ControllerInformationBuffer, ULONG ControllerInformationBufferLength, PULONG LengthReturned)
 
NTSTATUS USB_BUSIFFN USBHI_ControllerSelectiveSuspend (PVOID BusContext, BOOLEAN Enable)
 
NTSTATUS USB_BUSIFFN USBHI_GetExtendedHubInformation (PVOID BusContext, PDEVICE_OBJECT HubPhysicalDeviceObject, PVOID HubInformationBuffer, ULONG HubInformationBufferLength, PULONG LengthReturned)
 
NTSTATUS USB_BUSIFFN USBHI_GetRootHubSymbolicName (PVOID BusContext, PVOID HubSymNameBuffer, ULONG HubSymNameBufferLength, PULONG HubSymNameActualLength)
 
PVOID USB_BUSIFFN USBHI_GetDeviceBusContext (PVOID HubBusContext, PVOID DeviceHandle)
 
NTSTATUS USB_BUSIFFN USBHI_Initialize20Hub (PVOID BusContext, PUSB_DEVICE_HANDLE HubDeviceHandle, ULONG TtCount)
 
VOID NTAPI InitRootHub (IN PVOID Context)
 
NTSTATUS USB_BUSIFFN USBHI_RootHubInitNotification (PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine)
 
VOID USB_BUSIFFN USBHI_FlushTransfers (PVOID BusContext, PVOID DeviceHandle)
 
VOID USB_BUSIFFN USBHI_SetDeviceHandleData (PVOID BusContext, PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo)
 
VOID USB_BUSIFFN USBDI_GetUSBDIVersion (PVOID BusContext, PUSBD_VERSION_INFORMATION VersionInformation, PULONG HcdCapabilites)
 
NTSTATUS USB_BUSIFFN USBDI_QueryBusTime (PVOID BusContext, PULONG CurrentFrame)
 
NTSTATUS USB_BUSIFFN USBDI_SubmitIsoOutUrb (PVOID BusContext, PURB Urb)
 
NTSTATUS USB_BUSIFFN USBDI_QueryBusInformation (PVOID BusContext, ULONG Level, PVOID BusInformationBuffer, PULONG BusInformationBufferLength, PULONG BusInformationActualLength)
 
BOOLEAN USB_BUSIFFN USBDI_IsDeviceHighSpeed (PVOID BusContext)
 
NTSTATUS USB_BUSIFFN USBDI_EnumLogEntry (PVOID BusContext, ULONG DriverTag, ULONG EnumTag, ULONG P1, ULONG P2)
 
NTSTATUS NTAPI CreateHubController (PHUBCONTROLLER *OutHcdController)
 

Variables

const UCHAR ROOTHUB2_DEVICE_DESCRIPTOR []
 
const USB_CONFIGURATION_DESCRIPTOR ROOTHUB2_CONFIGURATION_DESCRIPTOR
 
const USB_INTERFACE_DESCRIPTOR ROOTHUB2_INTERFACE_DESCRIPTOR
 
const USB_ENDPOINT_DESCRIPTOR ROOTHUB2_ENDPOINT_DESCRIPTOR
 
WORKER_THREAD_ROUTINE InitRootHub
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file hub_controller.cpp.

Typedef Documentation

◆ PUSBDEVICE_ENTRY

Function Documentation

◆ CreateHubController()

NTSTATUS NTAPI CreateHubController ( PHUBCONTROLLER OutHcdController)

Definition at line 3959 of file hub_controller.cpp.

3961 {
3963 
3964  //
3965  // allocate controller
3966  //
3968  if (!This)
3969  {
3970  //
3971  // failed to allocate
3972  //
3974  }
3975 
3976  //
3977  // add reference count
3978  //
3979  This->AddRef();
3980 
3981  //
3982  // return result
3983  //
3984  *OutHcdController = (PHUBCONTROLLER)This;
3985 
3986  //
3987  // done
3988  //
3989  return STATUS_SUCCESS;
3990 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_USBLIB
Definition: libusb.h:69
IHubController * PHUBCONTROLLER
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHCDController::HandlePnp().

◆ InitRootHub()

VOID NTAPI InitRootHub ( IN PVOID  Context)

Definition at line 3386 of file hub_controller.cpp.

3387 {
3388  PINIT_ROOT_HUB_CONTEXT WorkItem;
3389 
3390  //
3391  // get context
3392  //
3393  WorkItem = (PINIT_ROOT_HUB_CONTEXT)Context;
3394 
3395  //
3396  // perform callback
3397  //
3398  WorkItem->CallbackRoutine(WorkItem->CallbackContext);
3399 
3400  //
3401  // free contextg
3402  //
3404 }
PRH_INIT_CALLBACK CallbackRoutine
Definition: libusb.h:63
#define TAG_USBLIB
Definition: libusb.h:69
PVOID CallbackContext
Definition: libusb.h:62
struct _WORK_ITEM_DATA * PINIT_ROOT_HUB_CONTEXT
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ StatusChangeEndpointCallBack()

VOID NTAPI StatusChangeEndpointCallBack ( PVOID  Context)

Definition at line 3992 of file hub_controller.cpp.

3993 {
3995  PIRP Irp;
3997 
3998  ASSERT(This);
3999 
4000  Irp = This->m_PendingSCEIrp;
4001  if (!Irp)
4002  {
4003  DPRINT1("There was no pending IRP for SCE. Did the usb hub 2.0 driver (usbhub2) load?\n");
4004  return;
4005  }
4006 
4007  This->m_PendingSCEIrp = NULL;
4008  This->QueryStatusChangeEndpoint(Irp);
4009 
4010  Irp->IoStatus.Status = STATUS_SUCCESS;
4011  Irp->IoStatus.Information = 0;
4012 
4014 }
_In_ PIRP Irp
Definition: csq.h:116
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ USBDI_EnumLogEntry()

NTSTATUS USB_BUSIFFN USBDI_EnumLogEntry ( PVOID  BusContext,
ULONG  DriverTag,
ULONG  EnumTag,
ULONG  P1,
ULONG  P2 
)

Definition at line 3649 of file hub_controller.cpp.

3655 {
3656  UNIMPLEMENTED;
3657  return STATUS_NOT_IMPLEMENTED;
3658 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBDI_GetUSBDIVersion()

VOID USB_BUSIFFN USBDI_GetUSBDIVersion ( PVOID  BusContext,
PUSBD_VERSION_INFORMATION  VersionInformation,
PULONG  HcdCapabilites 
)

Definition at line 3533 of file hub_controller.cpp.

3537 {
3538  CHubController * Controller;
3540  ULONG Speed, Dummy2;
3541  USHORT Dummy1;
3542 
3543  DPRINT("USBDI_GetUSBDIVersion\n");
3544 
3545  //
3546  // get controller
3547  //
3548  Controller = (CHubController*)BusContext;
3549 
3550  //
3551  // get usb hardware
3552  //
3553  Device = Controller->GetUsbHardware();
3554  PC_ASSERT(Device);
3555 
3556  if (VersionInformation)
3557  {
3558  //
3559  // windows xp supported
3560  //
3561  VersionInformation->USBDI_Version = 0x00000500;
3562 
3563  //
3564  // get device speed
3565  //
3566  Device->GetDeviceDetails(&Dummy1, &Dummy1, &Dummy2, &Speed);
3567 
3568  //
3569  // store speed details
3570  //
3571  VersionInformation->Supported_USB_Version = Speed;
3572  }
3573 
3574  //
3575  // no flags supported
3576  //
3577  *HcdCapabilites = 0;
3578 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBHardwareDevice * PUSBHARDWAREDEVICE
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
ULONG Supported_USB_Version
Definition: usb.h:241
void DPRINT(...)
Definition: polytest.cpp:61
PUSBHARDWAREDEVICE GetUsbHardware()
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1

Referenced by CHubController::HandleQueryInterface().

◆ USBDI_IsDeviceHighSpeed()

BOOLEAN USB_BUSIFFN USBDI_IsDeviceHighSpeed ( PVOID  BusContext)

Definition at line 3615 of file hub_controller.cpp.

3617 {
3618  CHubController * Controller;
3620  ULONG Speed, Dummy2;
3621  USHORT Dummy1;
3622 
3623  DPRINT("USBDI_IsDeviceHighSpeed\n");
3624 
3625  //
3626  // get controller
3627  //
3628  Controller = (CHubController*)BusContext;
3629 
3630  //
3631  // get usb hardware
3632  //
3633  Device = Controller->GetUsbHardware();
3634  PC_ASSERT(Device);
3635 
3636  //
3637  // get device speed
3638  //
3639  Device->GetDeviceDetails(&Dummy1, &Dummy1, &Dummy2, &Speed);
3640 
3641  //
3642  // USB 2.0 equals 0x200
3643  //
3644  return (Speed == 0x200);
3645 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBHardwareDevice * PUSBHARDWAREDEVICE
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
void DPRINT(...)
Definition: polytest.cpp:61
PUSBHARDWAREDEVICE GetUsbHardware()
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1

Referenced by CHubController::HandleQueryInterface().

◆ USBDI_QueryBusInformation()

NTSTATUS USB_BUSIFFN USBDI_QueryBusInformation ( PVOID  BusContext,
ULONG  Level,
PVOID  BusInformationBuffer,
PULONG  BusInformationBufferLength,
PULONG  BusInformationActualLength 
)

Definition at line 3602 of file hub_controller.cpp.

3608 {
3609  UNIMPLEMENTED;
3610  return STATUS_NOT_IMPLEMENTED;
3611 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBDI_QueryBusTime()

NTSTATUS USB_BUSIFFN USBDI_QueryBusTime ( PVOID  BusContext,
PULONG  CurrentFrame 
)

Definition at line 3582 of file hub_controller.cpp.

3585 {
3586  UNIMPLEMENTED;
3587  return STATUS_NOT_IMPLEMENTED;
3588 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBDI_SubmitIsoOutUrb()

NTSTATUS USB_BUSIFFN USBDI_SubmitIsoOutUrb ( PVOID  BusContext,
PURB  Urb 
)

Definition at line 3592 of file hub_controller.cpp.

3595 {
3596  UNIMPLEMENTED;
3597  return STATUS_NOT_IMPLEMENTED;
3598 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_ControllerSelectiveSuspend()

NTSTATUS USB_BUSIFFN USBHI_ControllerSelectiveSuspend ( PVOID  BusContext,
BOOLEAN  Enable 
)

Definition at line 3248 of file hub_controller.cpp.

3251 {
3252  UNIMPLEMENTED;
3253  return STATUS_NOT_IMPLEMENTED;
3254 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_CreateUsbDevice()

NTSTATUS USB_BUSIFFN USBHI_CreateUsbDevice ( PVOID  BusContext,
PUSB_DEVICE_HANDLE NewDevice,
PUSB_DEVICE_HANDLE  HubDeviceHandle,
USHORT  PortStatus,
USHORT  PortNumber 
)

Definition at line 2704 of file hub_controller.cpp.

2710 {
2711  PUSBDEVICE NewUsbDevice;
2712  CHubController * Controller;
2713  NTSTATUS Status;
2714 
2715  DPRINT1("USBHI_CreateUsbDevice\n");
2716 
2717  //
2718  // first get hub controller
2719  //
2720  Controller = (CHubController *)BusContext;
2721 
2722  //
2723  // sanity check
2724  //
2725  PC_ASSERT(Controller);
2726  PC_ASSERT(BusContext == HubDeviceHandle);
2727 
2728  //
2729  // now allocate usb device
2730  //
2731  Status = CreateUSBDevice(&NewUsbDevice);
2732 
2733  //
2734  // check for success
2735  //
2736  if (!NT_SUCCESS(Status))
2737  {
2738  //
2739  // release controller
2740  //
2741  Controller->Release();
2742  DPRINT1("USBHI_CreateUsbDevice: failed to create usb device %x\n", Status);
2743  return Status;
2744  }
2745 
2746  //
2747  // now initialize device
2748  //
2749  Status = NewUsbDevice->Initialize(PHUBCONTROLLER(Controller), Controller->GetUsbHardware(), HubDeviceHandle, PortNumber, PortStatus);
2750 
2751  //
2752  // check for success
2753  //
2754  if (!NT_SUCCESS(Status))
2755  {
2756  //
2757  // release usb device
2758  //
2759  NewUsbDevice->Release();
2760  DPRINT1("USBHI_CreateUsbDevice: failed to initialize usb device %x\n", Status);
2761  return Status;
2762  }
2763 
2764  //
2765  // insert into list
2766  //
2767  Status = Controller->AddUsbDevice(NewUsbDevice);
2768  //
2769  // check for success
2770  //
2771  if (!NT_SUCCESS(Status))
2772  {
2773  //
2774  // release usb device
2775  //
2776  NewUsbDevice->Release();
2777 
2778  DPRINT1("USBHI_CreateUsbDevice: failed to add usb device %x\n", Status);
2779  return Status;
2780  }
2781 
2782  //
2783  // store the handle
2784  //
2785  *NewDevice = NewUsbDevice;
2786 
2787  //
2788  // done
2789  //
2790  return STATUS_SUCCESS;
2791 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI CreateUSBDevice(PUSBDEVICE *OutDevice)
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE HubDeviceHandle
Definition: hubbusif.h:40
IUSBDevice * PUSBDEVICE
ULONG PortNumber
Definition: storport.c:18
NTSTATUS AddUsbDevice(PUSBDEVICE UsbDevice)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PUSBHARDWAREDEVICE GetUsbHardware()
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
IHubController * PHUBCONTROLLER
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_FlushTransfers()

VOID USB_BUSIFFN USBHI_FlushTransfers ( PVOID  BusContext,
PVOID  DeviceHandle 
)

Definition at line 3459 of file hub_controller.cpp.

3462 {
3463  UNIMPLEMENTED;
3464 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_GetControllerInformation()

NTSTATUS USB_BUSIFFN USBHI_GetControllerInformation ( PVOID  BusContext,
PVOID  ControllerInformationBuffer,
ULONG  ControllerInformationBufferLength,
PULONG  LengthReturned 
)

Definition at line 3202 of file hub_controller.cpp.

3207 {
3208  PUSB_CONTROLLER_INFORMATION_0 ControllerInfo;
3209 
3210  DPRINT("USBHI_GetControllerInformation\n");
3211 
3212  //
3213  // sanity checks
3214  //
3215  PC_ASSERT(ControllerInformationBuffer);
3217 
3218  //
3219  // get controller info buffer
3220  //
3221  ControllerInfo = (PUSB_CONTROLLER_INFORMATION_0)ControllerInformationBuffer;
3222 
3223  //
3224  // FIXME only version 0 is supported for now
3225  //
3226  PC_ASSERT(ControllerInfo->InformationLevel == 0);
3227 
3228  //
3229  // fill in information
3230  //
3231  ControllerInfo->ActualLength = sizeof(USB_CONTROLLER_INFORMATION_0);
3232  ControllerInfo->SelectiveSuspendEnabled = FALSE; //FIXME
3233  ControllerInfo->IsHighSpeedController = TRUE;
3234 
3235  //
3236  // set length returned
3237  //
3238  *LengthReturned = ControllerInfo->ActualLength;
3239 
3240  //
3241  // done
3242  //
3243  return STATUS_SUCCESS;
3244 }
#define TRUE
Definition: types.h:120
#define PC_ASSERT(exp)
Definition: usbehci.h:17
struct _USB_CONTROLLER_INFORMATION_0 USB_CONTROLLER_INFORMATION_0
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ FILE_INFORMATION_CLASS _Out_opt_ PULONG LengthReturned
Definition: fltkernel.h:1306
void DPRINT(...)
Definition: polytest.cpp:61
struct _USB_CONTROLLER_INFORMATION_0 * PUSB_CONTROLLER_INFORMATION_0
_In_ ULONG ControllerInformationBufferLength
Definition: hubbusif.h:192
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_GetDeviceBusContext()

PVOID USB_BUSIFFN USBHI_GetDeviceBusContext ( PVOID  HubBusContext,
PVOID  DeviceHandle 
)

Definition at line 3362 of file hub_controller.cpp.

3365 {
3366  UNIMPLEMENTED;
3367  return NULL;
3368 }
smooth NULL
Definition: ftsmooth.c:416
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_GetExtendedHubInformation()

NTSTATUS USB_BUSIFFN USBHI_GetExtendedHubInformation ( PVOID  BusContext,
PDEVICE_OBJECT  HubPhysicalDeviceObject,
PVOID  HubInformationBuffer,
ULONG  HubInformationBufferLength,
PULONG  LengthReturned 
)

Definition at line 3258 of file hub_controller.cpp.

3264 {
3265  PUSB_EXTHUB_INFORMATION_0 HubInfo;
3266  CHubController * Controller;
3267  PUSBHARDWAREDEVICE Hardware;
3268  ULONG Index;
3269  ULONG NumPort, Dummy2;
3270  USHORT Dummy1;
3271  NTSTATUS Status;
3272 
3273  DPRINT("USBHI_GetExtendedHubInformation\n");
3274 
3275  //
3276  // sanity checks
3277  //
3278  PC_ASSERT(HubInformationBuffer);
3281 
3282  //
3283  // get hub controller
3284  //
3285  Controller = (CHubController *)BusContext;
3286  PC_ASSERT(Controller);
3287 
3288  //
3289  // get usb hardware device
3290  //
3291  Hardware = Controller->GetUsbHardware();
3292 
3293  //
3294  // retrieve number of ports
3295  //
3296  Status = Hardware->GetDeviceDetails(&Dummy1, &Dummy1, &NumPort, &Dummy2);
3297  if (!NT_SUCCESS(Status))
3298  {
3299  //
3300  // failed to get hardware details, ouch ;)
3301  //
3302  DPRINT1("USBHI_GetExtendedHubInformation failed to get hardware details with %x\n", Status);
3303  return Status;
3304  }
3305 
3306  //
3307  // get hub information buffer
3308  //
3309  HubInfo = (PUSB_EXTHUB_INFORMATION_0)HubInformationBuffer;
3310 
3311  //
3312  // initialize hub information
3313  //
3314  HubInfo->InformationLevel = 0;
3315 
3316  //
3317  // store port count
3318  //
3319  HubInfo->NumberOfPorts = NumPort;
3320 
3321  //
3322  // initialize port information
3323  //
3324  for(Index = 0; Index < NumPort; Index++)
3325  {
3326  HubInfo->Port[Index].PhysicalPortNumber = Index + 1;
3327  HubInfo->Port[Index].PortLabelNumber = Index + 1;
3328  HubInfo->Port[Index].VidOverride = 0;
3329  HubInfo->Port[Index].PidOverride = 0;
3330  HubInfo->Port[Index].PortAttributes = USB_PORTATTR_SHARED_USB2; //FIXME
3331  }
3332 
3333  //
3334  // store result length
3335  //
3336 #ifdef _MSC_VER
3338 #else
3340 #endif
3341 
3342  //
3343  // done
3344  //
3345  return STATUS_SUCCESS;
3346 }
CPPORT Port[4]
Definition: headless.c:34
#define USB_PORTATTR_SHARED_USB2
Definition: usb.h:48
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBHardwareDevice * PUSBHARDWAREDEVICE
struct _USB_EXTPORT_INFORMATION_0 USB_EXTPORT_INFORMATION_0
LONG NTSTATUS
Definition: precomp.h:26
USB_EXTPORT_INFORMATION_0 Port[255]
Definition: hubbusif.h:732
struct _USB_EXTHUB_INFORMATION_0 * PUSB_EXTHUB_INFORMATION_0
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ FILE_INFORMATION_CLASS _Out_opt_ PULONG LengthReturned
Definition: fltkernel.h:1306
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const UCHAR Index[8]
Definition: usbohci.c:18
PUSBHARDWAREDEVICE GetUsbHardware()
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define DPRINT1
Definition: precomp.h:8
_In_ PDEVICE_OBJECT _In_ ULONG HubInformationBufferLength
Definition: hubbusif.h:212
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_GetRootHubSymbolicName()

NTSTATUS USB_BUSIFFN USBHI_GetRootHubSymbolicName ( PVOID  BusContext,
PVOID  HubSymNameBuffer,
ULONG  HubSymNameBufferLength,
PULONG  HubSymNameActualLength 
)

Definition at line 3350 of file hub_controller.cpp.

3355 {
3356  UNIMPLEMENTED;
3357  return STATUS_NOT_IMPLEMENTED;
3358 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_GetUsbDescriptors()

NTSTATUS USB_BUSIFFN USBHI_GetUsbDescriptors ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  DeviceHandle,
PUCHAR  DeviceDescriptorBuffer,
PULONG  DeviceDescriptorBufferLength,
PUCHAR  ConfigDescriptorBuffer,
PULONG  ConfigDescriptorBufferLength 
)

Definition at line 2890 of file hub_controller.cpp.

2897 {
2898  PUSBDEVICE UsbDevice;
2899  CHubController * Controller;
2900 
2901  DPRINT("USBHI_GetUsbDescriptors\n");
2902 
2903  //
2904  // sanity check
2905  //
2911 
2912  //
2913  // first get controller
2914  //
2915  Controller = (CHubController *)BusContext;
2916  PC_ASSERT(Controller);
2917 
2918 
2919  //
2920  // get device object
2921  //
2922  UsbDevice = (PUSBDEVICE)DeviceHandle;
2923  PC_ASSERT(UsbDevice);
2924 
2925  //
2926  // validate device handle
2927  //
2928  if (!Controller->ValidateUsbDevice(UsbDevice))
2929  {
2930  DPRINT1("USBHI_GetUsbDescriptors invalid device handle %p\n", DeviceHandle);
2931 
2932  //
2933  // invalid device handle
2934  //
2936  }
2937 
2938  //
2939  // get device descriptor
2940  //
2941  UsbDevice->GetDeviceDescriptor((PUSB_DEVICE_DESCRIPTOR)DeviceDescriptorBuffer);
2942 
2943  //
2944  // store result length
2945  //
2947 
2948  //
2949  // get configuration descriptor
2950  //
2952 
2953  //
2954  // complete the request
2955  //
2956  return STATUS_SUCCESS;
2957 }
struct _USB_DEVICE_DESCRIPTOR USB_DEVICE_DESCRIPTOR
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG _Out_writes_bytes_to_ ConfigDescriptorBufferLength PUCHAR ConfigDescriptorBuffer
Definition: hubbusif.h:151
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBDevice * PUSBDEVICE
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR DeviceDescriptorBuffer
Definition: hubbusif.h:148
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG DeviceDescriptorBufferLength
Definition: hubbusif.h:148
_Inout_ PUSB_DEVICE_HANDLE _Out_writes_bytes_to_ DeviceDescriptorBufferLength PUCHAR _Inout_ PULONG _Out_writes_bytes_to_ ConfigDescriptorBufferLength PUCHAR _Inout_ PULONG ConfigDescriptorBufferLength
Definition: hubbusif.h:151
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_Initialize20Hub()

NTSTATUS USB_BUSIFFN USBHI_Initialize20Hub ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  HubDeviceHandle,
ULONG  TtCount 
)

Definition at line 3372 of file hub_controller.cpp.

3376 {
3377  DPRINT("USBHI_Initialize20Hub HubDeviceHandle %p UNIMPLEMENTED TtCount %lu\n", HubDeviceHandle, TtCount);
3378  return STATUS_SUCCESS;
3379 }
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE HubDeviceHandle
Definition: hubbusif.h:40
void DPRINT(...)
Definition: polytest.cpp:61
_In_ PUSB_DEVICE_HANDLE _In_ ULONG TtCount
Definition: hubbusif.h:239
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_InitializeUsbDevice()

NTSTATUS USB_BUSIFFN USBHI_InitializeUsbDevice ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  DeviceHandle 
)

Definition at line 2795 of file hub_controller.cpp.

2798 {
2799  PUSBDEVICE UsbDevice;
2800  CHubController * Controller;
2802  NTSTATUS Status;
2803  ULONG Index = 0;
2804 
2805  DPRINT("USBHI_InitializeUsbDevice\n");
2806 
2807  //
2808  // first get controller
2809  //
2810  Controller = (CHubController *)BusContext;
2811  PC_ASSERT(Controller);
2812 
2813  //
2814  // get device object
2815  //
2816  UsbDevice = (PUSBDEVICE)DeviceHandle;
2817  PC_ASSERT(UsbDevice);
2818 
2819  //
2820  // validate device handle
2821  //
2822  if (!Controller->ValidateUsbDevice(UsbDevice))
2823  {
2824  DPRINT1("USBHI_InitializeUsbDevice invalid device handle %p\n", DeviceHandle);
2825 
2826  //
2827  // invalid device handle
2828  //
2830  }
2831 
2832  //
2833  // now reserve an address
2834  //
2835  DeviceAddress = Controller->AcquireDeviceAddress();
2836 
2837  //
2838  // is the device address valid
2839  //
2840  if (DeviceAddress == MAXULONG)
2841  {
2842  //
2843  // failed to get an device address from the device address pool
2844  //
2845  DPRINT1("USBHI_InitializeUsbDevice failed to get device address\n");
2846  return STATUS_DEVICE_DATA_ERROR;
2847  }
2848 
2849  do
2850  {
2851  //
2852  // now set the device address
2853  //
2854  Status = UsbDevice->SetDeviceAddress((UCHAR)DeviceAddress);
2855 
2856  if (NT_SUCCESS(Status))
2857  break;
2858 
2859  }while(Index++ < 3 );
2860 
2861  //
2862  // check for failure
2863  //
2864  if (!NT_SUCCESS(Status))
2865  {
2866  //
2867  // failed to set device address
2868  //
2869  DPRINT1("USBHI_InitializeUsbDevice failed to set address with %x\n", Status);
2870 
2871  //
2872  // release address
2873  //
2874  Controller->ReleaseDeviceAddress(DeviceAddress);
2875 
2876  //
2877  // return error
2878  //
2879  return STATUS_DEVICE_DATA_ERROR;
2880  }
2881 
2882  //
2883  // done
2884  //
2885  return STATUS_SUCCESS;
2886 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define PC_ASSERT(exp)
Definition: usbehci.h:17
ULONG AcquireDeviceAddress()
LONG NTSTATUS
Definition: precomp.h:26
VOID ReleaseDeviceAddress(ULONG DeviceAddress)
IUSBDevice * PUSBDEVICE
_In_ PUSB_DEVICE_HANDLE _Out_ PUSHORT DeviceAddress
Definition: hubbusif.h:359
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:250
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_QueryDeviceInformation()

NTSTATUS USB_BUSIFFN USBHI_QueryDeviceInformation ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  DeviceHandle,
PVOID  DeviceInformationBuffer,
ULONG  DeviceInformationBufferLength,
PULONG  LengthReturned 
)

Definition at line 3077 of file hub_controller.cpp.

3083 {
3085  PUSBDEVICE UsbDevice;
3086  CHubController * Controller;
3087 
3088  DPRINT("USBHI_QueryDeviceInformation %p\n", BusContext);
3089 
3090  //
3091  // sanity check
3092  //
3094  PC_ASSERT(DeviceInformationBuffer);
3096 
3097  //
3098  // get controller object
3099  //
3100  Controller = (CHubController*)BusContext;
3101  PC_ASSERT(Controller);
3102 
3103  //
3104  // get device object
3105  //
3106  UsbDevice = (PUSBDEVICE)DeviceHandle;
3107  PC_ASSERT(UsbDevice);
3108 
3109  if (BusContext != DeviceHandle)
3110  {
3111  //
3112  // validate device handle
3113  //
3114  if (!Controller->ValidateUsbDevice(UsbDevice))
3115  {
3116  DPRINT1("USBHI_QueryDeviceInformation invalid device handle %p\n", DeviceHandle);
3117 
3118  //
3119  // invalid device handle
3120  //
3122  }
3123 
3124  //
3125  // access information buffer
3126  //
3127  DeviceInfo = (PUSB_DEVICE_INFORMATION_0)DeviceInformationBuffer;
3128 
3129  //
3130  // initialize with default values
3131  //
3132  DeviceInfo->InformationLevel = 0;
3133  DeviceInfo->ActualLength = sizeof(USB_DEVICE_INFORMATION_0);
3134  DeviceInfo->PortNumber = UsbDevice->GetPort();
3135  DeviceInfo->CurrentConfigurationValue = UsbDevice->GetConfigurationValue();
3136  DeviceInfo->DeviceAddress = UsbDevice->GetDeviceAddress();
3137  DeviceInfo->HubAddress = 0; //FIXME
3138  DeviceInfo->DeviceSpeed = UsbDevice->GetSpeed();
3139  DeviceInfo->DeviceType = UsbDevice->GetType();
3140  DeviceInfo->NumberOfOpenPipes = 0; //FIXME
3141 
3142  //
3143  // get device descriptor
3144  //
3145  UsbDevice->GetDeviceDescriptor(&DeviceInfo->DeviceDescriptor);
3146 
3147  //
3148  // FIXME return pipe information
3149  //
3150 
3151  //
3152  // store result length
3153  //
3155 
3156  return STATUS_SUCCESS;
3157  }
3158 
3159  //
3160  // access information buffer
3161  //
3162  DeviceInfo = (PUSB_DEVICE_INFORMATION_0)DeviceInformationBuffer;
3163 
3164  //
3165  // initialize with default values
3166  //
3167  DeviceInfo->InformationLevel = 0;
3168  DeviceInfo->ActualLength = sizeof(USB_DEVICE_INFORMATION_0);
3169  DeviceInfo->PortNumber = 0;
3170  DeviceInfo->CurrentConfigurationValue = 0; //FIXME;
3171  DeviceInfo->DeviceAddress = 0;
3172  DeviceInfo->HubAddress = 0; //FIXME
3173  DeviceInfo->DeviceSpeed = UsbHighSpeed; //FIXME
3174  DeviceInfo->DeviceType = Usb20Device; //FIXME
3175  DeviceInfo->NumberOfOpenPipes = 0; //FIXME
3176 
3177  //
3178  // get device descriptor
3179  //
3181 
3182  //
3183  // FIXME return pipe information
3184  //
3185 
3186  //
3187  // store result length
3188  //
3189 #ifdef _MSC_VER
3190  *LengthReturned = FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[DeviceInfo->NumberOfOpenPipes]);
3191 #else
3192  *LengthReturned = sizeof(USB_DEVICE_INFORMATION_0) + (DeviceInfo->NumberOfOpenPipes > 1 ? (DeviceInfo->NumberOfOpenPipes - 1) * sizeof(USB_PIPE_INFORMATION_0) : 0);
3193 #endif
3194  //
3195  // done
3196  //
3197  return STATUS_SUCCESS;
3198 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define PC_ASSERT(exp)
Definition: usbehci.h:17
const UCHAR ROOTHUB2_DEVICE_DESCRIPTOR[]
struct _USB_PIPE_INFORMATION_0 USB_PIPE_INFORMATION_0
struct _USB_DEVICE_INFORMATION_0 * PUSB_DEVICE_INFORMATION_0
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
IUSBDevice * PUSBDEVICE
struct _USB_DEVICE_INFORMATION_0 USB_DEVICE_INFORMATION_0
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ FILE_INFORMATION_CLASS _Out_opt_ PULONG LengthReturned
Definition: fltkernel.h:1306
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
struct _DeviceInfo DeviceInfo
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
_In_ PUSB_DEVICE_HANDLE _In_ ULONG DeviceInformationBufferLength
Definition: hubbusif.h:181
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_RemoveUsbDevice()

NTSTATUS USB_BUSIFFN USBHI_RemoveUsbDevice ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  DeviceHandle,
ULONG  Flags 
)

Definition at line 2961 of file hub_controller.cpp.

2965 {
2966  PUSBDEVICE UsbDevice;
2967  CHubController * Controller;
2968  NTSTATUS Status;
2969 
2970  DPRINT("USBHI_RemoveUsbDevice\n");
2971 
2972  //
2973  // first get controller
2974  //
2975  Controller = (CHubController *)BusContext;
2976  PC_ASSERT(Controller);
2977 
2978  //
2979  // get device object
2980  //
2981  UsbDevice = (PUSBDEVICE)DeviceHandle;
2982  PC_ASSERT(UsbDevice);
2983 
2984  //
2985  // validate device handle
2986  //
2987  if (!Controller->ValidateUsbDevice(UsbDevice))
2988  {
2989  DPRINT1("USBHI_RemoveUsbDevice invalid device handle %p\n", DeviceHandle);
2990 
2991  //
2992  // invalid device handle
2993  //
2995  }
2996 
2997  //
2998  // check if there were flags passed
2999  //
3001  {
3002  //
3003  // ignore flags for now
3004  //
3005  return STATUS_SUCCESS;
3006  }
3007 
3008  //
3009  // remove device
3010  //
3011  Status = Controller->RemoveUsbDevice(UsbDevice);
3012  if (!NT_SUCCESS(Status))
3013  {
3014  //
3015  // invalid device handle
3016  //
3017  DPRINT1("USBHI_RemoveUsbDevice Invalid device handle %p\n", UsbDevice);
3019  }
3020 
3021  //
3022  // release usb device
3023  //
3024  UsbDevice->Release();
3025 
3026  //
3027  // done
3028  //
3029  return STATUS_SUCCESS;
3030 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define PC_ASSERT(exp)
Definition: usbehci.h:17
#define USBD_MARK_DEVICE_BUSY
Definition: hubbusif.h:30
LONG NTSTATUS
Definition: precomp.h:26
IUSBDevice * PUSBDEVICE
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define USBD_KEEP_DEVICE_DATA
Definition: hubbusif.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS RemoveUsbDevice(PUSBDEVICE UsbDevice)
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface(), and USBHI_RestoreUsbDevice().

◆ USBHI_RestoreUsbDevice()

NTSTATUS USB_BUSIFFN USBHI_RestoreUsbDevice ( PVOID  BusContext,
PUSB_DEVICE_HANDLE  OldDeviceHandle,
PUSB_DEVICE_HANDLE  NewDeviceHandle 
)

Definition at line 3034 of file hub_controller.cpp.

3038 {
3039  PUSBDEVICE OldUsbDevice, NewUsbDevice;
3040  CHubController * Controller;
3041 
3042  DPRINT("USBHI_RestoreUsbDevice\n");
3043 
3044  //
3045  // first get controller
3046  //
3047  Controller = (CHubController *)BusContext;
3048  PC_ASSERT(Controller);
3049 
3050  //
3051  // get device object
3052  //
3053  OldUsbDevice = (PUSBDEVICE)OldDeviceHandle;
3054  NewUsbDevice = (PUSBDEVICE)NewDeviceHandle;
3055  PC_ASSERT(OldUsbDevice);
3057 
3058  //
3059  // validate device handle
3060  //
3061  PC_ASSERT(Controller->ValidateUsbDevice(NewUsbDevice));
3062  PC_ASSERT(Controller->ValidateUsbDevice(OldUsbDevice));
3063 
3064  DPRINT1("NewUsbDevice: DeviceAddress %x\n", NewUsbDevice->GetDeviceAddress());
3065  DPRINT1("OldUsbDevice: DeviceAddress %x\n", OldUsbDevice->GetDeviceAddress());
3066 
3067  //
3068  // remove old device handle
3069  //
3070  USBHI_RemoveUsbDevice(BusContext, OldDeviceHandle, 0);
3071 
3072  return STATUS_SUCCESS;
3073 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
NTSTATUS USB_BUSIFFN USBHI_RemoveUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags)
IUSBDevice * PUSBDEVICE
_Inout_ PUSB_DEVICE_HANDLE OldDeviceHandle
Definition: hubbusif.h:161
void DPRINT(...)
Definition: polytest.cpp:61
#define DPRINT1
Definition: precomp.h:8
_Outptr_ PUSB_DEVICE_HANDLE * NewDeviceHandle
Definition: hubbusif.h:40
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_RootHubInitNotification()

NTSTATUS USB_BUSIFFN USBHI_RootHubInitNotification ( PVOID  BusContext,
PVOID  CallbackContext,
PRH_INIT_CALLBACK  CallbackRoutine 
)

Definition at line 3408 of file hub_controller.cpp.

3412 {
3413  CHubController * Controller;
3414  PINIT_ROOT_HUB_CONTEXT WorkItem;
3415 
3416  DPRINT("USBHI_RootHubInitNotification %p \n", CallbackContext);
3417 
3418  //
3419  // get controller object
3420  //
3421  Controller = (CHubController*)BusContext;
3422  PC_ASSERT(Controller);
3423 
3424  //
3425  // set notification routine
3426  //
3428 
3429  //
3430  // Create and initialize work item data
3431  //
3433  if (!WorkItem)
3434  {
3435  DPRINT1("Failed to allocate memory!n");
3437  }
3438 
3439  //
3440  // init context
3441  //
3442  WorkItem->CallbackRoutine = CallbackRoutine;
3443  WorkItem->CallbackContext = CallbackContext;
3444 
3445  //
3446  // Queue the work item to handle initializing the device
3447  //
3448  ExInitializeWorkItem(&WorkItem->WorkItem, InitRootHub, (PVOID)WorkItem);
3450 
3451  //
3452  // done
3453  //
3454  return STATUS_SUCCESS;
3455 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
#define PC_ASSERT(exp)
Definition: usbehci.h:17
WORKER_THREAD_ROUTINE InitRootHub
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
PRH_INIT_CALLBACK CallbackRoutine
Definition: libusb.h:63
void DPRINT(...)
Definition: polytest.cpp:61
WORK_QUEUE_ITEM WorkItem
Definition: usbhub.h:38
#define TAG_USBLIB
Definition: libusb.h:69
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID SetNotification(PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine)
PVOID CallbackContext
Definition: libusb.h:62
#define DPRINT1
Definition: precomp.h:8
struct _WORK_ITEM_DATA * PINIT_ROOT_HUB_CONTEXT
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by CHubController::HandleQueryInterface().

◆ USBHI_SetDeviceHandleData()

VOID USB_BUSIFFN USBHI_SetDeviceHandleData ( PVOID  BusContext,
PVOID  DeviceHandle,
PDEVICE_OBJECT  UsbDevicePdo 
)

Definition at line 3468 of file hub_controller.cpp.

3472 {
3473  PUSBDEVICE UsbDevice;
3474  CHubController * Controller;
3475 
3476  //
3477  // get controller
3478  //
3479  Controller = (CHubController *)BusContext;
3480  PC_ASSERT(Controller);
3481 
3482  //
3483  // get device handle
3484  //
3485  UsbDevice = (PUSBDEVICE)DeviceHandle;
3486 
3487  //
3488  // validate device handle
3489  //
3490  if (!Controller->ValidateUsbDevice(UsbDevice))
3491  {
3492  DPRINT1("USBHI_SetDeviceHandleData DeviceHandle %p is invalid\n", DeviceHandle);
3493 
3494  //
3495  // invalid handle
3496  //
3497  return;
3498  }
3499  else
3500  {
3501  //
3502  // usbhub sends this request as a part of the Pnp startup sequence
3503  // looks like we need apply a dragon voodoo to fixup the device stack
3504  // otherwise usbhub will cause a bugcheck
3505  //
3506  DPRINT1("USBHI_SetDeviceHandleData %p\n", UsbDevicePdo);
3507 
3508  //
3509  // sanity check
3510  //
3511  PC_ASSERT(UsbDevicePdo->AttachedDevice);
3512 
3513  //
3514  // should be usbstor
3515  // fixup device stack voodoo part #2
3516  //
3517  UsbDevicePdo->AttachedDevice->StackSize++;
3518 
3519  //
3520  // set device handle data
3521  //
3522  UsbDevice->SetDeviceHandleData(UsbDevicePdo);
3523  }
3524 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBDevice * PUSBDEVICE
_In_ PVOID _In_ PDEVICE_OBJECT UsbDevicePdo
Definition: hubbusif.h:321
#define DPRINT1
Definition: precomp.h:8
BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice)

Referenced by CHubController::HandleQueryInterface().

◆ USBI_InterfaceDereference()

VOID USB_BUSIFFN USBI_InterfaceDereference ( PVOID  BusContext)

Definition at line 2686 of file hub_controller.cpp.

2688 {
2689  CHubController * Controller = (CHubController*)BusContext;
2690 
2691  DPRINT("USBI_InterfaceDereference\n");
2692 
2693  //
2694  // release
2695  //
2696  Controller->Release();
2697 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by CHubController::HandleQueryInterface().

◆ USBI_InterfaceReference()

VOID USB_BUSIFFN USBI_InterfaceReference ( PVOID  BusContext)

Definition at line 2671 of file hub_controller.cpp.

2673 {
2674  CHubController * Controller = (CHubController*)BusContext;
2675 
2676  DPRINT("USBI_InterfaceReference\n");
2677 
2678  //
2679  // add reference
2680  //
2681  Controller->AddRef();
2682 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by CHubController::HandleQueryInterface().

Variable Documentation

◆ InitRootHub

WORKER_THREAD_ROUTINE InitRootHub

Definition at line 3382 of file hub_controller.cpp.

Referenced by USBHI_RootHubInitNotification().

◆ ROOTHUB2_CONFIGURATION_DESCRIPTOR

const USB_CONFIGURATION_DESCRIPTOR ROOTHUB2_CONFIGURATION_DESCRIPTOR
Initial value:
=
{
1,
1,
0,
0x40,
0x0
}
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
struct _USB_INTERFACE_DESCRIPTOR USB_INTERFACE_DESCRIPTOR
struct _USB_CONFIGURATION_DESCRIPTOR USB_CONFIGURATION_DESCRIPTOR

Definition at line 144 of file hub_controller.cpp.

Referenced by CHubController::HandleGetDescriptor(), and CHubController::HandleSelectConfiguration().

◆ ROOTHUB2_DEVICE_DESCRIPTOR

const UCHAR ROOTHUB2_DEVICE_DESCRIPTOR[]
Initial value:
=
{
0x12,
0x00, 0x20,
0x01,
0x00,
0x08,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00,
0x00,
0x00,
0x01
}
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define USB_DEVICE_CLASS_HUB
Definition: usb100.h:99

Definition at line 124 of file hub_controller.cpp.

Referenced by CHubController::Initialize(), and USBHI_QueryDeviceInformation().

◆ ROOTHUB2_ENDPOINT_DESCRIPTOR

const USB_ENDPOINT_DESCRIPTOR ROOTHUB2_ENDPOINT_DESCRIPTOR
Initial value:
=
{
0x81,
0x01,
0xC
}
struct _USB_ENDPOINT_DESCRIPTOR USB_ENDPOINT_DESCRIPTOR
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
#define USB_ENDPOINT_TYPE_INTERRUPT
Definition: usb100.h:65

Definition at line 169 of file hub_controller.cpp.

Referenced by CHubController::HandleGetDescriptor(), and CHubController::HandleSelectConfiguration().

◆ ROOTHUB2_INTERFACE_DESCRIPTOR

const USB_INTERFACE_DESCRIPTOR ROOTHUB2_INTERFACE_DESCRIPTOR
Initial value:
=
{
0,
0,
0x1,
0x09,
0x01,
0x00,
0x00,
}
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
struct _USB_INTERFACE_DESCRIPTOR USB_INTERFACE_DESCRIPTOR
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usb100.h:52

Definition at line 156 of file hub_controller.cpp.

Referenced by CHubController::HandleGetDescriptor(), and CHubController::HandleSelectConfiguration().