diff --git a/sysutils/pfSense-pkg-LCDproc/Makefile b/sysutils/pfSense-pkg-LCDproc/Makefile index e3a76ebb4177..74381acedb0e 100644 --- a/sysutils/pfSense-pkg-LCDproc/Makefile +++ b/sysutils/pfSense-pkg-LCDproc/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-LCDproc -PORTVERSION= 0.11 +PORTVERSION= 0.11.1 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty diff --git a/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc.inc b/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc.inc index 9552cf1db696..abae53c90d08 100644 --- a/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc.inc +++ b/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc.inc @@ -50,17 +50,6 @@ function lcdproc_write_config($file, $text) { fclose($handle); } -function lcdproc_write_script($file, $text) { - $handle = fopen($file, 'wx'); - if (!$handle) { - lcdproc_warn("Could not open {$file} for writing."); - exit; - } - fwrite($handle, $text); - fclose($handle); - chmod($file, 0755); -} - function validate_form_lcdproc($post, &$input_errors) { if ($post['comport']) { switch($post['comport']) { @@ -524,6 +513,8 @@ EOD; if (is_service_running(LCDPROC_SERVICE_NAME)) { lcdproc_notice("Sync: Restarting the service"); restart_service(LCDPROC_SERVICE_NAME); + } else { + start_service(LCDPROC_SERVICE_NAME); } } @@ -546,8 +537,7 @@ EOD; function set_lcd_value($fieldname, $max, $default_value) { global $config; - $lcdproc_config = $config['installedpackages']['lcdproc']['config'][0]; - $value = $lcdproc_config[$fieldname]; + $value = config_get_path("installedpackages/lcdproc/config/0/{$fieldname}"); $returnvalue = ""; if ($value != '' && $value != '-1') { $realvalue = (int)($max * $value / 100); diff --git a/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc_client.php b/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc_client.php index ec8c14bda22d..d51f8bb616e5 100644 --- a/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc_client.php +++ b/sysutils/pfSense-pkg-LCDproc/files/usr/local/pkg/lcdproc_client.php @@ -26,53 +26,12 @@ require_once("interfaces.inc"); require_once("pfsense-utils.inc"); require_once("ipsec.inc"); +require_once("includes/functions.inc.php"); require_once("/usr/local/pkg/lcdproc.inc"); require_once("system.inc"); -function get_pfstate() { - $matches = ""; - $maxstates = '/'; - if ((int) config_get_path('system/maximumstates', 0) > 0) { - $maxstates .= config_get_path('system/maximumstates'); - } else { - $maxstates .= pfsense_default_state_size(); - } - $curentries = shell_exec('/sbin/pfctl -si | /usr/bin/grep current'); - if (preg_match("/([0-9]+)/", $curentries, $matches)) { - $curentries = $matches[1]; - } - return $curentries . $maxstates; -} - -function disk_usage() { - $dfout = ""; - exec("/bin/df -h | /usr/bin/grep -w '/' | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d '%' -f 1", $dfout); - $diskusage = trim($dfout[0]); - - return $diskusage; -} - -function mem_usage() { - $memUsage = "NA"; - $totalMem = (int) get_single_sysctl("vm.stats.vm.v_page_count"); - if (is_numeric($totalMem)) { - /* Include inactive and laundry with free memory since they - * could be freed under pressure. */ - $inactiveMem = (int) get_single_sysctl("vm.stats.vm.v_inactive_count"); - $laundryMem = (int) get_single_sysctl("vm.stats.vm.v_laundry_count"); - $freeMem = (int) get_single_sysctl("vm.stats.vm.v_free_count"); - if (is_numeric($inactiveMem) && - is_numeric($laundryMem) && - is_numeric($freeMem)) { - $usedMem = $totalMem - ($inactiveMem + $laundryMem + $freeMem); - $memUsage = round(($usedMem * 100) / $totalMem, 0); - } - } - return $memUsage; -} - /* Calculates non-idle CPU time and returns as a percentage */ -function cpu_usage() { +function lcdproc_cpu_usage() { $duration = 250000; $diff = array('user', 'nice', 'sys', 'intr', 'idle'); $cpuTicks = array_combine($diff, explode(" ", get_single_sysctl("kern.cp_time"))); @@ -118,11 +77,11 @@ function get_loadavg_stats() { return ($count >= 3) ? "{$temp[$count - 3]} {$temp[$count - 2]} {$temp[$count - 1]}" : "Not available"; } -function get_mbuf_stats() { - exec("/usr/bin/netstat -mb | /usr/bin/grep \"mbufs in use\" | /usr/bin/awk '{ print $1 }' | /usr/bin/cut -d\"/\" -f1", $mbufs_inuse); - exec("/usr/bin/netstat -mb | /usr/bin/grep \"mbufs in use\" | /usr/bin/awk '{ print $1 }' | /usr/bin/cut -d\"/\" -f3", $mbufs_total); - $status = "{$mbufs_inuse[0]} \/ {$mbufs_total[0]}"; - return($status); +function lcdproc_get_mbuf_stats() { + $mbuf = ""; + $mbufpercent = ""; + get_mbuf($mbuf, $mbufpercent); + return($mbuf); } function get_version() { @@ -1045,7 +1004,7 @@ function loop_status($lcd) { /* prepare the summary data */ if ($lcdpanel_height >= "4") { $summary_states = explode("/", get_pfstate()); - $lcd_summary_data = sprintf("%02d%% %02d%% %6d", cpu_usage(), mem_usage(), $summary_states[0]); + $lcd_summary_data = sprintf("%02d%% %02d%% %6d", lcdproc_cpu_usage(), mem_usage(), $summary_states[0]); if ($lcdpanel_width > "16") { /* Include the CPU frequency as a percentage */ $maxfreq = get_cpu_maxfrequency(); @@ -1089,7 +1048,7 @@ function loop_status($lcd) { $led_output_value = $led_output_value + pow(2, 5); } /* LED 3: CPU Usage */ - if (cpu_usage() > 50) { + if (lcdproc_cpu_usage() > 50) { $led_output_value = $led_output_value + pow(2, 6); } else { $led_output_value = $led_output_value + pow(2, 2); @@ -1138,7 +1097,7 @@ function loop_status($lcd) { $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$hostname}\""; break; case "scr_system": - $processor = cpu_usage(); + $processor = lcdproc_cpu_usage(); $memory = mem_usage(); $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"CPU {$processor}%, Mem {$memory}%\""; break; @@ -1167,7 +1126,7 @@ function loop_status($lcd) { $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$interfaces}\""; break; case "scr_mbuf": - $mbufstats = get_mbuf_stats(); + $mbufstats = lcdproc_get_mbuf_stats(); $lcd_cmds[] = "widget_set {$name} text_wdgt 1 2 {$lcdpanel_width} 2 h 4 \"{$mbufstats}\""; break; case "scr_cpufrequency": diff --git a/sysutils/pfSense-pkg-LCDproc/files/usr/local/www/packages/lcdproc/lcdproc.php b/sysutils/pfSense-pkg-LCDproc/files/usr/local/www/packages/lcdproc/lcdproc.php index 6fec7ab8a794..8e903e5b8dca 100644 --- a/sysutils/pfSense-pkg-LCDproc/files/usr/local/www/packages/lcdproc/lcdproc.php +++ b/sysutils/pfSense-pkg-LCDproc/files/usr/local/www/packages/lcdproc/lcdproc.php @@ -175,7 +175,7 @@ 'MD8800' => 'MD8800', 'ms6931' => 'ms6931', 'mtc_s16209x' => 'mtc_s16209x', - 'MtxOrb' => 'Matrix Orbital', + 'MtxOrb' => 'Matrix Orbital and Compatible', 'nexcom' => 'nexcom (x86 only)', 'NoritakeVFD' => 'NoritakeVFD', 'picolcd' => 'picolcd', @@ -256,7 +256,8 @@ 'Select the Matrix Orbital display type.%1$s' . 'Some old firmware versions of Matrix Orbital modules do not support an adjustable backlight' . 'but only can switch the backlight on/off. If you own such a module and experience randomly' . - 'appearing block characters and backlight cannot be switched on or off, uncheck the adjustable backlight option.' + 'appearing block characters and backlight cannot be switched on or off, uncheck the adjustable backlight option.', + '
' ); $section->add($subsection); ?>