Skip to content

Commit

Permalink
Fix serial number offset for y23
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Jan 28, 2024
1 parent bed7d60 commit d54e740
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
6 changes: 5 additions & 1 deletion src/static/static/home/yi-hack/script/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/www/httpd/cgi-bin/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d54e740

Please sign in to comment.