Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
745f8d33
Commit
745f8d33
authored
Aug 24, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ben-150805'
parents
584ec43d
ae50473c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
256 additions
and
170 deletions
+256
-170
WMI-firmware.png
doc/startup-guide/WMI-firmware.png
+0
-0
WMI-login.png
doc/startup-guide/WMI-login.png
+0
-0
WMI-mngt.png
doc/startup-guide/WMI-mngt.png
+0
-0
WMI-wrppsi.png
doc/startup-guide/WMI-wrppsi.png
+0
-0
wrs-startup_guide.md
doc/startup-guide/wrs-startup_guide.md
+207
-147
wwwlogin.png
doc/startup-guide/wwwlogin.png
+0
-0
wwwmanagement.png
doc/startup-guide/wwwmanagement.png
+0
-0
functions.php
userspace/rootfs_override/var/www/functions.php
+18
-10
scripts.js
userspace/rootfs_override/var/www/js/scripts.js
+27
-11
ptp.php
userspace/rootfs_override/var/www/ptp.php
+1
-1
reboot.php
userspace/rootfs_override/var/www/reboot.php
+2
-1
wr_mon.c
userspace/tools/wr_mon.c
+1
-0
No files found.
doc/startup-guide/WMI-firmware.png
0 → 100644
View file @
745f8d33
68.1 KB
doc/startup-guide/WMI-login.png
0 → 100644
View file @
745f8d33
92.9 KB
doc/startup-guide/WMI-mngt.png
0 → 100644
View file @
745f8d33
80.3 KB
doc/startup-guide/WMI-wrppsi.png
0 → 100644
View file @
745f8d33
73.7 KB
doc/startup-guide/wrs-startup_guide.md
View file @
745f8d33
This diff is collapsed.
Click to expand it.
doc/startup-guide/wwwlogin.png
deleted
100644 → 0
View file @
584ec43d
101 KB
doc/startup-guide/wwwmanagement.png
deleted
100644 → 0
View file @
584ec43d
127 KB
userspace/rootfs_override/var/www/functions.php
View file @
745f8d33
...
...
@@ -104,14 +104,14 @@ function wrs_header_ports(){
echo
'<tr class="status">'
;
for
(
$i
=
1
;
$i
<
18
*
3
;
$i
=
$i
+
3
){
if
(
!
strstr
(
$ports
[(
$i
+
1
)],
"NoLock
"
)){
if
(
strstr
(
$ports
[(
$i
+
1
)],
"Locked
"
)){
$mode
=
"locked"
;
}
else
{
$mode
=
"unlocked"
;
}
echo
'<th>'
.
"<img class='syntonization "
.
$mode
.
"' SRC='img/"
.
$mode
.
".png' alt='syntonization: "
.
$mode
.
"', title = 'syntonization: "
.
$mode
.
"'>"
;
if
(
!
strstr
(
$ports
[(
$i
+
2
)],
"Unc
alibrated"
)){
if
(
strstr
(
$ports
[(
$i
+
2
)],
"C
alibrated"
)){
$mode
=
"calibrated"
;
$img
=
"check.png"
;
}
else
{
...
...
@@ -168,25 +168,33 @@ function wrs_main_info(){
$Monitor
=
check_monit_status
()
?
'[on] '
:
'[off] '
;
$WRSmode
=
check_switch_mode
();
if
(
!
strcmp
(
$WRSmode
,
"GM"
))
$WRSmode_xtra
=
""
;
if
(
!
strcmp
(
$WRSmode
,
"GM"
))
{
$WRSmode
=
"GrandMaster"
;
$ports
=
shell_exec
(
"cat /tmp/ports.conf"
);
if
(
empty
(
$ports
))
$WRSmode_xtra
=
"<br>Waiting PPS/10MHz ..."
;
}
else
if
(
!
strcmp
(
$WRSmode
,
"BC"
))
$WRSmode
=
"Boundary Clock"
;
else
if
(
!
strcmp
(
$WRSmode
,
"FM"
))
$WRSmode
=
"Free-Running Master"
;
else
$WRSmode
=
"GrandMaster"
;
$WRSmode
=
"Unknown"
;
#Obtain the temperatures using the last line of (wr-mon -w)
$temperatures
=
shell_exec
(
"cat /tmp/ports.conf 2>/dev/null | tail -1"
);
// Print services table
echo
'<br><table class="'
.
$class
.
'" id="'
.
$formatID
.
'" width="100%">'
;
echo
'<tr><th>'
.
$infoname
.
'</th></tr>'
;
echo
'<tr><td>PTP Mode</td><td> <a href="ptp.php">'
.
$WRSmode
.
'</td></tr>'
;
echo
'<tr><td>PTP Mode</td><td> <a href="ptp.php">'
.
$WRSmode
.
'</a>'
.
$WRSmode_xtra
.
'</td></tr>'
;
echo
'<tr><td>NTP Server</td><td> <a href="management.php">'
.
$NTP
.
'</td></tr>'
;
echo
'<tr><td>White-Rabbit Date</td><td>'
.
$wr_date
.
'</td></tr>'
;
echo
'<tr><td>PPSi</td><td>'
.
$PPSi
.
'</td></tr>'
;
echo
'<tr><td>System Monitor</td><td> <a href="management.php">'
.
$Monitor
.
'</td></tr>'
;
echo
'<tr><td>Net-SNMP Server</td><td>'
.
$SNMP
.
'( port '
.
$SNMP_port
.
")</td></tr>"
;
echo
'<tr><td>NTP Server</td><td> <a href="management.php">'
.
$NTP
.
'</td></tr>'
;
if
(
!
empty
(
$temperatures
))
echo
'<tr><td>Temperature (ºC)</td><td>'
.
$temperatures
.
'</td></tr>'
;
echo
'</table>'
;
}
...
...
@@ -677,7 +685,7 @@ function wrs_management(){
unlink
(
$uploadfile
);
//Reboot switch
sleep
(
1
);
wrs_reboot
(
);
wrs_reboot
(
90
);
//Updating only one part of the firmware take ~90s.
}
else
if
(
substr
(
$uploadfname
,
0
,
14
)
==
"wr-switch-sw-v"
&&
substr
(
$uploadfname
,
-
13
)
==
"_binaries.tar"
)
{
...
...
@@ -685,7 +693,7 @@ function wrs_management(){
unlink
(
$uploadfile
);
//Reboot switch
sleep
(
1
);
wrs_reboot
(
);
wrs_reboot
(
150
);
//120s should be enough but we prefer to keep safe
}
else
{
...
...
@@ -1250,9 +1258,9 @@ function echoSelectedClassIfRequestMatches($requestUri)
return
'class="selected"'
;
}
function
wrs_reboot
(){
function
wrs_reboot
(
$timeout
=
40
){
sleep
(
1
);
header
(
'Location: reboot.php
'
);
header
(
'Location: reboot.php
?timeout='
.
$timeout
);
}
/*
...
...
userspace/rootfs_override/var/www/js/scripts.js
View file @
745f8d33
...
...
@@ -55,6 +55,7 @@ function showPopup(url) {
* Reboots the switch
*
* @author José Luis Gutiérrez <jlgutierrez@ugr.es>
* @author Benoit Rat <benoit@sevensols.com>
*
* Reboots the switch using the rebooter.php file.
* This has been done to display the "rebooting" message after any
...
...
@@ -64,10 +65,19 @@ function showPopup(url) {
$
(
document
).
ready
(
function
()
{
setTimeout
(
function
()
{
var
path
=
window
.
location
.
pathname
;
var
page
=
path
.
split
(
"/"
).
pop
();
if
(
page
==
"reboot.php"
){
$
(
'#rebootingtext'
).
text
(
"Rebooting WRS. The web interface will refresh automatically after 50s."
);
var
pageid
=
$
(
'body'
).
attr
(
'id'
);
if
(
pageid
==
"reboot"
)
{
//Obtain timeout from the hidden input (#reboot_to) or set it by default to 40s
tout
=
$
(
'#reboot_to'
).
val
()
if
(
$
.
isNumeric
(
tout
)
==
false
||
tout
<
30
)
tout
=
40
//Improve how to print the timeout when more than 1 minute
if
(
tout
>
60
)
tout_str
=
Math
.
floor
(
tout
/
60
)
+
"m "
+
(
tout
%
60
)
+
"s."
else
tout_str
=
tout
+
"s."
//Update the HTML and call the rebooter.
$
(
'#rebootingtext'
).
text
(
"Rebooting WRS. The web interface will refresh automatically after "
+
tout_str
);
$
(
'#rebooting'
).
load
(
'rebooter.php'
);
}
},
1500
);
...
...
@@ -77,18 +87,24 @@ $(document).ready(
* Redirects users to index.php
*
* @author José Luis Gutiérrez <jlgutierrez@ugr.es>
* @author Benoit Rat <benoit@sevensols.com>
*
*
50
seconds after the execution of the reboot cmd, the web browser
*
tout
seconds after the execution of the reboot cmd, the web browser
* reloads automatically the web interface.
*
*/
$
(
document
).
ready
(
function
()
{
var
pageid
=
$
(
'body'
).
attr
(
'id'
);
if
(
pageid
==
"reboot"
)
{
//Obtain timeout from the hidden input (#reboot_to) or set it by default to 40s
tout
=
$
(
'#reboot_to'
).
val
()
if
(
$
.
isNumeric
(
tout
)
==
false
||
tout
<
30
)
tout
=
40
//Main timeout to refresh the webpage
setTimeout
(
function
()
{
var
path
=
window
.
location
.
pathname
;
var
page
=
path
.
split
(
"/"
).
pop
();
if
(
page
==
"reboot.php"
){
window
.
location
.
href
=
"index.php"
;
}
},
50000
);
window
.
location
.
href
=
"index.php"
;
},
tout
*
1000
);
}
});
userspace/rootfs_override/var/www/ptp.php
View file @
745f8d33
...
...
@@ -16,7 +16,7 @@
</div>
<div
class=
"rightpanel"
>
<div
class=
"rightbody"
>
<h1
class=
"title"
>
PPSi Configuration
<a
href=
'help.php?help_id=ptp'
onClick=
'showPopup(this.href);return(false);'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<h1
class=
"title"
>
WR-
PPSi Configuration
<a
href=
'help.php?help_id=ptp'
onClick=
'showPopup(this.href);return(false);'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<?php
session_is_started
()
?>
<?php
$_SESSION
[
'advance'
]
=
""
;
?>
...
...
userspace/rootfs_override/var/www/reboot.php
View file @
745f8d33
<?php
include
'functions.php'
;
include
'head.php'
;
?>
<body
id=
"
managemen
t"
>
<body
id=
"
reboo
t"
>
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
...
...
@@ -27,6 +27,7 @@
<div
id=
"rebootingtext"
align=
center
>
...Saving changes...
</div>
</div>
<form><input
hidden
id=
"reboot_to"
value=
"
<?php
echo
$_GET
[
'timeout'
]
?>
"
></form>
<div
id=
"rebooting"
></div>
<div
id=
"rebootwrlogo"
>
...
...
userspace/tools/wr_mon.c
View file @
745f8d33
...
...
@@ -516,6 +516,7 @@ int main(int argc, char *argv[])
case
'w'
:
/* for the web interface */
read_hal
();
show_unadorned_ports
();
show_temperatures
();
exit
(
0
);
case
'q'
:
break
;
/* done in wrs_msg_init() */
case
'v'
:
break
;
/* done in wrs_msg_init() */
...
...
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