1
0
mirror of https://github.com/fritz-smh/yi-hack synced 2025-06-07 16:06:11 +00:00

Add hardware detection in logs, display versions informations in web interface also

This commit is contained in:
fritz-smh 2016-03-22 22:50:50 +01:00
parent d9a57455c9
commit 8184ec3717
3 changed files with 37 additions and 13 deletions

View File

@ -159,7 +159,12 @@ rm /home/web/sd/* -rf
cd /home/3518 cd /home/3518
./load3518_left -i ./load3518_left -i
### Detect the hardware version
# result will be written in /tmp/hwplatform
/home/detect_ver /home/detect_ver
himm 0x20050074 0x06802424 himm 0x20050074 0x06802424
### what is this ? ### what is this ?
@ -191,11 +196,19 @@ cp /home/hd1/test/wpa_supplicant.conf /home/wpa_supplicant.conf
### Init logs ### Init logs
log_init log_init
# Put version informations in logs # Put version informations in logs and a file which will be included in the http server default page
log "Version informations : " TMP_VERSION_FILE=/tmp/version_information
cat /home/version | sed "s/^/ /" >> ${LOG_FILE} rm -f ${TMP_VERSION_FILE}
echo "Hardware version informations : " >> ${TMP_VERSION_FILE}
cat /tmp/hwplatform | sed "s/^/ /" >> ${TMP_VERSION_FILE}
echo "Software version informations : " >> ${TMP_VERSION_FILE}
cat /home/version | sed "s/^/ /" >> ${TMP_VERSION_FILE}
FIRMWARE_LETTER=$(cat /home/version | grep "version=" | head -1 | cut -d"=" -f2 | sed "s/^[0-9]\.[0-9]\.[0-9]\.[0-9]\([A-Z]\).*/\1/") FIRMWARE_LETTER=$(cat /home/version | grep "version=" | head -1 | cut -d"=" -f2 | sed "s/^[0-9]\.[0-9]\.[0-9]\.[0-9]\([A-Z]\).*/\1/")
log "Firmware letter is : '${FIRMWARE_LETTER}'" echo "Firmware letter is : '${FIRMWARE_LETTER}'" >> ${TMP_VERSION_FILE}
cat ${TMP_VERSION_FILE} >> ${LOG_FILE}
log "The blue led is currently blinking" log "The blue led is currently blinking"
log "Debug mode = $(get_config DEBUG)" log "Debug mode = $(get_config DEBUG)"
@ -266,10 +279,18 @@ log "Status for ftp server=$res (0 is ok)"
### Launch web server ### Launch web server
# first, prepare the index.html page
cd /home/hd1/test/http/ cd /home/hd1/test/http/
cat index.html.tpl_header ${TMP_VERSION_FILE} index.html.tpl_footer > index.html
# then, bind the record folder
mkdir /home/hd1/test/http/record/ mkdir /home/hd1/test/http/record/
mount -o bind /home/hd1/record/ /home/hd1/test/http/record/ mount -o bind /home/hd1/record/ /home/hd1/test/http/record/
# prepare the GET /motion url
touch /home/hd1/test/http/motion touch /home/hd1/test/http/motion
# start the server
log "Start http server : server${FIRMWARE_LETTER}..." log "Start http server : server${FIRMWARE_LETTER}..."
if [[ $(get_config DEBUG) == "yes" ]] ; then if [[ $(get_config DEBUG) == "yes" ]] ; then
./server${FIRMWARE_LETTER} 80 > /${LOG_DIR}/log_http.txt 2>&1 & ./server${FIRMWARE_LETTER} 80 > /${LOG_DIR}/log_http.txt 2>&1 &

View File

@ -0,0 +1,10 @@
</pre>
<script type="text/javascript">
var ip = location.host;
document.getElementById("ip").textContent=ip;
document.getElementById("ch0_0").href="rtsp://"+ip+":554/ch0_0.h264";
document.getElementById("ch0_1").href="rtsp://"+ip+":554/ch0_1.h264";
document.getElementById("ch0_3").href="rtsp://"+ip+":554/ch0_3.h264";
</script>
</body>
</html>

View File

@ -21,12 +21,5 @@
<ul> <ul>
<li><a href="/record/">Click here to access the record files.</a></li> <li><a href="/record/">Click here to access the record files.</a></li>
</ul> </ul>
<script type="text/javascript"> <h2>Software and hardware informations</h2>
var ip = location.host; <pre>
document.getElementById("ip").textContent=ip;
document.getElementById("ch0_0").href="rtsp://"+ip+":554/ch0_0.h264";
document.getElementById("ch0_1").href="rtsp://"+ip+":554/ch0_1.h264";
document.getElementById("ch0_3").href="rtsp://"+ip+":554/ch0_3.h264";
</script>
</body>
</html>