From dc3c0fab6c39714897eecb3e55c84a207442cede Mon Sep 17 00:00:00 2001 From: prpr Date: Fri, 25 Mar 2022 22:45:23 +0000 Subject: [PATCH 01/11] Add Power cycle reason --- webif/lib/lib.sh | 1 + webif/lib/system.class | 1 + 2 files changed, 2 insertions(+) diff --git a/webif/lib/lib.sh b/webif/lib/lib.sh index 90431f57..8493d25e 100644 --- a/webif/lib/lib.sh +++ b/webif/lib/lib.sh @@ -7,6 +7,7 @@ lbr_descr() 1) echo "Front panel button" ;; 2) echo "Remote control handset" ;; 3) echo "Scheduled event" ;; + 4) echo "Power cycle" ;; *) echo "Unknown `cat /tmp/.lbr`" ;; esac else diff --git a/webif/lib/system.class b/webif/lib/system.class index e0ffb9aa..f8bddf9f 100644 --- a/webif/lib/system.class +++ b/webif/lib/system.class @@ -72,6 +72,7 @@ proc {system lastbootreason} {{descr 1}} {{lbr -1}} { 1 { return "Front panel button" } 2 { return "Remote control handset" } 3 { return "Scheduled event" } + 4 { return "Power cycle" } } return "Unknown ($lbr)" } From 1e53bc1b37dfa73a68cb15fc5febc2745231bc99 Mon Sep 17 00:00:00 2001 From: prpr Date: Fri, 15 Apr 2022 14:57:22 +0100 Subject: [PATCH 02/11] Update version and dependencies --- CONTROL/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 4413adab..36db27f1 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.4.9-8 +Version: 1.4.9-9 Architecture: mipsel Maintainer: af123@hpkg.tv -Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-2),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.10-1),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget +Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.78),jim-sqlite3(>=0.78),jim-cgi(>=0.7-2),jim-binary(>=0.78),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget Suggests: Description: An evolving web interface for the Humax. Tags: https://hummy.tv/forum/threads/7712/ From 9b8e6763af23df744cf22338bad79ec15d43199d Mon Sep 17 00:00:00 2001 From: prpr Date: Wed, 20 Apr 2022 12:17:06 +0100 Subject: [PATCH 03/11] Handle SMART error counters more intelligently --- webif/html/diag/diskack.jim | 4 +--- webif/include/diskcheck.jim | 31 ++++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/webif/html/diag/diskack.jim b/webif/html/diag/diskack.jim index 331574bc..a9dafd79 100755 --- a/webif/html/diag/diskack.jim +++ b/webif/html/diag/diskack.jim @@ -7,10 +7,8 @@ httpheader set settings [settings] -foreach attr {realloc pending offline} { +foreach attr {realloc pending offline spinretry} { set val [$settings _nval_setting "SMART_$attr"] if {$val < 0} continue $settings _nval_setting "SMART_ack_$attr" $val } - - diff --git a/webif/include/diskcheck.jim b/webif/include/diskcheck.jim index e79660af..d872915c 100755 --- a/webif/include/diskcheck.jim +++ b/webif/include/diskcheck.jim @@ -4,6 +4,19 @@ source /mod/webif/lib/setup require system.class require settings.class +proc {system disksmarterror} {sa count ack_count} { + if {$sa eq "spinretry"} { + set msg "Disk $sa count is: $count" + } else { + set msg "Disk $sa sector count is: $count" + } + if {$ack_count > 0} { + append msg " (was $ack_count)" + } + append msg "\n" + return $msg +} + proc {system disksmart} {} { set smartmsg "" @@ -26,19 +39,23 @@ proc {system disksmart} {} { # (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7) - if {$smartattribs(SMART_status) ne "PASSED"} { + if {$smartattribs(SMART_status) ne "PASSED" && + $smartattribs(SMART_status) ne "Unknown"} { append smartmsg \ "Disk overall health assessment is: $smartattribs(SMART_status)\n" } foreach sa $smartattrs { - if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} { - append smartmsg \ - "Disk $sa sector count is: $smartattribs(SMART_$sa)" - if {$smartattribs(SMART_ack_$sa) > 0} { - append smartmsg " (was $smartattribs(SMART_ack_$sa))" + set count $smartattribs(SMART_$sa) + set ack_count $smartattribs(SMART_ack_$sa) + if {$count > $ack_count} { + append smartmsg [system disksmarterror $sa $count $ack_count] + } elseif {$count < $ack_count} { + if {($sa eq "pending" || $sa eq "offline") && ($count > 0)} { + append smartmsg [system disksmarterror $sa $count $ack_count] + } else { + [settings] _nval_setting "SMART_ack_$sa" $count } - append smartmsg "\n" } } return $smartmsg From 5cb9bdd6dd3c2eb10088e1ed59ca2a1385be281a Mon Sep 17 00:00:00 2001 From: prpr Date: Thu, 21 Apr 2022 17:58:44 +0100 Subject: [PATCH 04/11] Remove redundant calls --- webif/html/browse/enc.jim | 1 - webif/html/browse/lock.jim | 1 - webif/html/browse/new.jim | 1 - 3 files changed, 3 deletions(-) diff --git a/webif/html/browse/enc.jim b/webif/html/browse/enc.jim index 8869aa5f..11877f60 100755 --- a/webif/html/browse/enc.jim +++ b/webif/html/browse/enc.jim @@ -7,7 +7,6 @@ require ts.class httpheader set file [cgi_get file] -set ts [ts fetch $file] if {[set ts [ts fetch $file]] != 0} { set action enc if {[$ts flag "Encrypted"]} { set action unenc } diff --git a/webif/html/browse/lock.jim b/webif/html/browse/lock.jim index 021de4bc..37da1f64 100755 --- a/webif/html/browse/lock.jim +++ b/webif/html/browse/lock.jim @@ -7,7 +7,6 @@ require ts.class httpheader set file [cgi_get file ""] -set ts [ts fetch $file] if {[set ts [ts fetch $file]] != 0} { set action lock if {[$ts flag "Locked"]} { set action unlock } diff --git a/webif/html/browse/new.jim b/webif/html/browse/new.jim index ec0fbf0b..047f5d20 100755 --- a/webif/html/browse/new.jim +++ b/webif/html/browse/new.jim @@ -7,7 +7,6 @@ require ts.class httpheader set file [cgi_get file] -set ts [ts fetch $file] if {[set ts [ts fetch $file]] != 0} { set action new if {[$ts flag "New"]} { set action watched } From bdfae1979666e43f8d4b21dcc46f65163fcf5772 Mon Sep 17 00:00:00 2001 From: prpr Date: Thu, 21 Apr 2022 18:00:04 +0100 Subject: [PATCH 05/11] Add error check --- webif/html/browse/epgtitle.jim | 1 + 1 file changed, 1 insertion(+) diff --git a/webif/html/browse/epgtitle.jim b/webif/html/browse/epgtitle.jim index 7cdfbcdd..fb99306b 100755 --- a/webif/html/browse/epgtitle.jim +++ b/webif/html/browse/epgtitle.jim @@ -9,6 +9,7 @@ httpheader "application/json" set file [cgi_get file] if {$file == 0} exit set ts [ts fetch $file] +if {$ts == 0} exit puts "{" puts "\"title\" : \"[jescape [$ts get title]]\"," From b44f5c3678775012c4f6a85064c447b05ad67c4b Mon Sep 17 00:00:00 2001 From: prpr Date: Thu, 21 Apr 2022 18:00:39 +0100 Subject: [PATCH 06/11] Fix clipboard paste for .ts files without sidecars --- webif/html/browse/clipboard.jim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webif/html/browse/clipboard.jim b/webif/html/browse/clipboard.jim index ed2a1eae..c89317de 100755 --- a/webif/html/browse/clipboard.jim +++ b/webif/html/browse/clipboard.jim @@ -82,6 +82,7 @@ switch $action { set path [$item get path] set file [file tail $path] set mode [$item get action] + set fileonly 0 puts "Pasting $file" @@ -105,8 +106,13 @@ switch $action { "$dir/[file tail $f]"} } } + } else { + set fileonly 1 } } else { + set fileonly 1 + } + if {$fileonly} { if {$mode eq "cut"} { catch {file rename $path \ "$dir/[file tail $path]"} From 12ecc32e44a477b03ab53c113c948549fef601ea Mon Sep 17 00:00:00 2001 From: prpr Date: Thu, 21 Apr 2022 18:59:25 +0100 Subject: [PATCH 07/11] Update version and dependencies --- CONTROL/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 36db27f1..1bfd81e2 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.4.9-9 +Version: 1.5.0 Architecture: mipsel Maintainer: af123@hpkg.tv -Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.78),jim-sqlite3(>=0.78),jim-cgi(>=0.7-2),jim-binary(>=0.78),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget +Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.81),jim-pack(>=0.81),jim-oo(>=0.81),jim-sqlite3(>=0.81),jim-cgi(>=0.7-2),jim-binary(>=0.78),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget Suggests: Description: An evolving web interface for the Humax. -Tags: https://hummy.tv/forum/threads/7712/ +Tags: https://hummy.tv/forum/threads/10581/ From a34a951a33c6a0b2c1156e9761aad2933f5fad98 Mon Sep 17 00:00:00 2001 From: prpr Date: Sun, 24 Apr 2022 17:33:49 +0100 Subject: [PATCH 08/11] Handle errors from Smartctl --- webif/html/diag/disk.jim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/webif/html/diag/disk.jim b/webif/html/diag/disk.jim index f6f0dc0e..4dc06589 100755 --- a/webif/html/diag/disk.jim +++ b/webif/html/diag/disk.jim @@ -30,7 +30,10 @@ puts " " -foreach line [split [exec /bin/smartctl -i $device] "\n"] { +if {[catch {set msg [exec /bin/smartctl -i $device]} xmsg]} { + set msg $xmsg +} +foreach line [split $msg "\n"] { if {[string match "*Not in smartctl database*" $line]} continue if {[string match "*: *" $line]} { regsub -all -- {[[:space:]]+} $line " " line @@ -95,8 +98,11 @@ set nolife {184 187 188 189 191 197 198} set derive {4 "" 5 sectors 9 hours 12 cycles 192 "" 193 "cycles"} +if {[catch {set msg [exec /bin/smartctl -A $device]}]} { + set msg "" +} set i 0 -foreach line [split [exec /bin/smartctl -A $device] "\n"] { +foreach line [split $msg "\n"] { regsub -all -- {[[:space:]]+} $line " " line regsub -all -- {^[[:space:]]+} $line "" line if {[incr i] < 8} continue @@ -185,8 +191,8 @@ puts { } -if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} { - set msg $xmsg +if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} { + set msg "" } set i 0 From 97b24da0edcab185529db93e830543789dc92ff8 Mon Sep 17 00:00:00 2001 From: prpr Date: Sun, 24 Apr 2022 17:36:35 +0100 Subject: [PATCH 09/11] Allow HD to collect disk stats. --- webif/lib/bin/diskattrs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webif/lib/bin/diskattrs b/webif/lib/bin/diskattrs index d03b8b1b..bb912e90 100755 --- a/webif/lib/bin/diskattrs +++ b/webif/lib/bin/diskattrs @@ -3,8 +3,6 @@ source /mod/webif/lib/setup require system.class settings.class -if {[system model] eq "HD"} exit - set disk [system disk] set settings [settings] @@ -20,7 +18,10 @@ if {$line ne ""} { } # Extract disk model. -foreach line [split [exec /bin/smartctl -i $disk] "\n"] { +if {[catch {set msg [exec /bin/smartctl -i $disk]}]} { + set msg "" +} +foreach line [split $msg "\n"] { if {[string match "*Not in smartctl database*" $line]} continue if {[string match "*: *" $line]} { regsub -all -- {[[:space:]]+} $line " " line @@ -31,7 +32,11 @@ foreach line [split [exec /bin/smartctl -i $disk] "\n"] { } # Extract disk attributes. -foreach line [split [exec /bin/smartctl -A -f brief $disk] "\n"] { +if {[catch {set msg [exec /bin/smartctl -A -f brief $disk]}]} { + set msg "" +} +set attrs {} +foreach line [split $msg "\n"] { regsub -all -- {[[:space:]]+} $line " " line regsub -all -- {^[[:space:]]+} $line "" line lassign [split $line] id name flags val worst thresh when rval From b6c0ff80b608076e0e61094bf20f5b89f57c8501 Mon Sep 17 00:00:00 2001 From: prpr Date: Sun, 24 Apr 2022 17:37:13 +0100 Subject: [PATCH 10/11] Don't error on null SMART status --- webif/include/diskcheck.jim | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/webif/include/diskcheck.jim b/webif/include/diskcheck.jim index d872915c..fb6c3f23 100755 --- a/webif/include/diskcheck.jim +++ b/webif/include/diskcheck.jim @@ -19,15 +19,15 @@ proc {system disksmarterror} {sa count ack_count} { proc {system disksmart} {} { set smartmsg "" - + set smartattrs {realloc pending offline spinretry} - + set smartattribs(SMART_status) "Unknown" foreach sa $smartattrs { set smartattribs(SMART_$sa) 0 set smartattribs(SMART_ack_$sa) 0 } - + foreach line [[settings] smartdata] { lassign $line x name x n x t if {$name eq "SMART_status"} { @@ -36,15 +36,16 @@ proc {system disksmart} {} { set smartattribs($name) $n } } - + # (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7) - + if {$smartattribs(SMART_status) ne "PASSED" && - $smartattribs(SMART_status) ne "Unknown"} { + $smartattribs(SMART_status) ne "Unknown" && + $smartattribs(SMART_status) ne ""} { append smartmsg \ "Disk overall health assessment is: $smartattribs(SMART_status)\n" } - + foreach sa $smartattrs { set count $smartattribs(SMART_$sa) set ack_count $smartattribs(SMART_ack_$sa) From 5e941b889c860a39f1ddeddbd9e2cfbd870a9051 Mon Sep 17 00:00:00 2001 From: prpr Date: Sun, 24 Apr 2022 17:39:03 +0100 Subject: [PATCH 11/11] Update to 1.5.0-1 --- CONTROL/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTROL/control b/CONTROL/control index 1bfd81e2..334713b9 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.5.0 +Version: 1.5.0-1 Architecture: mipsel Maintainer: af123@hpkg.tv Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.81),jim-pack(>=0.81),jim-oo(>=0.81),jim-sqlite3(>=0.81),jim-cgi(>=0.7-2),jim-binary(>=0.78),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
SMART Status$smart