From 51aded3d2dd403be035d440972ca9434a36efc29 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 30 Dec 2014 14:56:45 +0000 Subject: [PATCH] fix usb eject with virtual-disk2 git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2092 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 4 ++-- webif/cgi-bin/usbinfo.jim | 10 ++++++++++ webif/html/js/usbeject.js | 8 ++++++-- webif/lib/fileops | 19 +++++++++++++++---- webif/lib/system.class | 22 ++++++++++++++++++---- 5 files changed, 51 insertions(+), 12 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 819cab2..0ede8c3 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.0.18-4 +Version: 1.0.18-5 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.14),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),mongoose +Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.14),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,mongoose Suggests: Description: An evolving web interface for the Humax. Tags: http://hummy.tv/forum/threads/5866/ diff --git a/webif/cgi-bin/usbinfo.jim b/webif/cgi-bin/usbinfo.jim index 07160fd..4253702 100755 --- a/webif/cgi-bin/usbinfo.jim +++ b/webif/cgi-bin/usbinfo.jim @@ -5,9 +5,19 @@ require system.class httpheader "application/json" +set fsg {File-Stor Gadget} + +set ignoredev {} +if {[file isdirectory /mnt/hd2]} { + file stat /mnt/hd2 st + lappend ignoredev $st(dev) +} + puts "\[" set flag 0 foreach usb [system usbmounts 1] { + file stat $usb(MP) st + if {$usb(MODEL) ne $fsg && $st(dev) in $ignoredev} continue if {$flag} { puts "," } else { set flag 1 } puts " {" diff --git a/webif/html/js/usbeject.js b/webif/html/js/usbeject.js index 02978bd..37a83d5 100644 --- a/webif/html/js/usbeject.js +++ b/webif/html/js/usbeject.js @@ -30,7 +30,11 @@ $('#usbeject').on('click', function(e) { var num = 0; $.each(data, function(k,v) { num++; - var size = (v.SIZE / 1000000000).toFixed(1); + var size = (v.SIZE / 1000000000); + if (size > 1000) + size = (size / 1000).toFixed(1) + "TB"; + else + size = size.toFixed(1) + "GB"; var type = v.TYPE; var drive = v.MP.split(/[/]/).pop().capitalise(); switch (type) @@ -48,7 +52,7 @@ $('#usbeject').on('click', function(e) { '' + v.LABEL + '' + '(' + drive + ' - ' + type + ' ' + ' - ' + - size + 'GB)' + + size + ')' + '