From fd81b6a6b4b415b93746ad9f381d00fd0789aca4 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Wed, 29 Jan 2014 17:28:55 +0100 Subject: [PATCH] added putbitrange.pl command on webpage to access the loadbit function of trbcmd - not working yet because command missing in libtrbnet_perl. Removed Data::Dumper from some commands --- web/htdocs/commands/HPlot.pm | 2 +- web/htdocs/commands/get.pl | 2 +- web/htdocs/commands/getmultreg.pl | 2 +- web/htdocs/commands/getpadiwa.pl | 2 +- web/htdocs/commands/nettrace.pl | 2 +- web/htdocs/commands/put.pl | 1 - web/htdocs/commands/putbit.pl | 1 - web/htdocs/commands/putbitrange.pl | 33 ++++++++++++++++++++++++++++++ web/htdocs/commands/spiexec.pl | 6 +----- 9 files changed, 39 insertions(+), 12 deletions(-) create mode 100755 web/htdocs/commands/putbitrange.pl diff --git a/web/htdocs/commands/HPlot.pm b/web/htdocs/commands/HPlot.pm index 0b4798e..bc3a2ef 100644 --- a/web/htdocs/commands/HPlot.pm +++ b/web/htdocs/commands/HPlot.pm @@ -1,6 +1,6 @@ package HPlot; use POSIX qw/floor ceil strftime/; -use Data::Dumper; +# use Data::Dumper; use warnings; use strict; use FileHandle; diff --git a/web/htdocs/commands/get.pl b/web/htdocs/commands/get.pl index b01ebe0..79aa13f 100755 --- a/web/htdocs/commands/get.pl +++ b/web/htdocs/commands/get.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use HADES::TrbNet; -use Data::Dumper; +# use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/getmultreg.pl b/web/htdocs/commands/getmultreg.pl index eb66371..bbca995 100755 --- a/web/htdocs/commands/getmultreg.pl +++ b/web/htdocs/commands/getmultreg.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl use HADES::TrbNet; -use Data::Dumper; +# use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/getpadiwa.pl b/web/htdocs/commands/getpadiwa.pl index 675dbe0..6ebbcdc 100755 --- a/web/htdocs/commands/getpadiwa.pl +++ b/web/htdocs/commands/getpadiwa.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl use HADES::TrbNet; -use Data::Dumper; +# use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/nettrace.pl b/web/htdocs/commands/nettrace.pl index c508b37..9674615 100755 --- a/web/htdocs/commands/nettrace.pl +++ b/web/htdocs/commands/nettrace.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use Date::Format; use HADES::TrbNet; -use Data::Dumper; +# use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/put.pl b/web/htdocs/commands/put.pl index 091cd7c..9a9dfab 100755 --- a/web/htdocs/commands/put.pl +++ b/web/htdocs/commands/put.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl use HADES::TrbNet; -use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/putbit.pl b/web/htdocs/commands/putbit.pl index 2042275..1da3013 100755 --- a/web/htdocs/commands/putbit.pl +++ b/web/htdocs/commands/putbit.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl use HADES::TrbNet; -use Data::Dumper; if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; diff --git a/web/htdocs/commands/putbitrange.pl b/web/htdocs/commands/putbitrange.pl new file mode 100755 index 0000000..22ad557 --- /dev/null +++ b/web/htdocs/commands/putbitrange.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +use HADES::TrbNet; +if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { + print "HTTP/1.0 200 OK\n"; + print "Content-type: text/html\r\n\r\n"; + } +else { + use lib '..'; + use if (!($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i)), apacheEnv; + print "Content-type: text/html\n\n"; + } + + + if (!defined &trb_init_ports()) { + die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}"); + } + +my ($board,$addr,$mask,$value) = split('-',$ENV{'QUERY_STRING'}); + +if(!defined $board || !defined $addr || !defined $mask || !defined $value) {exit -1;} +$board = hex($board); +$addr = hex($addr); +$mask = hex($mask); +$value = hex($value); + +print "$board $addr $mask $value\n"; + + +trb_register_loadbit($board,$addr,$mask,$value); + + + +exit 1; diff --git a/web/htdocs/commands/spiexec.pl b/web/htdocs/commands/spiexec.pl index 02560ce..915fa4c 100755 --- a/web/htdocs/commands/spiexec.pl +++ b/web/htdocs/commands/spiexec.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl use HADES::TrbNet; -use Data::Dumper; + if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\r\n\r\n"; @@ -12,10 +12,6 @@ else { } - -use HADES::TrbNet; -use Data::Dumper; - if (!defined &trb_init_ports()) { die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}"); } -- 2.43.0