ReactOS 0.4.17-dev-1133-gc25e4fd
hub.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS SuperSpeed USB Hub Driver
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Hub FDO creation and PnP power callbacks
5 * COPYRIGHT: Copyright 2026 Justin Miller <justinmiller100@gmail.com>
6 */
7
8#include "usbhub3.h"
9
10#define NDEBUG
11#include <debug.h>
12
16 _In_ WDFDRIVER Driver,
18{
22 WDFDEVICE Device;
24
26 PAGED_CODE();
27
28 WdfDeviceInitSetDeviceType(DeviceInit, FILE_DEVICE_USB);
29
35 WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &PnpPower);
36
38
39 Status = WdfDeviceCreate(&DeviceInit, &Attributes, &Device);
40 if (!NT_SUCCESS(Status))
41 {
42 DPRINT1("WdfDeviceCreate failed 0x%lx\n", Status);
43 return Status;
44 }
45
46 Hub = HubGetFdoContext(Device);
47 Hub->Device = Device;
48 Hub->ParentTarget = WdfDeviceGetIoTarget(Device);
49
50 return STATUS_SUCCESS;
51}
52
56 _In_ WDFDEVICE Device,
57 _In_ WDFCMRESLIST ResourcesRaw,
58 _In_ WDFCMRESLIST ResourcesTranslated)
59{
63
64 /* Query the controller stack interface from the parent, read the hub descriptor */
66 return STATUS_SUCCESS;
67}
68
72 _In_ WDFDEVICE Device,
73 _In_ WDFCMRESLIST ResourcesTranslated)
74{
77
79 return STATUS_SUCCESS;
80}
81
85 _In_ WDFDEVICE Device,
87{
90
91 /* Power the ports and arm the status change interrupt transfer */
93 return STATUS_SUCCESS;
94}
95
99 _In_ WDFDEVICE Device,
101{
104
106 return STATUS_SUCCESS;
107}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
#define _Inout_
Definition: no_sal2.h:162
#define _In_
Definition: no_sal2.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define STATUS_SUCCESS
Definition: shellext.h:65
WDFIOTARGET ParentTarget
Definition: usbhub3.h:21
WDFDEVICE Device
Definition: usbhub3.h:20
PFN_WDF_DEVICE_D0_ENTRY EvtDeviceD0Entry
Definition: wdfdevice.h:1164
PFN_WDF_DEVICE_D0_EXIT EvtDeviceD0Exit
Definition: wdfdevice.h:1166
PFN_WDF_DEVICE_PREPARE_HARDWARE EvtDevicePrepareHardware
Definition: wdfdevice.h:1168
PFN_WDF_DEVICE_RELEASE_HARDWARE EvtDeviceReleaseHardware
Definition: wdfdevice.h:1169
#define NTAPI
Definition: typedefs.h:36
EVT_WDF_DEVICE_D0_ENTRY HubEvtDeviceD0Entry
Definition: usbhub3.h:33
EVT_WDF_DEVICE_RELEASE_HARDWARE HubEvtDeviceReleaseHardware
Definition: usbhub3.h:32
EVT_WDF_DRIVER_DEVICE_ADD HubEvtDeviceAdd
Definition: usbhub3.h:30
EVT_WDF_DEVICE_PREPARE_HARDWARE HubEvtDevicePrepareHardware
Definition: usbhub3.h:31
EVT_WDF_DEVICE_D0_EXIT HubEvtDeviceD0Exit
Definition: usbhub3.h:34
#define FILE_DEVICE_USB
Definition: usbiodef.h:90
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
_In_ WDF_POWER_DEVICE_STATE PreviousState
Definition: wdfdevice.h:829
enum _WDF_POWER_DEVICE_STATE WDF_POWER_DEVICE_STATE
_In_ WDFCMRESLIST _In_ WDFCMRESLIST ResourcesTranslated
Definition: wdfdevice.h:891
FORCEINLINE VOID WDF_PNPPOWER_EVENT_CALLBACKS_INIT(_Out_ PWDF_PNPPOWER_EVENT_CALLBACKS Callbacks)
Definition: wdfdevice.h:1214
_In_ WDF_POWER_DEVICE_STATE TargetState
Definition: wdfdevice.h:859
_In_ WDFCMRESLIST ResourcesRaw
Definition: wdfdevice.h:888
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170