Commit e6b79e69 authored by Alessandro Rubini's avatar Alessandro Rubini

userspace/tools: remove wr_management

Even though the idea of using a single helper process for all
web queries is sound, this is not it. No more comments from me.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 81adcc8c
......@@ -867,7 +867,7 @@ The most important tools in @file{userspace/tools} are the following:
@item sdb-read
The tool, copied from the @t{fpga-config-space} project,
is documented in the next section,
@c FIXME: document lm32-vuart rtu_stat spll_dbg_proxy wr_management
@c FIXME: document lm32-vuart rtu_stat spll_dbg_proxy
@c FIXME: document wrs_pstats
@end table
......@@ -1629,17 +1629,13 @@ Clients are created in the following places:
The tty-based monitoring interface connects to @i{ptpd} (@i{ppsi})
to get run-time information.
@item userspace/tools/wr_management.c
To be removed as soon as possible, using wr_mon instead.
@item userspace/libwr/hal_client.c
The library allows connecting to the HAL socket to ask
for various actions (all librarized). The function
@t{halexp_client_try_connect()} is called directly by
@i{rtud} and through @t{halexp_client_init} by @i{rtu_stat},
@i{wr_phytool}, @i{wr_mon} and @i{wr_management}.
@i{wr_phytool}, @i{wr_mon}.
@item userspace/libwr/rt_client.c
......@@ -1659,9 +1655,7 @@ which appears both here and in @i{wrpc-sw}.
@section The Functions being Exported
This section lists all functions that are being exported to @sc{rpc} by
the processes (excluding the @sc{rt} subsystem). I also ignored any
use by @i{wr_management}, which is very rusty and probably broken by
design.
the processes (excluding the @sc{rt} subsystem).
@table @code
......
......@@ -328,12 +328,6 @@ Libraries} too.
@item There are too many @i{load} source files in @t{userspace/tools};
some are definitely not used any more. We need to clean up.
@item @t{wr_management} is an incomplete mess; mostly a copy of
@t{wr_mon}, slightly modify in its way toward being something else,
but nobody knows what it is now. We need to make it a serious thing
if it is used (by the web interface, it seems, called by
@t{functions.php}), or kill it outright.
@end itemize
@c ##########################################################################
......
......@@ -43,17 +43,10 @@ function wrs_header_ports(){
$interval = $currenttime - $_SESSION['portsupdated'];
if(!file_exists("/tmp/ports.conf") || $interval>15){
$cmd = wrs_env_sh();
shell_exec("killall wr_management");
$str = shell_exec($cmd." ports");
$fp = fopen('/tmp/ports.conf', 'w+');
fwrite($fp, $str);
fclose($fp);
$ports = $str;
$_SESSION['portsupdated'] = intval(shell_exec("date +%s"));
}else{
$ports = shell_exec("cat /tmp/ports.conf");
shell_exec("/wr/bin/wr_mon -w > /tmp/ports.conf");
$_SESSION['portsupdated'] = intval(shell_exec("date +%s"));
}
$ports = shell_exec("cat /tmp/ports.conf");
$ports = explode(" ", $ports);
// We parse and show the information comming from each endpoint.
......@@ -933,28 +926,6 @@ function wrs_ptp_configuration(){
}
/*
* Checks whether $WRS_MANAGEMENT exists with the wr_management program
*
* @author José Luis Gutiérrez <jlgutierrez@ugr.es>
*
* Checks whether $WRS_MANAGEMENT exists, if not, it points to the
* program by default (/wr/bin/wr_management)
*
*
*/
function wrs_env_sh(){
$output = shell_exec("echo $WRS_MANAGEMENT");
if(file_exists($output)){
$sh=$output;
}else{
$sh="/wr/bin/wr_management";
}
return $sh;
}
function wrs_vlan_configuration($input){
//Stop previous daemon and delete configuration file.
......
TOOLS = rtu_stat wr_mon wr_phytool spll_dbg_proxy load-lm32 load-virtex com
TOOLS += mapper wmapper
TOOLS += wrs_version wr_date wr_management lm32-vuart wrs_pstats
TOOLS += wrs_version wr_date lm32-vuart wrs_pstats
TOOLS += wrs_vlans wrs_dump_shmem
TOOLS += sdb-read
TOOLS += nbtee
......
/*
* wr_management.c
*
* Obtains the information that is displayed by the local management tool
*
* Created on: Nov 11, 2013
* Authors:
* - José Luis Gutiérrez (jgutierrez@ugr.es)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License...
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <minipc.h>
#include "term.h"
#define PTP_EXPORT_STRUCTURES
#include "ptpd_exports.h"
#include <libwr/hal_client.h>
hexp_port_list_t port_list;
static struct minipc_ch *ptp_ch;
void print_args(int argc, char *argv[])
{
printf("argc=%d: ",argc);
while(argc>0)
{
printf("%s, ",argv[0]);
argc--;
argv++;
}
printf("\n");
}
void init(int usecolor)
{
halexp_client_init();
ptp_ch = minipc_client_create("ptpd", 0);
if (!ptp_ch)
{
fprintf(stderr,"Can't establish WRIPC connection "
"to the PTP daemon!\n");
exit(-1);
}
term_init(usecolor);
halexp_query_ports(&port_list);
}
void show_ports()
{
int i, j;
time_t t;
struct tm *tm;
char datestr[32];
time(&t);
tm = localtime(&t);
strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tm);
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);
if(state.up)
term_cprintf(C_GREEN, "up ");
else
term_cprintf(C_RED, "down ");
switch(state.mode)
{
case HEXP_PORT_MODE_WR_MASTER:
term_cprintf(C_WHITE, "Master ");
break;
case HEXP_PORT_MODE_WR_SLAVE:
term_cprintf(C_WHITE, "Slave ");
break;
}
if(state.is_locked)
term_cprintf(C_GREEN, "Locked ");
else
term_cprintf(C_RED, "NoLock ");
if(state.rx_calibrated && state.tx_calibrated)
term_cprintf(C_GREEN, "Calibrated \n");
else
term_cprintf(C_RED, "Uncalibrated \n");
}
}
int track_onoff = 1;
void show_screen()
{
term_clear();
//term_pcprintf(1, 1, C_BLUE, "WR Switch Sync Monitor v 1.0 [q = quit]");
show_ports();
//show_servo();
fflush(stdout);
}
int main(int argc, char **argv)
{
int usecolor = 1;
if(argc > 1){
if(!strcmp(argv[1], "ports")){
usecolor = 0;
init(usecolor);
setvbuf(stdout, NULL, _IOFBF, 4096);
if(term_poll(500))
{
int rval;
track_onoff = 1-track_onoff;
minipc_call(ptp_ch, 200, &__rpcdef_cmd,
&rval, PTPDEXP_COMMAND_TRACKING,
track_onoff);
}
show_screen();
term_restore();
setlinebuf(stdout);
printf("\n");
}else if (!strcmp(argv[1], "fan")){
}else{
printf("\nParam required: ");
printf("\nProgram usage: %s [param]", argv[0]);
printf("\tports\t-->\tWRS ports state\n");
}
}else{
printf("\nParam required: ");
printf("\nProgram usage: %s [param]", argv[0]);
printf("\tports\t-->\tWRS ports state\n");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment