From 2f810bc1bb012edc911a7243ea5fac2203ba4025 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 26 Apr 2005 23:19:50 +0000 Subject: [PATCH] Add the ability to turn on the serial console from the advanced menu. This should address Ticket #19 but needs testing --- usr/local/www/system_advanced.php | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/usr/local/www/system_advanced.php b/usr/local/www/system_advanced.php index 0c635c76d4..8111f69ebf 100755 --- a/usr/local/www/system_advanced.php +++ b/usr/local/www/system_advanced.php @@ -57,6 +57,7 @@ $pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout']; $pconfig['schedulertype'] = $config['system']['schedulertype']; $pconfig['maximumstates'] = $config['system']['maximumstates']; $pconfig['disablerendevouz'] = $config['system']['disablerendevouz']; +$pconfig['enableserial'] = $config['system']['enableserial']; if ($_POST) { @@ -139,6 +140,8 @@ if ($_POST) { $config['system']['webgui']['expanddiags'] = $_POST['expanddiags'] ? true : false; $config['system']['optimization'] = $_POST['optimization']; $config['system']['disablerendevouz'] = $_POST['disablerendevouz']; + + $config['system']['enableserial'] = $_POST['enableserial']; $oldharddiskstandby = $config['system']['harddiskstandby']; $config['system']['harddiskstandby'] = $_POST['harddiskstandby']; @@ -168,6 +171,29 @@ if ($_POST) { $retval |= interfaces_optional_configure(); config_unlock(); } + + $etc_ttys = return_filename_as_array("/etc/ttys"); + $boot_loader_rc = return_filename_as_array("/boot/loader.rc"); + + $fout = fopen("/etc/ttys","w"); + foreach($etc_ttys as $tty) { + if(stristr($tty,"ttyp0") <> true) { + fwrite($fout, $tty . "\n"); + } + } + if($pconfig['enableserial'] <> "") + fwrite($fout, "ttyv0\t\"/usr/libexec/getty Pc\"\tcons25\ton\tsecure\n"); + fclose($fout); + + $fout = fopen("/boot/loader.rc","w"); + foreach($boot_loader_rc as $blrc) { + if(stristr($blrc,"comconsole") <> true) { + fwrite($fout, $blrc . "\n"); + } + } + if($pconfig['enableserial'] <> "") + fwrite($fout, "set console=comconsole\n"); + fclose($fout); } } ?> @@ -233,6 +259,17 @@ function update_description(itemnum) { + + + + + + + +
Enable Serial Console
  + onclick="enable_change(false)"> + This will enable the first serial port with 9600/8/N/1 +