mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
MFi386: revision 1.125
This commit is contained in:
parent
84409b36ca
commit
8a6d1ef4eb
1 changed files with 20 additions and 0 deletions
|
|
@ -1000,6 +1000,24 @@ apm_record_event(struct apm_softc *sc, u_int event_type)
|
|||
return (sc->sc_flags & SCFLAG_OCTL) ? 0 : 1; /* user may handle */
|
||||
}
|
||||
|
||||
/* Power profile */
|
||||
static void
|
||||
apm_power_profile(struct apm_softc *sc)
|
||||
{
|
||||
int state;
|
||||
struct apm_info info;
|
||||
static int apm_acline = 0;
|
||||
|
||||
if (apm_get_info(&info))
|
||||
return;
|
||||
|
||||
if (apm_acline != info.ai_acline) {
|
||||
apm_acline = info.ai_acline;
|
||||
state = apm_acline ? POWER_PROFILE_PERFORMANCE : POWER_PROFILE_ECONOMY;
|
||||
power_profile_set_state(state);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process APM event */
|
||||
static void
|
||||
apm_processevent(void)
|
||||
|
|
@ -1069,6 +1087,7 @@ apm_processevent(void)
|
|||
break;
|
||||
OPMEV_DEBUGMESSAGE(PMEV_POWERSTATECHANGE);
|
||||
apm_record_event(sc, apm_event);
|
||||
apm_power_profile(sc);
|
||||
break;
|
||||
OPMEV_DEBUGMESSAGE(PMEV_UPDATETIME);
|
||||
apm_record_event(sc, apm_event);
|
||||
|
|
@ -1076,6 +1095,7 @@ apm_processevent(void)
|
|||
break;
|
||||
OPMEV_DEBUGMESSAGE(PMEV_CAPABILITIESCHANGE);
|
||||
apm_record_event(sc, apm_event);
|
||||
apm_power_profile(sc);
|
||||
break;
|
||||
case PMEV_NOEVENT:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue