From d65916047b44d6d157d88d15e8e3d92555c5e6f8 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 8 Jul 2015 14:25:52 +0000 Subject: base-files: implemented basic GPIO control Internal GPIO pins are used for PoE passthrough setups in multi-port routers. This patch implemnets control over this hardware feature for Ubiquiti Nanostations and TP-Link CPE510. Signed-off-by: Lars Kruse SVN-Revision: 46271 --- .../base-files/files/lib/functions/uci-defaults.sh | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'package/base-files/files/lib/functions') diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 5a8809d..6577ecd 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -2,6 +2,7 @@ # Copyright (C) 2011 OpenWrt.org UCIDEF_LEDS_CHANGED=0 +UCIDEF_GPIO_SWITCHES_CHANGED=0 ucidef_set_led_netdev() { local cfg="led_$1" @@ -180,6 +181,29 @@ ucidef_commit_leds() [ "$UCIDEF_LEDS_CHANGED" = "1" ] && uci commit system } +ucidef_set_gpio_switch() { + local cfg="gpio_switch_$1" + local name="$2" + local gpio_pin="$3" + # use "0" as default value + local default="${4:-0}" + + uci -q get "system.$cfg" && return 0 + + uci batch <