summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorRobert Noland <rnoland@FreeBSD.org>2015-03-10 18:38:27 +0000
committerRenato Botelho <garga@FreeBSD.org>2015-05-30 11:39:13 -0300
commitd6daed606ed073a9ac8a4976dfe9b98d47312525 (patch)
treeb54623fd07ad2e3a7829157c2fcbca7a0605dc3b /etc
parent139ca5491b8ad36ff65d902f0bde2b1ea106477d (diff)
downloadpfsense-d6daed606ed073a9ac8a4976dfe9b98d47312525.zip
pfsense-d6daed606ed073a9ac8a4976dfe9b98d47312525.tar.gz
We need to at least setup the serial port before we try to blast
config data to it. My system was hanging during boot because cat was couldn't output gps.init to the port.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/system.inc44
1 files changed, 24 insertions, 20 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 4e534c8..94d71d1 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -1435,6 +1435,30 @@ function system_ntp_setup_gps($serialport) {
unlink_if_exists($gps_device);
@symlink($serialport, $gps_device);
+ $gpsbaud = '4800';
+ if (is_array($config['ntpd']) && is_array($config['ntpd']['gps']) && !empty($config['ntpd']['gps']['speed'])) {
+ switch ($config['ntpd']['gps']['speed']) {
+ case '16':
+ $gpsbaud = '9600';
+ break;
+ case '32':
+ $gpsbaud = '19200';
+ break;
+ case '48':
+ $gpsbaud = '38400';
+ break;
+ case '64':
+ $gpsbaud = '57600';
+ break;
+ case '80':
+ $gpsbaud = '115200';
+ break;
+ }
+ }
+
+ /* Configure the serial port for raw IO and set the speed */
+ `stty -f {$serialport}.init raw speed {$gpsbaud}`
+
/* Send the following to the GPS port to initialize the GPS */
if (is_array($config['ntpd']) && is_array($config['ntpd']['gps']) && !empty($config['ntpd']['gps']['type'])) {
$gps_init = base64_decode($config['ntpd']['gps']['initcmd']);
@@ -1448,26 +1472,6 @@ function system_ntp_setup_gps($serialport) {
/* Add /etc/remote entry in case we need to read from the GPS with tip */
if (intval(`grep -c '^gps0' /etc/remote`) == 0) {
- $gpsbaud = '4800';
- if (is_array($config['ntpd']) && is_array($config['ntpd']['gps']) && !empty($config['ntpd']['gps']['speed'])) {
- switch($config['ntpd']['gps']['speed']) {
- case '16':
- $gpsbaud = '9600';
- break;
- case '32':
- $gpsbaud = '19200';
- break;
- case '48':
- $gpsbaud = '38400';
- break;
- case '64':
- $gpsbaud = '57600';
- break;
- case '80':
- $gpsbaud = '115200';
- break;
- }
- }
@file_put_contents("/etc/remote", "gps0:dv={$serialport}:br#{$gpsbaud}:pa=none:", FILE_APPEND);
}
OpenPOWER on IntegriCloud