phc2sys.c: Sync variable 'node.clock_servo with cfg item

Use struct config item 'clock_servo' for parameter handling. Copy this to
node.servo_type afterwards.

Signed-off-by: Peter Schneider <peter@psch.de>
master
Peter Schneider 2018-04-15 21:13:52 +02:00 committed by Richard Cochran
parent cfbc8bdc18
commit 41fa8e9d32
1 changed files with 7 additions and 4 deletions

View File

@ -1350,7 +1350,6 @@ int main(int argc, char *argv[])
double phc_rate, tmp; double phc_rate, tmp;
struct node node = { struct node node = {
.sanity_freq_limit = 200000000, .sanity_freq_limit = 200000000,
.servo_type = CLOCK_SERVO_PI,
.phc_readings = 5, .phc_readings = 5,
.phc_interval = 1.0, .phc_interval = 1.0,
.kernel_leap = 1, .kernel_leap = 1,
@ -1397,11 +1396,14 @@ int main(int argc, char *argv[])
break; break;
case 'E': case 'E':
if (!strcasecmp(optarg, "pi")) { if (!strcasecmp(optarg, "pi")) {
node.servo_type = CLOCK_SERVO_PI; config_set_int(cfg, "clock_servo",
CLOCK_SERVO_PI);
} else if (!strcasecmp(optarg, "linreg")) { } else if (!strcasecmp(optarg, "linreg")) {
node.servo_type = CLOCK_SERVO_LINREG; config_set_int(cfg, "clock_servo",
CLOCK_SERVO_LINREG);
} else if (!strcasecmp(optarg, "ntpshm")) { } else if (!strcasecmp(optarg, "ntpshm")) {
node.servo_type = CLOCK_SERVO_NTPSHM; config_set_int(cfg, "clock_servo",
CLOCK_SERVO_NTPSHM);
} else { } else {
fprintf(stderr, fprintf(stderr,
"invalid servo name %s\n", optarg); "invalid servo name %s\n", optarg);
@ -1541,6 +1543,7 @@ int main(int argc, char *argv[])
print_set_verbose(config_get_int(cfg, NULL, "verbose")); print_set_verbose(config_get_int(cfg, NULL, "verbose"));
print_set_syslog(config_get_int(cfg, NULL, "use_syslog")); print_set_syslog(config_get_int(cfg, NULL, "use_syslog"));
print_set_level(config_get_int(cfg, NULL, "logging_level")); print_set_level(config_get_int(cfg, NULL, "logging_level"));
node.servo_type = config_get_int(cfg, NULL, "clock_servo");
if (autocfg) { if (autocfg) {
if (init_pmc(cfg, &node)) if (init_pmc(cfg, &node))