From afd79708eab191b18fa93171c02a632661768c32 Mon Sep 17 00:00:00 2001 From: horse69 Date: Fri, 11 May 2012 21:37:56 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/freetel/code@419 01035d8c-6547-0410-b346-abe4f91aad63 --- mini-asterisk-gui2/cgi-bin/ipkg.cgi | 28 +++++++++++++++ mini-asterisk-gui2/cgi-bin/uptime.cgi | 25 +++++++++++++ mini-asterisk-gui2/system.js | 52 ++++++++++++++++++++++----- 3 files changed, 96 insertions(+), 9 deletions(-) create mode 100755 mini-asterisk-gui2/cgi-bin/ipkg.cgi create mode 100755 mini-asterisk-gui2/cgi-bin/uptime.cgi diff --git a/mini-asterisk-gui2/cgi-bin/ipkg.cgi b/mini-asterisk-gui2/cgi-bin/ipkg.cgi new file mode 100755 index 00000000..4a147272 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/ipkg.cgi @@ -0,0 +1,28 @@ +#!/bin/sh +# ipkg.cgi +# Ian Roberts +# May 12 2012 +# CGI to execute ipkg +# script expects only one argument +# valid arguments are list_installed, list etc + +cat < + + + + + +EOF + +arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"` +#Todo : Test for one argument +#Todo : Test for valid argument +ipkg $arg + +cat < + +EOF diff --git a/mini-asterisk-gui2/cgi-bin/uptime.cgi b/mini-asterisk-gui2/cgi-bin/uptime.cgi new file mode 100755 index 00000000..2073e2d2 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/uptime.cgi @@ -0,0 +1,25 @@ +#!/bin/sh +# uptime.cgi +# Ian Roberts +# May 12 2012 +# CGI to execute uptime +# no arguments + +cat < + + + + + +EOF + +#arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"` +uptime + +cat < + +EOF diff --git a/mini-asterisk-gui2/system.js b/mini-asterisk-gui2/system.js index fb128420..db29ef40 100644 --- a/mini-asterisk-gui2/system.js +++ b/mini-asterisk-gui2/system.js @@ -46,12 +46,16 @@ function initialisePage() { html += ''; html += 'cat /proc/meminfo'; + html += ''; html += 'cat /proc/yaffs'; + html += ''; html += 'uptime'; + html += ''; html += 'ipkg list_installed'; + html += ''; html += ' '; @@ -82,14 +86,17 @@ function loadLoadavg(doc, status) { } function loadCPUinfo(doc, status) { - cpuinfo = ""; - -// cpuinfo = doc.substr(0, doc.length); - if (doc.indexOf("processor") != -1) { - ip = doc.substr(doc.indexOf("processor"), doc.length); -// ip = ip.substr(10, ip.length); - ip = ip.substr(0, ip.indexOf("power manage")); - } + ip = ""; + + ip = doc.substr(0, doc.length); + if (doc.indexOf("CPU") != -1) { + + // Blackfin hardware is ADSP-BF533 + ip = doc.substr(doc.indexOf("CPU"), doc.length); +// ip = ip.substr(10, ip.length); +// ip = ip.substr(0, ip.indexOf("power manage")); + } + document.getElementById('cpuinfo').innerHTML = ip; downloadUrl("/cgi-bin/catproc.cgi?arg=mtd", loadmtd); @@ -99,8 +106,35 @@ function loadmtd(doc, status) { document.getElementById('mtd').innerHTML = doc.substr(0, doc.length); -// downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo); + downloadUrl("/cgi-bin/catproc.cgi?arg=meminfo", loadmeminfo); +} + +function loadmeminfo(doc, status) { + + document.getElementById('meminfo').innerHTML = doc.substr(0, doc.length); + + downloadUrl("/cgi-bin/catproc.cgi?arg=yaffs", loadyaffs); +} + +function loadyaffs(doc, status) { + + document.getElementById('yaffs').innerHTML = doc.substr(0, doc.length); + + downloadUrl("/cgi-bin/uptime.cgi?arg=nothing", loaduptime); +} + +function loaduptime(doc, status) { + + document.getElementById('uptime').innerHTML = doc.substr(0, doc.length); + + downloadUrl("/cgi-bin/ipkg.cgi?arg=list_installed", loadinstalled); } +function loadinstalled(doc, status) { + + document.getElementById('installed').innerHTML = doc.substr(0, doc.length); + +// downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo); +} -- 2.25.1