From c208e186c3f0eb6c08fa2927da9a84a6676cabea Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 5 Nov 2012 22:36:04 +0000 Subject: [PATCH] rma mode and stream size monitor git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1202 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/cgi-bin/browse.jim | 1 + var/mongoose/cgi-bin/browse/browse.js | 19 ++++++++++++++ var/mongoose/cgi-bin/cfwreset.cgi | 8 +++++- var/mongoose/cgi-bin/streamsize.jim | 12 +++++++++ var/mongoose/html/diag/diag.jim | 36 ++++++++++++++++++++++++--- var/mongoose/html/diag/script.js | 14 +++++++++++ 6 files changed, 86 insertions(+), 4 deletions(-) create mode 100755 var/mongoose/cgi-bin/streamsize.jim diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index aa2650de..456c4500 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -359,6 +359,7 @@ if {[file exists /mnt/hd3/Streamer_down_file]} { puts { } } diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 9c2d53e3..0882dda5 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -822,5 +822,24 @@ var dmenuclick = function(action, el, pos) }); + var streamsize = 0; + + function checkstream() + { + $.get('/cgi-bin/streamsize.jim', function(size) { + console.log('Stream size: %o', size); + var mb = size / (1024 * 1024); + mb = mb|0; + if (streamsize && size > streamsize) + $('#streamstatus').text(mb + ' MiB (growing)'); + else + $('#streamstatus').text(mb + ' MiB'); + streamsize = size; + }); + } + + if ($('#streamstatus').length) + setInterval(checkstream, 3000); + }); diff --git a/var/mongoose/cgi-bin/cfwreset.cgi b/var/mongoose/cgi-bin/cfwreset.cgi index 9ebfce47..236693d2 100755 --- a/var/mongoose/cgi-bin/cfwreset.cgi +++ b/var/mongoose/cgi-bin/cfwreset.cgi @@ -1,7 +1,13 @@ #!/bin/sh +[ -n "$QUERY_STRING" ] && rma="${QUERY_STRING##*=}" || rma=0 + echo "Content-Type: text/plain" echo -touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT +if [ "$rma" = 1 ]; then + touch /var/lib/humaxtv/.rma +else + touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT +fi diff --git a/var/mongoose/cgi-bin/streamsize.jim b/var/mongoose/cgi-bin/streamsize.jim new file mode 100755 index 00000000..7133627d --- /dev/null +++ b/var/mongoose/cgi-bin/streamsize.jim @@ -0,0 +1,12 @@ +#!/mod/bin/jimsh + +set stream "/mnt/hd3/Streamer_down_file" + +puts "Content-type: text/plain\n" + +if {[file exists $stream]} { + puts -nonewline [file size $stream] +} else { + puts -nonewline 0 +} + diff --git a/var/mongoose/html/diag/diag.jim b/var/mongoose/html/diag/diag.jim index 23643378..5363bde8 100755 --- a/var/mongoose/html/diag/diag.jim +++ b/var/mongoose/html/diag/diag.jim @@ -2,11 +2,13 @@ package require cgi source /mod/webif/lib/setup -require pretty_size +require pretty_size system.class puts "Content-Type: text/html" puts "" +set smv [system modversion 1] + header puts { @@ -78,7 +80,7 @@ puts { +} + +if {$smv < 213} { + puts { +
+(Install custom firmware v2.13 to enable this option) +
+ } +} + +puts { + + + + View: diff --git a/var/mongoose/html/diag/script.js b/var/mongoose/html/diag/script.js index f4b2b3ba..349ed0a0 100644 --- a/var/mongoose/html/diag/script.js +++ b/var/mongoose/html/diag/script.js @@ -83,6 +83,20 @@ $('#runreset').click(function(e) { }); }); +$('#runrma').click(function(e) { + e.preventDefault(); + if (!confirm('Are you sure? This will completely remove all packages and settings and return the unit to state where you can re-install official firmware ready to return a faulty box to Humax for repair.')) + return; + if (!confirm('Are you really sure?')) + return; + if (!confirm('One last time, are you sure?')) + return; + $.get('/cgi-bin/cfwreset.cgi?rma=1', function() { + $('button').disable(); + $('#resetdone').slideDown(); + }); +}); + });