forked from coolstar/wificx-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
power.cpp
55 lines (45 loc) · 1.26 KB
/
power.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "precomp.h"
#include "trace.h"
#include "power.h"
#include "device.h"
#include "adapter.h"
_Use_decl_annotations_
NTSTATUS
EvtDeviceD0Entry(
_In_ WDFDEVICE wdfDevice,
WDF_POWER_DEVICE_STATE previousState)
{
MTK_ADAPTER* adapter = MtkGetDeviceContext(wdfDevice)->Adapter;
TraceEntry(TraceLoggingUInt32(previousState, "PreviousState"));
if (previousState != WdfPowerDeviceD3Final)
{
// We're coming back from low power, undo what
// we did in EvtDeviceD0Exit
}
TraceExitResult(STATUS_SUCCESS);
return STATUS_SUCCESS;
}
_Use_decl_annotations_
NTSTATUS
EvtDeviceD0Exit(
_In_ WDFDEVICE Device,
_In_ WDF_POWER_DEVICE_STATE TargetState
)
{
MTK_ADAPTER* adapter = MtkGetDeviceContext(Device)->Adapter;
TraceEntry();
if (TargetState != WdfPowerDeviceD3Final)
{
NET_ADAPTER_LINK_STATE linkState;
NET_ADAPTER_LINK_STATE_INIT(
&linkState,
NDIS_LINK_SPEED_UNKNOWN,
MediaConnectStateUnknown,
MediaDuplexStateUnknown,
NetAdapterPauseFunctionTypeUnknown,
NetAdapterAutoNegotiationFlagNone);
NetAdapterSetLinkState(adapter->NetAdapter, &linkState);
}
TraceExitResult(STATUS_SUCCESS);
return STATUS_SUCCESS;
}