Commit 5ce466bf authored by Franco Fichtner's avatar Franco Fichtner

inc: embed otherwise unused is_serial_enabled()

parent a8fe03e2
...@@ -667,6 +667,9 @@ function reload_all_sync() ...@@ -667,6 +667,9 @@ function reload_all_sync()
function setup_serial_port($when = 'save', $path = '') function setup_serial_port($when = 'save', $path = '')
{ {
global $config; global $config;
$serial_enabled = isset($config['system']['enableserial']);
$prefix = ""; $prefix = "";
if (($when == "upgrade") && (!empty($path)) && is_dir($path.'/boot/')) if (($when == "upgrade") && (!empty($path)) && is_dir($path.'/boot/'))
$prefix = "/tmp/{$path}"; $prefix = "/tmp/{$path}";
...@@ -691,7 +694,7 @@ function setup_serial_port($when = 'save', $path = '') ...@@ -691,7 +694,7 @@ function setup_serial_port($when = 'save', $path = '')
fwrite($fd, "{$bcs}\n"); fwrite($fd, "{$bcs}\n");
} }
} }
if (is_serial_enabled()) { if ($serial_enabled) {
fwrite($fd, "-S{$serialspeed} -D\n"); fwrite($fd, "-S{$serialspeed} -D\n");
} }
fclose($fd); fclose($fd);
...@@ -715,7 +718,7 @@ function setup_serial_port($when = 'save', $path = '') ...@@ -715,7 +718,7 @@ function setup_serial_port($when = 'save', $path = '')
&& (stripos($bcs, "autoboot_delay") === false)) && (stripos($bcs, "autoboot_delay") === false))
$new_boot_config[] = $bcs; $new_boot_config[] = $bcs;
if (is_serial_enabled()) { if ($serial_enabled) {
$new_boot_config[] = 'boot_multicons="YES"'; $new_boot_config[] = 'boot_multicons="YES"';
$new_boot_config[] = 'boot_serial="YES"'; $new_boot_config[] = 'boot_serial="YES"';
$primaryconsole = $config['system']['primaryconsole']; $primaryconsole = $config['system']['primaryconsole'];
...@@ -739,7 +742,7 @@ function setup_serial_port($when = 'save', $path = '') ...@@ -739,7 +742,7 @@ function setup_serial_port($when = 'save', $path = '')
$ttys_split = explode("\n", $ttys); $ttys_split = explode("\n", $ttys);
$fd = fopen("/etc/ttys", "w"); $fd = fopen("/etc/ttys", "w");
$on_off = (is_serial_enabled() ? 'on' : 'off'); $on_off = $serial_enabled ? 'on' : 'off';
if (isset($config['system']['disableconsolemenu'])) { if (isset($config['system']['disableconsolemenu'])) {
$console_type = 'Pc'; $console_type = 'Pc';
...@@ -761,13 +764,6 @@ function setup_serial_port($when = 'save', $path = '') ...@@ -761,13 +764,6 @@ function setup_serial_port($when = 'save', $path = '')
reload_ttys(); reload_ttys();
} }
function is_serial_enabled()
{
global $config;
return isset($config['system']['enableserial']);
}
function reload_ttys() function reload_ttys()
{ {
/* force init(8) to reload /etc/ttys */ /* force init(8) to reload /etc/ttys */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment