Make the slave only mode a non-default option.

Now that we have the master code in place, there is no longer any need
to restrict ourselves.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2011-12-27 19:18:52 +01:00
parent e2c02e49c7
commit a736b0c2ff
1 changed files with 8 additions and 4 deletions

12
ptp4l.c
View File

@ -63,6 +63,7 @@ static void usage(char *progname)
" -h prints this message and exits\n" " -h prints this message and exits\n"
" -i [dev] interface device to use, for example 'eth0'\n" " -i [dev] interface device to use, for example 'eth0'\n"
" (may be specified multiple times)\n" " (may be specified multiple times)\n"
" -m slave only mode\n"
" -p [dev] PTP hardware clock device to use, default '%s'\n" " -p [dev] PTP hardware clock device to use, default '%s'\n"
" (ignored for SOFTWARE/LEGACY HW time stamping)\n\n", " (ignored for SOFTWARE/LEGACY HW time stamping)\n\n",
progname, DEFAULT_PHC); progname, DEFAULT_PHC);
@ -71,7 +72,7 @@ static void usage(char *progname)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *phc = DEFAULT_PHC, *progname; char *phc = DEFAULT_PHC, *progname;
int c, i, nports = 0; int c, i, nports = 0, slaveonly = 0;
struct interface iface[MAX_PORTS]; struct interface iface[MAX_PORTS];
enum transport_type transport = TRANS_UDP_IPV4; enum transport_type transport = TRANS_UDP_IPV4;
enum timestamp_type timestamping = TS_HARDWARE; enum timestamp_type timestamping = TS_HARDWARE;
@ -80,7 +81,7 @@ int main(int argc, char *argv[])
/* Process the command line arguments. */ /* Process the command line arguments. */
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, "246hi:p:rsz"))) { while (EOF != (c = getopt(argc, argv, "246hi:mp:rsz"))) {
switch (c) { switch (c) {
case '2': case '2':
transport = TRANS_IEEE_802_3; transport = TRANS_IEEE_802_3;
@ -99,6 +100,9 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
break; break;
case 'm':
slaveonly = 1;
break;
case 'p': case 'p':
phc = optarg; phc = optarg;
break; break;
@ -135,9 +139,9 @@ int main(int argc, char *argv[])
phc = NULL; phc = NULL;
} }
ds.slaveOnly = TRUE; // TODO - make this programmable. ds.slaveOnly = slaveonly ? TRUE : FALSE;
ds.priority1 = 128; ds.priority1 = 128;
ds.clockQuality.clockClass = 255; ds.clockQuality.clockClass = slaveonly ? 255 : 248;
ds.clockQuality.clockAccuracy = 0xfe; ds.clockQuality.clockAccuracy = 0xfe;
ds.clockQuality.offsetScaledLogVariance = 0xffff; ds.clockQuality.offsetScaledLogVariance = 0xffff;
ds.priority2 = 128; ds.priority2 = 128;