diff --git a/sysutils/pfSense-pkg-LCDproc/Makefile b/sysutils/pfSense-pkg-LCDproc/Makefile index 97d73f9c9c2e..bbb4e8af7273 100644 --- a/sysutils/pfSense-pkg-LCDproc/Makefile +++ b/sysutils/pfSense-pkg-LCDproc/Makefile @@ -2,7 +2,7 @@ PORTNAME= pfSense-pkg-LCDproc PORTVERSION= 0.10.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty 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 eeaf91377916..cab721ab72f1 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 @@ -25,6 +25,7 @@ require_once("functions.inc"); require_once("interfaces.inc"); require_once("/usr/local/pkg/lcdproc.inc"); +require_once("system.inc"); function get_pfstate() { global $config; @@ -360,11 +361,7 @@ function send_lcd_commands($lcd, $lcd_cmds) { lcdproc_warn("Failed to interpret lcd commands"); return; } - while (($cmd_output = fgets($lcd, 8000)) !== false) { - if (preg_match("/^huh?/", $cmd_output)) { - lcdproc_notice("LCDd output: \"$cmd_output\". Executed \"$lcd_cmd\""); - } - } + get_lcd_messages($lcd); foreach ($lcd_cmds as $lcd_cmd) { if (! fwrite($lcd, "$lcd_cmd\n")) { lcdproc_warn("Connection to LCDd process lost $errstr ($errno)"); @@ -375,6 +372,24 @@ function send_lcd_commands($lcd, $lcd_cmds) { return true; } +function get_lcd_messages($lcd) { + while (($cmd_output = fgets($lcd, 8000)) !== false) { + if (preg_match("/^huh?/", $cmd_output)) { + lcdproc_notice("LCDd output: \"$cmd_output\". Executed \"$lcd_cmd\""); + } + if (cmenu_enabled()) { + if (preg_match("/^menuevent select r_ask_yes/", $cmd_output)) { + lcdproc_notice("init REBOOT!"); + system_reboot(); + } + if (preg_match("/^menuevent select s_ask_yes/", $cmd_output)) { + lcdproc_notice("init SHUTDOWN!"); + system_halt(); + } + } + } +} + function get_lcdpanel_width() { global $config; $lcdproc_size_config = $config['installedpackages']['lcdproc']['config'][0]; @@ -425,6 +440,15 @@ function outputled_enabled_CFontz633() { } } +function cmenu_enabled() { + global $config; + $lcdproc_config = $config['installedpackages']['lcdproc']['config'][0]; + if (!isset($lcdproc_config['controlmenu'])) { + return false; + } + return true; +} + function outputled_carp() { /* Returns the status of CARP for the box. Assumes ALL CARP status are the same for all the intefaces. @@ -818,6 +842,17 @@ function build_interface($lcd) { $lcd_cmds[] = "hello"; $lcd_cmds[] = "client_set name pfSense"; + /* setup pfsense control menu */ + if (cmenu_enabled()) { + $lcd_cmds[] = 'menu_add_item "" reboot_menu menu "Reboot"'; + $lcd_cmds[] = 'menu_add_item "reboot_menu" r_ask_no action "No" -next _close_'; + $lcd_cmds[] = 'menu_add_item "reboot_menu" r_ask_yes action "Yes" -next _quit_'; + + $lcd_cmds[] = 'menu_add_item "" shutdown_menu menu "Shutdown"'; + $lcd_cmds[] = 'menu_add_item "shutdown_menu" s_ask_no action "No" -next _close_'; + $lcd_cmds[] = 'menu_add_item "shutdown_menu" s_ask_yes action "Yes" -next _quit_'; + } + /* process screens to display */ if (is_array($lcdproc_screens_config)) { foreach ($lcdproc_screens_config as $name => $screen) { 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 d0c1541e2020..7a74cea21c18 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 @@ -41,6 +41,7 @@ if (!isset($pconfig['contrast'])) $pconfig['contrast'] = '-1'; if (!isset($pconfig['backlight'])) $pconfig['backlight'] = 'default'; if (!isset($pconfig['outputleds'])) $pconfig['outputleds'] = 'no'; +if (!isset($pconfig['controlmenu'])) $pconfig['controlmenu'] = 'no'; if (!isset($pconfig['mtxorb_type'])) $pconfig['mtxorb_type'] = 'lcd'; // specific to Matrix Orbital driver if (!isset($pconfig['mtxorb_adjustable_backlight'])) $pconfig['mtxorb_adjustable_backlight'] = true; // specific to Matrix Orbital driver @@ -66,6 +67,7 @@ $lcdproc_config['contrast'] = $pconfig['contrast']; $lcdproc_config['backlight'] = $pconfig['backlight']; $lcdproc_config['outputleds'] = $pconfig['outputleds']; + $lcdproc_config['controlmenu'] = $pconfig['controlmenu']; $lcdproc_config['mtxorb_type'] = $pconfig['mtxorb_type']; $lcdproc_config['mtxorb_adjustable_backlight'] = $pconfig['mtxorb_adjustable_backlight']; @@ -248,7 +250,12 @@ $pconfig['mtxorb_adjustable_backlight'] // initial value ) ); -$subsection->setHelp('Select the Matrix Orbital display type.
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.'); +$subsection->setHelp( + '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.' +); $section->add($subsection); ?> @@ -298,7 +305,11 @@ function updateInputVisibility() { '115200' => '115200 bps' ] ) -)->setHelp('Set the port speed.
Caution: not all the driver or panels support all the speeds, leave "default" if unsure.'); +)->setHelp( + 'Set the port speed.%1$s' . + 'Caution: not all the driver or panels support all the speeds, leave "default" if unsure.', + '
' +); /********* New section *********/ $form->add($section); @@ -331,14 +342,27 @@ function updateInputVisibility() { $pconfig['outputleds'] // checkbox initial value ) )->setHelp( - 'This feature is currently supported by the CFontz633 driver only.
' . - 'Each LED can be off or show two colors: RED (alarm) or GREEN (everything ok) and shows:
' . - 'LED1: NICs status (green: ok, red: at least one nic down)
' . - 'LED2: CARP status (green: master, red: backup, off: CARP not implemented)
' . - 'LED3: CPU status (green < 50%, red > 50%)
' . - 'LED4: Gateway status (green: ok, red: at least one gateway not responding, off: no gateway configured).' + 'This feature is currently supported by the CFontz633 driver only.%1$s' . + 'Each LED can be off or show two colors: RED (alarm) or GREEN (everything ok) and shows:%1$s' . + 'LED1: NICs status (green: ok, red: at least one nic down)%1$s' . + 'LED2: CARP status (green: master, red: backup, off: CARP not implemented)%1$s' . + 'LED3: CPU status (green %2$s 50%, red %3$s 50%)%1$s' . + 'LED4: Gateway status (green: ok, red: at least one gateway not responding, off: no gateway configured).', + '
', '<', '>' ); +$section->addInput( + new Form_Checkbox( + 'controlmenu', // checkbox name (id) + 'pfSense control menu', // checkbox label + 'Enable the pfSense control menu next to LCDproc\'s Options menu.', // checkbox text + $pconfig['controlmenu'] // checkbox initial value + ) +)->setHelp( + 'This will only be usefull on display with buttons.%1$s' . + 'Currently you can REBOOT and HALT the system from there.', + '
' +); $section->addInput( new Form_Select( @@ -360,7 +384,11 @@ function updateInputVisibility() { '100' => '100%' ] ) -)->setHelp('Set the brightness of the LCD panel.
This option is not supported by all the LCD panels, leave "default" if unsure.'); +)->setHelp( + 'Set the brightness of the LCD panel.%1$s' . ' + This option is not supported by all the LCD panels, leave "default" if unsure.', + '
' +); $section->addInput( new Form_Select( @@ -383,8 +411,9 @@ function updateInputVisibility() { ] ) )->setHelp( - 'Set the contrast of the LCD panel.
' . - 'This option is not supported by all the LCD panels, leave "default" if unsure.' + 'Set the contrast of the LCD panel.%1$s' . + 'This option is not supported by all the LCD panels, leave "default" if unsure.', + '
' ); $section->addInput( @@ -399,8 +428,9 @@ function updateInputVisibility() { ] ) )->setHelp( - 'Set the backlight setting. If set to the default value, then the backlight setting of the display can be influenced by the clients.
' . - 'This option is not supported by all the LCD panels, leave "default" if unsure.' + 'Set the backlight setting. If set to the default value, then the backlight setting of the display can be influenced by the clients.%1$s' . + 'This option is not supported by all the LCD panels, leave "default" if unsure.', + '
' ); $section->addInput( @@ -424,8 +454,9 @@ function updateInputVisibility() { ] ) )->setHelp( - 'Set the off-brightness of the LCD panel. This value is used when the display is normally switched off in case LCDd is inactive.
' . - 'This option is not supported by all the LCD panels, leave "default" if unsure.' + 'Set the off-brightness of the LCD panel. This value is used when the display is normally switched off in case LCDd is inactive.%1$s' . + 'This option is not supported by all the LCD panels, leave "default" if unsure.', + '
' ); $form->add($section); // Add the section to our form