openwrt: add button package to v1 backfire build
This commit is contained in:
parent
e5e352d5ca
commit
23b3b2f83e
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Backfire (r23144)
|
||||
# Mon Oct 4 13:53:08 2010
|
||||
# OpenWrt version: Backfire (r23346)
|
||||
# Tue Oct 12 23:21:15 2010
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -1564,6 +1564,7 @@ CONFIG_MADWIFI_RCA_MINSTREL=y
|
|||
# CONFIG_PACKAGE_fdisk is not set
|
||||
# CONFIG_PACKAGE_sfdisk is not set
|
||||
# CONFIG_PACKAGE_swap-utils is not set
|
||||
CONFIG_PACKAGE_button=y
|
||||
# CONFIG_PACKAGE_comgt is not set
|
||||
# CONFIG_PACKAGE_dropbearconvert is not set
|
||||
# CONFIG_PACKAGE_fconfig is not set
|
||||
|
|
|
@ -6,6 +6,15 @@ config system
|
|||
option version 111
|
||||
|
||||
config button
|
||||
option button reset
|
||||
option action pressed
|
||||
option handler '/etc/init.d/network restart'
|
||||
option button reset
|
||||
option action released
|
||||
option handler net_toggle
|
||||
option min 2
|
||||
option max 5
|
||||
|
||||
config button
|
||||
option button reset
|
||||
option action released
|
||||
option handler net_defaults
|
||||
option min 10
|
||||
option max 30
|
||||
|
|
|
@ -26,6 +26,7 @@ cp .config $BACKFIRE_PATH
|
|||
cp -r files $BACKFIRE_PATH
|
||||
|
||||
cp patches/300-set.AR2315_RESET_GPIO.to.6.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
|
||||
cp patches/310-hotplug_button_jiffies_calc.patch $BACKFIRE_PATH/target/linux/atheros/patches-2.6.30
|
||||
|
||||
cd $BACKFIRE_PATH
|
||||
patch -p0 < $REPO_PATH/patches/100-disable.console.patch
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# Copyright (c) 2010 flukso.net
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=button
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/button
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=
|
||||
TITLE:=Button
|
||||
endef
|
||||
|
||||
define Package/button/description
|
||||
Helper bash scripts used as a callback for hotplug button events. net_toggle toggles between ethernet and wifi mode. net_defaults reverts all firewall, network and wireless settings to factory defaults.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/button/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/net_toggle $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/net_defaults $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,button))
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2010 flukso.net
|
||||
|
||||
cd /rom/etc/config
|
||||
cp firewall network wireless /etc/config
|
||||
|
||||
logger 'returning to firewall, network and wireless defaults'
|
||||
|
||||
gpioctl dirout 4
|
||||
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
||||
do
|
||||
gpioctl clear 4
|
||||
gpioctl set 4
|
||||
done
|
||||
|
||||
/etc/init.d/network restart
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2010 flukso.net
|
||||
|
||||
to_wifi ()
|
||||
{
|
||||
uci set firewall.@zone[1].input=REJECT
|
||||
uci set network.wan.ifname=ath0
|
||||
uci set network.lan.ifname=eth0
|
||||
uci set wireless.wifi0.disabled=0
|
||||
uci set wireless.@wifi-iface[0].network=wan
|
||||
uci set wireless.@wifi-iface[0].mode=sta
|
||||
uci commit
|
||||
logger 'toggled to wifi mode'
|
||||
}
|
||||
|
||||
to_eth ()
|
||||
{
|
||||
uci set firewall.@zone[1].input=ACCEPT
|
||||
uci set network.wan.ifname=eth0
|
||||
uci set network.lan.ifname=ath0
|
||||
uci set wireless.wifi0.disabled=1
|
||||
uci set wireless.@wifi-iface[0].network=lan
|
||||
uci set wireless.@wifi-iface[0].mode=ap
|
||||
uci commit
|
||||
logger 'toggled to eth mode'
|
||||
}
|
||||
|
||||
|
||||
MODE=$(uci get network.wan.ifname)
|
||||
|
||||
if [ $MODE == eth0 ]
|
||||
then
|
||||
to_wifi
|
||||
elif [ $MODE == ath0 ]
|
||||
then
|
||||
to_eth
|
||||
fi
|
||||
|
||||
gpioctl dirout 4
|
||||
|
||||
for i in 1 2 3 4 5
|
||||
do
|
||||
gpioctl clear 4
|
||||
gpioctl set 4
|
||||
done
|
||||
|
||||
/etc/init.d/network restart
|
|
@ -0,0 +1,27 @@
|
|||
--- a/arch/mips/ar231x/reset.c
|
||||
+++ b/arch/mips/ar231x/reset.c
|
||||
@@ -19,6 +19,7 @@
|
||||
struct work_struct wq;
|
||||
int set;
|
||||
unsigned long jiffies;
|
||||
+ unsigned long jiffies_prev;
|
||||
};
|
||||
|
||||
static struct timer_list rst_button_timer;
|
||||
@@ -68,7 +69,7 @@
|
||||
add_msg(skb, "SUBSYSTEM=button");
|
||||
add_msg(skb, "BUTTON=reset");
|
||||
add_msg(skb, (event->set ? "ACTION=pressed" : "ACTION=released"));
|
||||
- sprintf(buf, "SEEN=%ld", (event->jiffies - seen)/HZ);
|
||||
+ sprintf(buf, "SEEN=%lu", (event->jiffies - event->jiffies_prev)/HZ);
|
||||
add_msg(skb, buf);
|
||||
snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
|
||||
add_msg(skb, buf);
|
||||
@@ -127,6 +128,7 @@
|
||||
no_release_workaround = 0;
|
||||
|
||||
event->jiffies = jiffies;
|
||||
+ event->jiffies_prev = seen;
|
||||
|
||||
INIT_WORK(&event->wq, hotplug_button);
|
||||
schedule_work(&event->wq);
|
Loading…
Reference in New Issue