Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
81adcc8c
Commit
81adcc8c
authored
Nov 26, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/tools: add '-w' option to wr_mon
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
9c2217cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
wr_mon.c
userspace/tools/wr_mon.c
+43
-1
No files found.
userspace/tools/wr_mon.c
View file @
81adcc8c
...
...
@@ -141,6 +141,44 @@ void show_ports(void)
}
}
/*
* This is almost a copy of the above, used by web interface.
* Code duplication is bad, but this is better than a separate tool
* which is almost identical but even broken
*/
static
void
show_unadorned_ports
(
void
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
18
;
i
++
)
{
char
if_name
[
10
],
found
=
0
;
hexp_port_state_t
state
;
snprintf
(
if_name
,
10
,
"wr%d"
,
i
);
for
(
j
=
0
;
j
<
port_list
.
num_ports
;
j
++
)
if
(
!
strcmp
(
port_list
.
port_names
[
j
],
if_name
))
{
found
=
1
;
break
;
}
if
(
!
found
)
continue
;
halexp_get_port_state
(
&
state
,
if_name
);
printf
(
"%s %s %s %s
\n
"
,
/* trailing space needed? */
state
.
up
?
"up"
:
"down"
,
state
.
mode
==
HEXP_PORT_MODE_WR_MASTER
?
"Master"
:
"Slave"
,
/* FIXME: other options? */
state
.
is_locked
?
"Locked"
:
"NoLock"
,
state
.
rx_calibrated
&&
state
.
tx_calibrated
?
"Calibrated"
:
"Uncalibrated"
);
}
}
void
show_servo
(
void
)
{
ptpdexp_sync_state_t
ss
;
...
...
@@ -260,7 +298,7 @@ int main(int argc, char *argv[])
int
opt
;
int
usecolor
=
1
;
while
((
opt
=
getopt
(
argc
,
argv
,
"sbgp"
))
!=
-
1
)
while
((
opt
=
getopt
(
argc
,
argv
,
"sbgp
w
"
))
!=
-
1
)
{
switch
(
opt
)
{
...
...
@@ -280,6 +318,10 @@ int main(int argc, char *argv[])
init
(
0
);
show_all
();
exit
(
0
);
case
'w'
:
/* for the web interface */
init
(
0
);
show_unadorned_ports
();
exit
(
0
);
default:
fprintf
(
stderr
,
"Unrecognized option.
\n
"
);
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment