Skip to content

Commit

Permalink
AirportItlwm: Fake all power path the same power state, notify that p…
Browse files Browse the repository at this point in the history
…ower state has changed of the current ethernet service.
  • Loading branch information
zxystd committed Feb 8, 2023
1 parent 7e384c0 commit ddd2768
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion AirportItlwm/AirportSTAIOCTL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,11 @@ getPOWER(OSObject *object,
if (!pd)
return kIOReturnError;
pd->version = APPLE80211_VERSION;
pd->num_radios = 1;
pd->num_radios = 4;
pd->power_state[0] = power_state;
pd->power_state[1] = power_state;
pd->power_state[2] = power_state;
pd->power_state[3] = power_state;
return kIOReturnSuccess;
}

Expand All @@ -983,14 +986,17 @@ setPOWER(OSObject *object,
{
if (!pd)
return kIOReturnError;
IOLog("itlwm: setPOWER: num_radios[%d] power_state(0:%u 1:%u 2:%u 3:%u)\n", pd->num_radios, pd->power_state[0], pd->power_state[1], pd->power_state[2], pd->power_state[3]);
if (pd->num_radios > 0) {
bool isRunning = (fHalService->get80211Controller()->ic_ac.ac_if.if_flags & (IFF_UP | IFF_RUNNING)) != 0;
if (pd->power_state[0] == 0) {
changePowerStateToPriv(1);
if (isRunning) {
net80211_ifstats(fHalService->get80211Controller());
disableAdapter(fNetIf);
}
} else {
changePowerStateToPriv(2);
if (!isRunning)
enableAdapter(fNetIf);
}
Expand Down

0 comments on commit ddd2768

Please sign in to comment.