When using a PPS time source, the PHC character device or network interface
specified using the -s command line flag will be ignored.  Detect this
mis-configuration and throw a usage error.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 phc2sys.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/phc2sys.c b/phc2sys.c
index 03347f0..e65bdf5 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1253,6 +1253,10 @@ int main(int argc, char *argv[])
                        "cannot use a pps device unless destination is 
CLOCK_REALTIME\n");
                goto bad_usage;
        }
+       if (hardpps_configured(pps_fd) && src_name) {
+               fprintf(stderr, "please specify -s or -d, but not both\n");
+               goto bad_usage;
+       }
 
        print_set_progname(progname);
        print_set_tag(config_get_string(cfg, NULL, "message_tag"));
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to