[OpenWrt-Devel] [PATCH] om-watchdog: Add support for GL-X1200 (GL.iNet)

guilin.wang at gl-inet.com guilin.wang at gl-inet.com
Fri Apr 10 05:46:49 EDT 2020


Signed-off-by: guilin.wang at gl-inet.com <guilin.wang at gl-inet.com>
---
 package/kernel/om-watchdog/Makefile               |  2 +-
 package/kernel/om-watchdog/files/om-watchdog      | 40 +++++++++++++++++++----
 package/kernel/om-watchdog/files/om-watchdog.init |  2 ++
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/package/kernel/om-watchdog/Makefile b/package/kernel/om-watchdog/Makefile
index 403069b..02520d2 100644
--- a/package/kernel/om-watchdog/Makefile
+++ b/package/kernel/om-watchdog/Makefile
@@ -12,7 +12,7 @@ PKG_RELEASE:=2
 PKG_VERSION:=1
 
 include $(INCLUDE_DIR)/package.mk
-
+PKG_CONFIG_DEPENDS += BUSYBOX_CONFIG_FLOAT_DURATION
 define Package/om-watchdog
   SECTION:=base
   CATEGORY:=Base system
diff --git a/package/kernel/om-watchdog/files/om-watchdog b/package/kernel/om-watchdog/files/om-watchdog
index d730c68..b12db3e 100644
--- a/package/kernel/om-watchdog/files/om-watchdog
+++ b/package/kernel/om-watchdog/files/om-watchdog
@@ -1,15 +1,43 @@
 #!/bin/sh
 
+. /lib/functions.sh
+
 GPIO=$1
 
 trap "" INT HUP
 
+om_feed_dog()
+{
+        while true; do
+                echo 1 > /sys/class/gpio/gpio${GPIO}/value
+                sleep 1
+                echo 0 > /sys/class/gpio/gpio${GPIO}/value
+                sleep 180
+        done
+}
+glinet_feed_dog()
+{
+        local count=1
+        for i in $(seq 1 $count);
+        do
+                echo 1 >/sys/class/gpio/gpio14/value
+                sleep 0.01
+                echo 0 >/sys/class/gpio/gpio14/value
+                sleep 0.01
+        done
+}
+
 echo $GPIO > /sys/class/gpio/export
 echo out > /sys/class/gpio/gpio${GPIO}/direction
 
-while true; do
-	echo 1 > /sys/class/gpio/gpio${GPIO}/value
-	sleep 1
-	echo 0 > /sys/class/gpio/gpio${GPIO}/value
-	sleep 180
-done
+board=$(board_name)
+if [ "$board" = "glinet,gl-x1200-nor" -o "$board" = "glinet,gl-x1200-nor-nand" ];then
+        echo 14 >/sys/class/gpio/export
+        echo out >/sys/class/gpio/gpio14/direction
+        while true;do
+                glinet_feed_dog 
+                sleep 10
+        done
+else
+        om_feed_dog 
+fi
diff --git a/package/kernel/om-watchdog/files/om-watchdog.init b/package/kernel/om-watchdog/files/om-watchdog.init
index 4c407da..5d3ffdd 100644
--- a/package/kernel/om-watchdog/files/om-watchdog.init
+++ b/package/kernel/om-watchdog/files/om-watchdog.init
@@ -50,6 +50,8 @@ get_gpio() {
 	elif [ "$board" = "teltonika_rut5xx" ]; then
 		# ramips
 		return 11
+	elif [ "$board" = "glinet,gl-x1200-nor" -o "$board" = "glinet,gl-x1200-nor-nand" ];then
+			return 16
 	else
 		#we assume it is om1p in this case
 		return 3
-- 
2.7.4




_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list