From da17e3709a5771b88f54f99a0764c53c19b5dc34 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Fri, 31 Mar 2023 23:16:47 -0600 Subject: [PATCH] add a few more files --- bin/sensordetect.sh | 156 ++++++++++++++++++++++++++++++++++++++++++++ bin/sensorenv.sh | 29 ++++++++ bin/zzz | 4 ++ 3 files changed, 189 insertions(+) create mode 100755 bin/sensordetect.sh create mode 100755 bin/sensorenv.sh create mode 100755 bin/zzz diff --git a/bin/sensordetect.sh b/bin/sensordetect.sh new file mode 100755 index 0000000..7c66547 --- /dev/null +++ b/bin/sensordetect.sh @@ -0,0 +1,156 @@ +#!/bin/sh +#ssp目前仅能处理sony, 其他的还要改 + +. /etc/sysenv.conf + + +if [ ! -e ${SENSOR_CONF} ] +then + if [ ! -e ${SENSOR_CONF_DEFAULT} ] + then + echo "Not Exist sensorconf, set as AUTO" + echo "sensortype=AUTO" > ${SENSOR_CONF} + else + echo "Use default sensor conf" + cp -f ${SENSOR_CONF_DEFAULT} ${SENSOR_CONF} + fi + fsync ${SENSOR_CONF} + sleep 1 +else + . ${SENSOR_CONF} + if [ $sensortype = "AUTO" ] && [ -e ${SENSOR_CONF_DEFAULT} ] + then + cp -f ${SENSOR_CONF_DEFAULT} ${SENSOR_CONF} + fsync ${SENSOR_CONF} + echo "Use default sensor conf" + sleep 1 + fi +fi + +. ${SENSOR_CONF} + +if [ $sensordetect"AA" = "N""AA" ] +then + echo "Not Detect AUTO, CurrSensor: $sensordetect" + exit +fi + + +sensor_curr_conf=$sensortype +sensor_detect=`/bin/sensord` + +### 如果链接失效. 新建一个指向ov9712的链接, 是的vs_server 可以跑起来. 然后强制进行检测 +if [ ! -r ${SENSOR_SO} ] +then + rm ${SENSOR_SO} -fr + ln -s /usr/lib/libsns_ov9712.so ${SENSOR_SO} + sensor_curr_conf=AUTO +fi + + +if [ $1"A" = "force""A" ] +then + echo "force redetect" + sensor_curr_conf=AUTO +fi + +echo "Sensor Detect $sensor_detect AA" + + +echo sensor_cfg 111 + + +if [ $sensor_detect = "$sensor_curr_conf" ] || [ $sensor_detect = "unknown" ] +then + echo "Sensor is $sensor_detect, do nothing" + exit +fi +echo sensor_cfg 222a + +echo "echo sensor_curr_conf $sensor_curr_conf, sensor_detect is $sensor_detect" +if [ "$sensor_curr_conf" = "AUTO" -o $sensor_curr_conf"A" = "A" -o $sensor_detect != $sensor_curr_conf ] +then + if [ $sensor_detect = "gc1034" ] + then + sensor_detect_ar0130_conf="720P" + if [ -f /etc/ipcamera/config_capability.ini ] + then + . /etc/ipcamera/config_capability.ini + if [ ! -z "$sensor_detect_ar0130" ] + then + sensor_detect_ar0130_conf=$sensor_detect_ar0130 + fi + fi + + if [ $sensor_detect_ar0130_conf == "960P" ] && [ $sensor_detect == "ar0130" ] + then + echo "AR0130 Default Model 960P" + sensor_detect=ar0130_960p + echo "sensortype=$sensor_detect" > ${SENSOR_CONF} + if [ $conf_backup = "Y" ] + then + cp -f /etc/ipcamera/conf_960p/config_cfgaccess.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_960p/config_devm.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_960p/config_mpmng.ini /etc/ipcamera/ipc6000/ + cp -f /etc/ipcamera/conf_960p/config_enc.ini /etc/ipcamera/ipc6000/ + cp -f /etc/ipcamera/conf_960p/config_p2pstream.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_960p/config_av.ini /etc/ipcamera/ipc6000/ + fi + set_mediamem 44M + else + echo "sensor $sensor_detect Default Model 720P" + echo "sensortype=$sensor_detect" > ${SENSOR_CONF} + + if [ $conf_backup = "Y" ] + then + cp -f /etc/ipcamera/conf_720p/config_cfgaccess.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_720p/config_devm.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_720p/config_mpmng.ini /etc/ipcamera/ipc6000/ + cp -f /etc/ipcamera/conf_720p/config_p2pstream.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_720p/config_av.ini /etc/ipcamera/ipc6000/ + + fi + + set_mediamem 47M + fi + + + elif [ $sensor_detect = "gc2053" ] + then + echo "Set Sensor $sensor_detect 1080P" + echo "sensortype=$sensor_detect" > ${SENSOR_CONF} + #set_mediamem 43M + if [ $conf_backup = "Y" ] + then + cp -f /etc/ipcamera/conf_1080p/config_cfgaccess.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_1080p/config_enc.ini /etc/ipcamera/ipc1080p/ + cp -f /etc/ipcamera/conf_1080p/config_devm.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_1080p/config_mpmng.ini /etc/ipcamera/ipc1080p/ + cp -f /etc/ipcamera/conf_1080p/config_p2pstream.ini /etc/ipcamera/ + cp -f /etc/ipcamera/conf_1080p/config_av.ini /etc/ipcamera/ipc1080p/ + fi + else + echo "sensortype=$sensor_detect" > ${SENSOR_CONF} + fi +else + echo "sensor $sensor_detect, store only" + echo "sensortype=$sensor_detect" > ${SENSOR_CONF} +fi +chmod +x ${SENSOR_CONF} +sync +sleep 1 + +echo "Reconfig Sensor as $sensor_detect" + +/bin/sensorenv.sh + +sleep 3 +sync +echo sensor_cfg DONE +### 一般情况下, sensor改变, 是因为升级, 所以这里休眠时间长点, 让系统有时间做flash重整 +### 130W <-> 100W 之间的切换, 也会花这么长时间. 待优化 +echo "curr:$sensor_curr_conf detect:$sensor_detect reboot after 3 sec" +sleep 3 + +reboot + diff --git a/bin/sensorenv.sh b/bin/sensorenv.sh new file mode 100755 index 0000000..a87ff35 --- /dev/null +++ b/bin/sensorenv.sh @@ -0,0 +1,29 @@ +#!/bin/sh +#### /etc/sysenv.conf +##RT_PATH=/rt +##SENSOR_CONF=/etc/sensor.conf +##SENSOR_SO=/rt/lib/libSensor.so + +. /etc/sysenv.conf +. ${SENSOR_CONF} +SensorType=${sensortype} + +sensorso=${SENSOR_SO} +rm ${sensorso} 2>/dev/null + +echo "set sensorenv ,sensor as $SensorType" + +rm ${sensorso} -rf + +case $SensorType in + + gc2053) + ln -s /usr/lib/libsns_gc2053.so ${sensorso} + ;; + *) + ln -s /usr/lib/libsns_gc2053.so ${sensorso} + echo "xxxx Invalid sensor type $SNS_A xxxx" + ;; +esac +sync +exit \ No newline at end of file diff --git a/bin/zzz b/bin/zzz new file mode 100755 index 0000000..17dc721 --- /dev/null +++ b/bin/zzz @@ -0,0 +1,4 @@ +if [ -e /bin/vslocal/vs_server ]; +then + mv /bin/vslocal/vs_server /bin/vslocal/vs_server.safe +fi