rootfs_enc1v2_hi3520d_20230731

This commit is contained in:
Jan Koppe 2024-02-15 22:07:42 +01:00
parent abf7fe89b0
commit 79baf85443
Signed by: thunfisch
GPG Key ID: BE935B0735A2129B
24 changed files with 481 additions and 51 deletions

BIN
kernel

Binary file not shown.

View File

@ -1,5 +1,11 @@
#!/bin/sh #!/bin/sh
/bin/umount /root/usb . /link/shell/util/func.sh
/bin/mount -t vfat -o codepage=936,utf8 /dev/sda1 /root/usb jopen /link/config/misc/disk.json
/bin/mount -t ext4 /dev/sda1 /root/usb enable=`jget enable`
/usr/bin/ntfs-3g /dev/sda1 /root/usb
if [ $enable == "true" ];then
used=`jget used`
if [ $used == "local" ];then
/link/shell/mount.sh
fi
fi

View File

@ -1,2 +1,11 @@
#!/bin/sh #!/bin/sh
umount -l /root/usb . /link/shell/util/func.sh
jopen /link/config/misc/disk.json
enable=`jget enable`
if [ $enable == "true" ];then
used=`jget used`
if [ $used == "local" ];then
umount -l -f /root/usb
fi
fi

Binary file not shown.

View File

@ -0,0 +1,16 @@
{
"enable": true,
"used": "local",
"shared": {
"ip": "",
"type": "cifs",
"path": "",
"auth": {
"uname": "",
"passwd": ""
}
},
"local": {
"device": "/dev/sda1"
}
}

View File

@ -1,4 +1,14 @@
[ [
{
"version": "2.4.0 build 20230731",
"logs": [
"修正挂载大容量存储设备时,磁盘空间显示不准确问题",
"修正ENC5V2机型恢复出厂设置小概率异常问题",
"SDI输入支持Level B标准",
"ENC1V3,ENC4SS,ENCSHV2机型新增遥控器支持",
"扩展功能下新增存储挂载设置支持nfs挂载windows共享目录挂载以及磁盘指定分区挂载"
]
},
{ {
"version": "2.3.0 build 20230630", "version": "2.3.0 build 20230630",
"logs": [ "logs": [

View File

@ -1,5 +1,5 @@
{ {
"app": "2.0.0 build 20220512_869", "app": "2.0.0 build 20220512_869",
"sdk": "2.0.0 build 20220518_20716", "sdk": "2.0.0 build 20220518_20716",
"sys": "2.3.0 build 20230630" "sys": "2.4.0 build 20230731"
} }

View File

@ -1,10 +1,17 @@
while [ true ] while [ true ]
do do
if [ -f "/root/usb/Tester" ]; then if [ -f "/root/usb/Tester" ]; then
chmod 777 /root/usb/Tester chmod 777 /root/usb/Tester
/root/usb/Tester /root/usb/Tester
else else
/link/bin/Encoder if [ -f "/link/bin/Monitor" ];then
pkill Monitor
fi
if [ -f "/root/usb/config.json" ];then
/link/bin/Encoder -c /root/usb/config.json
else
/link/bin/Encoder
fi
fi fi
sleep 2 sleep 2
done done

View File

@ -5,13 +5,14 @@
/link/shell/update.sh /link/shell/update.sh
ifconfig lo 127.0.0.1 ifconfig lo 127.0.0.1
/sbin/sysctl -p /etc/sysctl.conf /sbin/sysctl -p /etc/sysctl.conf
/link/shell/init/filesystem.sh
/link/shell/init/chip.sh /link/shell/init/chip.sh
if nfsBoot ;then if nfsBoot ;then
/link/shell/init/filesystem.sh
/link/shell/init/service.sh /link/shell/init/service.sh
else else
/link/shell/netManager.sh /link/shell/netManager.sh
/link/shell/init/filesystem.sh
/link/shell/init/service.sh /link/shell/init/service.sh
/link/shell/app.sh /link/shell/app.sh
fi fi

View File

@ -4,7 +4,6 @@ mkdir /tmp/log
if [ ! -d /root/usb ]; then if [ ! -d /root/usb ]; then
mkdir /root/usb mkdir /root/usb
fi fi
/link/shell/mountUsb.sh
if [ -b /dev/mmcblk0p5 ]; then if [ -b /dev/mmcblk0p5 ]; then
/bin/mount -o remount,rw,sync,barrier=0 /dev/mmcblk0p5 / /bin/mount -o remount,rw,sync,barrier=0 /dev/mmcblk0p5 /
@ -20,9 +19,6 @@ if [ -b /dev/mmcblk0p6 ]; then
echo -e "\ny" | mkfs.ext4 -T largefile /dev/mmcblk0p6 echo -e "\ny" | mkfs.ext4 -T largefile /dev/mmcblk0p6
fi fi
fi fi
umount -f /root/usb/ /link/shell/mount.sh
if [ ! -b /dev/sda1 ];then
/bin/mount -o rw,sync,barrier=0 /dev/mmcblk0p6 /root/usb
fi
fi fi

View File

@ -0,0 +1,61 @@
#!/bin/sh
. /link/shell/util/func.sh
jopen /link/config/misc/disk.json
enable=`jget enable`
umount_disk(){
mnt=`df -h | grep /root/usb | wc -l`
count=0
while [ $mnt -eq 1 -a $count -le 5 ]
do
umount -l -f /root/usb
mnt=`df -h | grep /root/usb | wc -l`
count=`expr $count + 1`
sleep 1
if [ $count -ge 5 ];then
exit
fi
done
}
had_mounted() {
if [ $enable == "true" ];then
mnt=`df -h | grep /root/usb | wc -l`
echo $mnt
return
fi
echo 0
}
umount_disk
if [ $enable == "true" ];then
used=`jget used`
if [ $used == "shared" ];then
ip=`jget shared.ip`
type=`jget shared.type`
uname=`jget shared.auth.uname`
passwd=`jget shared.auth.passwd`
path=`jget shared.path`
if [ $type == "cifs" ];then
target=//$ip$path
if [ -z $uname ];then
uname="x"
passwd="x"
fi
mount -t $type -o nolock,username=$uname,password=$passwd $target /root/usb
else
target=$ip:$path
mount -t $type -o nolock,tcp $target /root/usb
fi
fi
if [ $used == "local" ];then
device=`jget local.device`
mount -t vfat -o rw,relatime,codepage=936,utf8 $device /root/usb
mount -t ext4 $device /root/usb
/usr/bin/ntfs-3g $device /root/usb
fi
fi
had_mounted

View File

@ -1,13 +1,11 @@
#!/bin/sh #!/bin/sh
if [ -e "/dev/sda" ]; then . /link/shell/util/func.sh
umount /root/usb jopen /link/config/misc/disk.json
if [ -e "/dev/sda1" ]; then enable=`jget enable`
/bin/mount -t vfat -o rw,relatime,codepage=936,utf8 /dev/sda1 /root/usb
/bin/mount -t ext4 /dev/sda1 /root/usb if [ $enable == "true" ];then
/usr/bin/ntfs-3g /dev/sda1 /root/usb used=`jget used`
else if [ $used == "local" ];then
/bin/mount -t vfat -o rw,relatime,codepage=936,utf8 /dev/sda /root/usb /link/shell/mount.sh
/bin/mount -t ext4 /dev/sda /root/usb fi
/usr/bin/ntfs-3g /dev/sda /root/usb
fi
fi fi

263
rootfs/link/web/disk.php Normal file
View File

@ -0,0 +1,263 @@
<?php
include( "head.php" );
?>
<div id="alert"></div>
<div class="row disk" style="display: none">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="title">
<h3 class="panel-title">
<cn>磁盘挂载</cn>
<en>Mount Disk</en>
</h3>
</div>
<div class="panel-body">
<form class="form-horizontal" id="disk" role="form">
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label"><cn>启用挂载</cn><en>Enable</en></label>
<div class="col-md-6 col-sm-8">
<input type="checkbox" zcfg="enable" class="switch form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label"><cn>类型</cn><en>Type</en></label>
<div class="col-md-6 col-sm-8">
<select zcfg="used" class="form-control" id="mountDisk">
<option value="shared" cn="网络磁盘" en="net disk"></option>
<option value="local" cn="移动磁盘" en="usb disk"></option>
</select>
</div>
</div>
<div class="form-group" data-attr-used="usb">
<label class="col-md-3 col-sm-4 control-label"><cn>设备</cn><en>Device</en></label>
<div class="col-md-6 col-sm-8">
<select class="form-control" zcfg="local.device" id="diskDevices"></select>
</div>
</div>
<div class="form-group" data-attr-used="net">
<label class="col-md-3 col-sm-4 control-label"><cn>协议</cn><en>type</en></label>
<div class="col-md-6 col-sm-8">
<select zcfg="shared.type" class="form-control" id="mountType">
<option value="cifs" cn="cifs (windows共享目录)" en="cifs (windows shared directory)"></option>
<option value="nfs">nfs</option>
</select>
</div>
</div>
<div class="form-group" data-attr-used="net">
<label class="col-md-3 col-sm-4 control-label"><cn>IP地址</cn><en>IP Address</en></label>
<div class="col-md-6 col-sm-8">
<input type="text" class="form-control" zcfg="shared.ip">
</div>
</div>
<div class="form-group" data-attr-used="net" data-attr-type="cifs">
<label class="col-md-3 col-sm-4 control-label"><cn>用户名<small style="color: gray">(选填)</small></cn><en>Username</en></label>
<div class="col-md-6 col-sm-8">
<input type="text" class="form-control" zcfg="shared.auth.uname">
</div>
</div>
<div class="form-group" data-attr-used="net" data-attr-type="cifs">
<label class="col-md-3 col-sm-4 control-label"><cn>密码<small style="color: gray">(选填)</small></cn><en>Password</en></label>
<div class="col-md-6 col-sm-8">
<div class="input-group">
<input type="password" class="form-control" zcfg="shared.auth.passwd">
<span class="input-group-addon" id="eyeBtn" style="cursor: pointer"><i class="fa fa-eye-slash"></i></span>
</div>
</div>
</div>
<div class="form-group" data-attr-used="net">
<label class="col-md-3 col-sm-4 control-label"><cn>挂载路径</cn><en>Mount Path</en></label>
<div class="col-md-6 col-sm-8">
<input type="text" class="form-control" zcfg="shared.path">
</div>
</div>
<hr style="margin-top:10px; margin-bottom: 10px;"/>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label"><cn>挂载状态:</cn><en>Mount status:</en></label>
<div class="col-md-9 col-sm-8" style="padding: 0">
<label class="control-label" id="mountStatus" style="white-space:pre-wrap;color: gray">
<cn>未挂载</cn>
<en>not mounted</en>
</label>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label"><cn>存储空间:</cn><en>Disk space:</en></label>
<div class="col-md-9 col-sm-8" style="padding: 0">
<label class="control-label" id="diskSpace" style="color: gray">
<span>-- / --</span>
</label>
</div>
</div>
<hr style="margin-top:10px; margin-bottom: 10px;"/>
<div class="form-group">
<div class="text-center">
<button type="button" id="save" class="btn btn-warning" style="padding: 6px 20px">
<cn>保存</cn>
<en>Save</en>
</button>
<button type="button" id="unmount" class="btn btn-warning" style="padding: 6px 20px">
<cn>卸载</cn>
<en>Unmount</en>
</button>
</div>
</div>
<div class="form-group" style="padding-top: 30px;padding-left: 30px;color: gray">
<label class="col-md-11 col-sm-12">
<cn>提示: 卸载存储设备或更换挂载设备时,请确保没有处于录制状态</cn>
<en>Tip: Make sure that you are not recording when you unmount the storage device or change the mounted device</en>
</label>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="js/zcfg.js"></script>
<script src="vendor/switch/bootstrap-switch.js"></script>
<script type="text/javascript" src="js/confirm/jquery-confirm.min.js"></script>
<script>
$( function () {
navIndex( 4 );
$.fn.bootstrapSwitch.defaults.size = 'small';
$.fn.bootstrapSwitch.defaults.onColor = 'warning';
var config = {};
init();
function display(used,type) {
if(used == "shared") {
$("[data-attr-used=usb]").hide();
$("[data-attr-used=net]").show();
if(type == "cifs")
$("[data-attr-type=cifs]").show();
else
$("[data-attr-type=cifs]").hide();
} else {
$("[data-attr-used=usb]").show();
$("[data-attr-used=net]").hide();
}
}
function getMountedPath () {
func("getMountedPath",[],function (ret) {
var tag = "<cn>未挂载</cn><en>Not mounted</en>"
$("#diskSpace").html('<span>-- / --</span>');
if(ret.result != null) {
tag = "<cn>已挂载</cn><en>mounted</en> "+ret.result;
func("getDiskSpace",[],function (res) {
$("#diskSpace").html('<cn>已使用</cn><en>Used</en><span> '+res.used +' / '+ res.total+'</span>')
});
}
$("#mountStatus").html(tag);
$(".disk").show();
})
}
function init() {
func("getLocalDisk",[],function (data) {
console.log(data);
var lang = $.cookie("lang");
for(var i=0;i<data.result.length;i++){
var item = data.result[i];
if(item.name == "/dev/mmcblk0p6") {
if(lang == "cn")
$("#diskDevices").append('<option value="'+item.name+'">设备存储 ( '+item.size+' )</option>')
else
$("#diskDevices").append('<option value="'+item.name+'">device storage ( '+item.size+' )</option>')
} else {
$("#diskDevices").append('<option value="'+item.name+'">'+item.name+' ( '+item.size+' )</option>')
}
}
$.getJSON( "config/misc/disk.json", function ( res ) {
config = res;
display(config.used,config.shared.type);
zcfg( "#disk", config );
getMountedPath();
}).fail(function (error){
config = {
enable: false,
used: "shared",
shared: {
ip:"",
type: "cifs",
path: "",
auth : {
uname: "",
passwd: "",
}
},
local: {
device:""
}
}
display(config.used,config.shared.type);
zcfg( "#disk", config );
getMountedPath();
});
});
}
$("#mountDisk").change(function () {
display($(this).val(),config.shared.type);
});
$("#mountType").change(function () {
display(config.used,$(this).val());
});
$("#eyeBtn").click(function () {
if($(this).children().hasClass("fa-eye-slash")) {
$(this).prev().attr("type","text");
$(this).children().removeClass("fa-eye-slash").addClass("fa-eye");
} else {
$(this).prev().attr("type","password");
$(this).children().removeClass("fa-eye").addClass("fa-eye-slash");
}
});
$( "#unmount" ).click( function (){
$.confirm( {
title: '<h4 style="font-weight: 600"><cn>卸载磁盘</cn><en>Unmount Disk</en></h4>',
content: "<cn>是否卸载磁盘,请确保没有处于录制状态</cn><en>Whether to unmount the disk, please make sure it is not in the recording state</en>",
buttons: {
ok: {
text: "<cn>卸载</cn><en>Unmount</en>",
btnClass: 'btn-warning',
keys: [ 'enter' ],
action: function () {
func("umountDisk",[],function (res) {
if(res.error != ""){
htmlAlert("#alert", "danger", res.error, "", 3000);
return;
}
getMountedPath();
})
}
},
cancel: {
text: "<cn>取消</cn><en>Cancel</en>"
}
}
} );
});
$( "#save" ).click( function (){
func("saveConfigFile",{path: "config/misc/disk.json",data:JSON.stringify(config,null,2)},function (res) {
if(res.result == "OK") {
htmlAlert( "#alert", "success", "<cn>保存成功</cn><en>Saved successfully!</en>", "", 3000 );
func("mountDisk",[],function (data){
getMountedPath();
})
}
});
});
} );
</script>
<?php
include( "foot.php" );
?>

View File

@ -358,12 +358,12 @@ include( "head.php" );
}) })
} ); } );
rpc( "rec.getState", null, function ( data ) { func("getDiskSpace",[],function (data) {
if($.isEmptyObject(data)) if(data.total == 0)
$('#space').text("--/--"); $('#space').text("--/--");
else else
$('#space').text(data.used + " / " + data.total); $('#space').text(data.used + " / " + data.total);
} ); });
} ); } );
function formatDate(fmt,date) { function formatDate(fmt,date) {

View File

@ -396,26 +396,80 @@ function formatDisk() {
$result->result = "OK"; $result->result = "OK";
} }
function getMountedPath() {
global $result;
exec("df -h /root/usb | awk 'NR==2 {print $1}' | grep -v '/dev/root\|ubi0:ubifs'",$output);
$result->result = $output[0];
}
function getLocalDisk() {
global $result;
$output = shell_exec("ls /dev/sd*");
$arys = explode("\n",$output);
$hardware = json_decode(file_get_contents("/link/config/hardware.json"));
$chip = $hardware->chip;
if($chip == "SS524V100" || $chip == "SS528V100")
$arys[] = "/dev/mmcblk0p6";
$retList = array();
for($i=0;$i<count($arys);$i++) {
$item = $arys[$i];
if(empty($item) || substr_count($output, $item) > 1)
continue;
$size = shell_exec("blockdev --getsize64 ".$item);
$diskInfo = array(
"name" => $item,
"size" => formatBytes($size)
);
$retList[] = $diskInfo;
}
$result->result = $retList;
}
function mountDisk() { function mountDisk() {
global $result; global $result;
$output=array(); exec("/link/shell/mount.sh",$output);
exec( "ls /dev/sda",$output); $result->result = $output[0];
if(count($output) == 0) if($output[0] == "0")
{
$result->error = "<cn>没有检测到外部存储设备</cn><en>No external storage device is detected</en>";
return;
}
unset($output);
exec("mount -t vfat -o rw,relatime,codepage=936,utf8 /dev/sda1 /root/usb");
exec("mount -t ext4 /dev/sda1 /root/usb");
exec("ntfs-3g /dev/sda1 /root/usb");
exec("df -h | grep /root/usb",$output);
if(count($output) == 1)
$result->result = "OK";
else
$result->error = "<cn>外部存储设备挂载失败</cn><en>The external storage device failed to be mounted</en>"; $result->error = "<cn>外部存储设备挂载失败</cn><en>The external storage device failed to be mounted</en>";
} }
function formatBytes($total) {
$config = [
'4' => 'TB',
'3' => 'GB',
'2' => 'MB',
'1' => 'KB'
];
foreach ($config as $key => $value) {
if ($total >= pow(1024, $key)) {
return number_format($total / pow(1024, $key), 2) . $value;
}
}
return '0KB';
}
function getDiskSpace() {
global $result;
$mountDir = '/root/usb';
$output = shell_exec('df ' . $mountDir);
if(strpos($output, $mountDir) != false) {
$totalSpace = disk_total_space($mountDir);
$freeSpace = disk_free_space($mountDir);
$usedSpace = $totalSpace - $freeSpace;
$result->total = formatBytes($totalSpace);
$result->free = formatBytes($freeSpace);
$result->used = formatBytes($usedSpace);
} else {
$result->total = 0;
$result->free = 0;
$result->used = 0;
}
}
function setTimeZone() { function setTimeZone() {
global $result; global $result;
$area = $_POST["timeArea"]; $area = $_POST["timeArea"];

View File

@ -120,6 +120,12 @@ include("headhead.php");
<?php <?php
} }
?> ?>
<li>
<a href="disk.php"><i class="fa fa-database"></i>
<cn>存储挂载</cn>
<en>Mount Disk</en>
</a>
</li>
</ul> </ul>
</li> </li>
<li role="presentation" class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true"> <i class="fa fa-gears menuIcon"></i> <li role="presentation" class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true"> <i class="fa fa-gears menuIcon"></i>

View File

@ -82,7 +82,7 @@ include( "head.php" );
<span id="fileName"></span> <span id="fileName"></span>
<!-- <strong id="time">[--:--]</strong>--> <!-- <strong id="time">[--:--]</strong>-->
</div> </div>
<div class="col-sm-6 text-center"> <div class="col-sm-5 text-right" style="padding: 0">
<button type="button" id="startRecord" class="btn btn-warning"> <button type="button" id="startRecord" class="btn btn-warning">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>
<cn>录制</cn> <cn>录制</cn>
@ -94,7 +94,7 @@ include( "head.php" );
<en>Stop All</en> <en>Stop All</en>
</button> </button>
</div> </div>
<div class="col-sm-4 text-left" style="line-height: 34px;"> <div class="col-sm-5 text-right" style="line-height: 34px;padding: 0 10px">
<cn>已用空间</cn> <cn>已用空间</cn>
<en>Used Space</en>: <en>Used Space</en>:
<span id="space">-</span> <span id="space">-</span>
@ -735,12 +735,15 @@ include( "head.php" );
} }
function getState() { function getState() {
rpc( "rec.getState", null, function ( data ) { func("getDiskSpace",[],function (data) {
if($.isEmptyObject(data)) if(data.total == 0)
{
$('#space').text("--/--"); $('#space').text("--/--");
else $('#space').css("margin-right","10px");
} else {
$('#space').text(data.used + " / " + data.total); $('#space').text(data.used + " / " + data.total);
} ); }
});
} }
function initView() { function initView() {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.