Check MAC for Xiongmai devices and some small fixes

pull/33/head
Igor Zalatov (via Araneus server) 2021-06-19 21:19:45 +03:00
parent 64a73486bc
commit ae4d531f37
3 changed files with 98 additions and 1 deletions

View File

@ -10,6 +10,14 @@ MAJESTIC_ARGS=""
# The majestic does not create a pidfile, and use "-m" to instruct start-stop-daemon to create one.
start() {
logger -s -p daemon.info -t hisilicon "Check MAC for Xiongmai devices"
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
logger -s -p daemon.info -t hisilicon "The eth0 interface has a lousy MAC, let's try to change it.."
XMMAC="$(ipcinfo --xm_mac)" && [ -n "${XMMAC}" ] && fw_setenv ethaddr ${XMMAC} && ifconfig eth0 hw ether ${XMMAC} && logger -s -p daemon.info -t hisilicon "The eth0 interface have new MAC - ${XMMAC}"
else
logger -s -p daemon.info -t hisilicon "The eth0 interface has a correct MAC - $(fw_printenv -n ethaddr)"
fi
#
logger -s -p daemon.info -t hisilicon "Loading of kernel modules and initialization of the video system has started"
export TZ=$(cat /etc/TZ)
load_hisilicon -i

View File

@ -0,0 +1,89 @@
#!/bin/sh
# on SSC335:
# on EV200:
# GPIO1_0 -> GPIO8 (1*8+0 = 8)
# GPIO1_1 -> GPIO9 (1*8+1 = 9)
# on EV300:
# GPIO1_3 -> GPIO11
# GPIO1_2 -> GPIO10
#(normal mode)
ir_cut_enable() {
# pin_mux
echo "$gpio_0" >/sys/class/gpio/unexport
echo "$gpio_1" >/sys/class/gpio/unexport
echo "$gpio_0" >/sys/class/gpio/export
echo "$gpio_1" >/sys/class/gpio/export
# dir
echo "out" >/sys/class/gpio/gpio$gpio_0/direction
echo "out" >/sys/class/gpio/gpio$gpio_1/direction
# data, gpio_1: 0, gpio_0: 1 (normal mode)
echo "1" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
#sleep 1s
sleep 1
# back to original
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
}
# (ir mode)
ir_cut_disable() {
# pin_mux
echo "$gpio_0" >/sys/class/gpio/unexport
echo "$gpio_1" >/sys/class/gpio/unexport
echo "$gpio_0" >/sys/class/gpio/export
echo "$gpio_1" >/sys/class/gpio/export
# dir
echo "out" >/sys/class/gpio/gpio$gpio_0/direction
echo "out" >/sys/class/gpio/gpio$gpio_1/direction
# data, gpio_1: 1, gpio_0: 0 (ir mode)
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "1" >/sys/class/gpio/gpio$gpio_1/value
#sleep 1s
sleep 1
# back to original
echo "0" >/sys/class/gpio/gpio$gpio_0/value
echo "0" >/sys/class/gpio/gpio$gpio_1/value
}
gpio_0=0
gpio_1=0
if [ $# -lt 2 ]; then
echo "usage : ./ircut_demo <device> <mode>"
echo "for example:"
echo "ir mode : ./ircut_demo ms-j10 1"
else
if [ $1 = "ms-j10" ]; then
gpio_0=78
gpio_1=79
elif [ $1 = "uniview" ]; then
gpio_0=78
gpio_1=79
else
echo "wrong device: $1, please select: ms-j10 or uniview."
exit
fi
if [ $2 -eq 0 ]; then
echo "normal mode, ir_cut on"
ir_cut_enable >/dev/null
elif [ $2 -eq 1 ]; then
echo "ir mode, ir_cut off"
ir_cut_disable >/dev/null
else
echo "invalid mode, please slect 0 or 1."
fi
fi

View File

@ -4,7 +4,7 @@
#
################################################################################
IPCTOOL_VERSION = 7c25684308d18f7fd232b7e9d9c249e4a8107951
IPCTOOL_VERSION = e847b384c0d4339dbbad591a3f8a308ec1f0eced
IPCTOOL_SITE = $(call github,openipc,ipctool,$(IPCTOOL_VERSION))
IPCTOOL_LICENSE = MIT
IPCTOOL_LICENSE_FILES = LICENSE