From d54e74078002847c1c03a06115e4afa499c373d2 Mon Sep 17 00:00:00 2001 From: roleo Date: Sun, 28 Jan 2024 17:47:44 +0100 Subject: [PATCH] Fix serial number offset for y23 --- .../yi-hack/script/mqtt_advertise/mqtt_adv_info_global.sh | 6 +++++- src/static/static/home/yi-hack/script/system.sh | 6 +++++- src/www/httpd/cgi-bin/status.json | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/static/static/home/yi-hack/script/mqtt_advertise/mqtt_adv_info_global.sh b/src/static/static/home/yi-hack/script/mqtt_advertise/mqtt_adv_info_global.sh index 5710587..f480f2b 100755 --- a/src/static/static/home/yi-hack/script/mqtt_advertise/mqtt_adv_info_global.sh +++ b/src/static/static/home/yi-hack/script/mqtt_advertise/mqtt_adv_info_global.sh @@ -21,7 +21,11 @@ HOSTNAME=$(hostname) FW_VERSION=$(cat $YI_HACK_PREFIX/version) HOME_VERSION=$(cat /home/app/.appver) MODEL_SUFFIX=$(cat $YI_HACK_PREFIX/model_suffix) -SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +if [[ $MODEL_SUFFIX == "y23" ]]; then + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=592 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +else + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +fi LOCAL_IP=$(ifconfig wlan0 | awk '/inet addr/{print substr($2,6)}') NETMASK=$(ifconfig wlan0 | awk '/inet addr/{print substr($4,6)}') GATEWAY=$(route -n | awk 'NR==3{print $2}') diff --git a/src/static/static/home/yi-hack/script/system.sh b/src/static/static/home/yi-hack/script/system.sh index e9b3292..7cc8653 100755 --- a/src/static/static/home/yi-hack/script/system.sh +++ b/src/static/static/home/yi-hack/script/system.sh @@ -341,7 +341,11 @@ if [[ $(get_config RTSP) == "yes" ]] ; then $YI_HACK_PREFIX/script/wd_rtsp.sh & fi -SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +if [[ $MODEL_SUFFIX == "y23" ]]; then + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=592 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +else + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +fi HW_ID=$(dd status=none bs=1 count=4 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-4) if [[ $(get_config ONVIF) == "yes" ]] ; then diff --git a/src/www/httpd/cgi-bin/status.json b/src/www/httpd/cgi-bin/status.json index e99b0c7..c4b102f 100755 --- a/src/www/httpd/cgi-bin/status.json +++ b/src/www/httpd/cgi-bin/status.json @@ -12,7 +12,11 @@ if [ "$MODEL_SUFFIX" == "h201c" ] || [ "$MODEL_SUFFIX" == "h305r" ] || [ "$MODEL else PTZ="no" fi -SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +if [ "$MODEL_SUFFIX" == "y23" ]; then + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=592 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +else + SERIAL_NUMBER=$(dd status=none bs=1 count=20 skip=661 if=/tmp/mmap.info | tr '\0' '0' | cut -c1-20) +fi LOCAL_TIME=$(date) UPTIME=$(cat /proc/uptime | cut -d ' ' -f1) LOAD_AVG=$(cat /proc/loadavg | cut -d ' ' -f1-3)