summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-05-30 11:33:14 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-05-30 11:33:14 -0300
commit6d9f1df48c29693fdaaad44c9e9e60b1ee0bc3ae (patch)
tree366c7e707cb197eef7847a12ccd379390549d218 /etc/inc
parent4199bda9026c654d8438f5a7894b0e4c1857a5af (diff)
parent1e3292410098ca85287d117df615ac75af467359 (diff)
downloadpfsense-6d9f1df48c29693fdaaad44c9e9e60b1ee0bc3ae.zip
pfsense-6d9f1df48c29693fdaaad44c9e9e60b1ee0bc3ae.tar.gz
Merge pull request #1551 from rnoland/master
Diffstat (limited to 'etc/inc')
-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 d7e8673..9aaa884 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -1564,6 +1564,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']);
@@ -1577,26 +1601,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