phc2sys.c: Implement configuration file handling
Signed-off-by: Peter Schneider <peter@psch.de>master
parent
26308c219a
commit
c70f9b3e07
13
phc2sys.c
13
phc2sys.c
|
@ -1313,6 +1313,7 @@ static void usage(char *progname)
|
||||||
" -O [offset] slave-master time offset (0)\n"
|
" -O [offset] slave-master time offset (0)\n"
|
||||||
" -w wait for ptp4l\n"
|
" -w wait for ptp4l\n"
|
||||||
" common options:\n"
|
" common options:\n"
|
||||||
|
" -f [file] configuration file\n"
|
||||||
" -E [pi|linreg] clock servo (pi)\n"
|
" -E [pi|linreg] clock servo (pi)\n"
|
||||||
" -P [kp] proportional constant (0.7)\n"
|
" -P [kp] proportional constant (0.7)\n"
|
||||||
" -I [ki] integration constant (0.3)\n"
|
" -I [ki] integration constant (0.3)\n"
|
||||||
|
@ -1338,8 +1339,7 @@ static void usage(char *progname)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *progname;
|
char *config = NULL, *dst_name = NULL, *progname, *src_name = NULL;
|
||||||
char *src_name = NULL, *dst_name = NULL;
|
|
||||||
struct clock *src, *dst;
|
struct clock *src, *dst;
|
||||||
struct config *cfg;
|
struct config *cfg;
|
||||||
int autocfg = 0, rt = 0;
|
int autocfg = 0, rt = 0;
|
||||||
|
@ -1367,7 +1367,7 @@ int main(int argc, char *argv[])
|
||||||
progname = strrchr(argv[0], '/');
|
progname = strrchr(argv[0], '/');
|
||||||
progname = progname ? 1+progname : argv[0];
|
progname = progname ? 1+progname : argv[0];
|
||||||
while (EOF != (c = getopt(argc, argv,
|
while (EOF != (c = getopt(argc, argv,
|
||||||
"arc:d:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:t:mqvh"))) {
|
"arc:d:f:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:t:mqvh"))) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
autocfg = 1;
|
autocfg = 1;
|
||||||
|
@ -1386,6 +1386,9 @@ int main(int argc, char *argv[])
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
config = optarg;
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"'-i' has been deprecated. please use '-s' instead.\n");
|
"'-i' has been deprecated. please use '-s' instead.\n");
|
||||||
|
@ -1518,6 +1521,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config && (c = config_read(config, cfg))) {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
if (autocfg && (src_name || dst_name || pps_fd >= 0 || wait_sync || node.forced_sync_offset)) {
|
if (autocfg && (src_name || dst_name || pps_fd >= 0 || wait_sync || node.forced_sync_offset)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"autoconfiguration cannot be mixed with manual config options.\n");
|
"autoconfiguration cannot be mixed with manual config options.\n");
|
||||||
|
|
Loading…
Reference in New Issue