From 8e9fa41d89416aa19dd742e5177bdf237b375923 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 5 Apr 2009 15:38:00 -0400 Subject: 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. --- etc/inc/system.inc | 9 +++++++++ etc/rc.bootup | 3 +++ usr/local/www/system_advanced_misc.php | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+) 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");   + PowerD + + /> +
+ 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. + + + +   + + IP Security -- cgit v1.1