summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@sullrich-MacBookPro.local>2009-04-05 15:38:00 -0400
committerScott Ullrich <sullrich@sullrich-MacBookPro.local>2009-04-05 15:38:00 -0400
commit8e9fa41d89416aa19dd742e5177bdf237b375923 (patch)
tree57e6c987f2c23711cabc0038a5a05372e27dbf53
parent37c7bad8159cd15a684da7e1160243526f6c566c (diff)
downloadpfsense-8e9fa41d89416aa19dd742e5177bdf237b375923.zip
pfsense-8e9fa41d89416aa19dd742e5177bdf237b375923.tar.gz
Adding PowerD knob to system -> advanced -> misc. This will be useful
for folks wishing for their firewall to use less power overall. Blurb from the powerd man page from freebsd: The powerd utility monitors the system state and sets various power con- trol options accordingly. It offers three modes (maximum, minimum, and adaptive) that can be individually selected while on AC power or batter- ies. The modes maximum, minimum, and adaptive may be abbreviated max, min, adp. Maximum mode chooses the highest performance values. Minimum mode selects the lowest performance values to get the most power savings. Adaptive mode attempts to strike a balance by degrading performance when the system appears idle and increasing it when the system is busy. It offers a good balance between a small performance loss for greatly increased power savings. The default mode is adaptive.
-rw-r--r--etc/inc/system.inc9
-rwxr-xr-xetc/rc.bootup3
-rw-r--r--usr/local/www/system_advanced_misc.php24
3 files changed, 36 insertions, 0 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index ef2884b..c75de77 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -32,6 +32,15 @@
/* include all configuration functions */
require_once("functions.inc");
+function activate_powerd() {
+ global $config, $g;
+ if(isset($config['system']['powerd_enable'])) {
+ exec("/usr/sbin/powerd -b adp -a adp");
+ } else {
+ exec("/usr/bin/killall powerd");
+ }
+}
+
function activate_sysctls() {
global $config, $g;
diff --git a/etc/rc.bootup b/etc/rc.bootup
index b19bf41..4dda274 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -280,6 +280,9 @@
/* start the upnp daemon if it is enabled */
upnp_start();
+ /* If powerd is enabled, lets launch it */
+ activate_powerd();
+
mwexec_bg("/usr/sbin/update_dns_cache.sh");
/* done */
diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php
index b64985a..23722ae 100644
--- a/usr/local/www/system_advanced_misc.php
+++ b/usr/local/www/system_advanced_misc.php
@@ -46,6 +46,7 @@ require("guiconfig.inc");
$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
+$pconfig['powerd_enable'] = isset($config['system']['powerd_enable']);
if ($_POST) {
@@ -69,6 +70,7 @@ if ($_POST) {
unset($config['system']['lb_use_sticky']);
$config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
+ $config['system']['powerd_enable'] = $_POST['powerd_enable'] ? true : false;
write_config();
@@ -80,6 +82,8 @@ if ($_POST) {
else
$savemsg = $retval;
config_unlock();
+
+ activate_powerd();
}
}
@@ -145,6 +149,26 @@ include("head.inc");
<td colspan="2" class="list" height="12">&nbsp;</td>
</tr>
<tr>
+ <td width="22%" valign="top" class="vncell">PowerD</td>
+ <td width="78%" class="vtable">
+ <input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?php if ($pconfig['powerd_enable']) echo "checked"; ?> />
+ <br />
+ The powerd utility monitors the system state and sets various power con-
+ trol options accordingly. It offers three modes (maximum, minimum, and
+ adaptive) that can be individually selected while on AC power or batter-
+ ies. The modes maximum, minimum, and adaptive may be abbreviated max,
+ min, adp. Maximum mode chooses the highest performance values. Minimum
+ mode selects the lowest performance values to get the most power savings.
+ Adaptive mode attempts to strike a balance by degrading performance when
+ the system appears idle and increasing it when the system is busy. It
+ offers a good balance between a small performance loss for greatly
+ increased power savings. The default mode for pfSense is adaptive.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12">&nbsp;</td>
+ </tr>
+ <tr>
<td colspan="2" valign="top" class="listtopic">IP Security</td>
</tr>
<tr>
OpenPOWER on IntegriCloud