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 <lists@sumpfralle.de> SVN-Revision: 46271
This commit is contained in:
@@ -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 <<EOF
|
||||
set system.$cfg='gpio_switch'
|
||||
set system.$cfg.name='$name'
|
||||
set system.$cfg.gpio_pin='$gpio_pin'
|
||||
set system.$cfg.value='$default'
|
||||
EOF
|
||||
UCIDEF_GPIO_SWITCHES_CHANGED=1
|
||||
}
|
||||
|
||||
ucidef_commit_gpio_switches()
|
||||
{
|
||||
[ "$UCIDEF_GPIO_SWITCHES_CHANGED" = "1" ] && uci commit system
|
||||
}
|
||||
|
||||
ucidef_set_interface_loopback() {
|
||||
uci batch <<EOF
|
||||
set network.loopback='interface'
|
||||
|
||||
Reference in New Issue
Block a user