From 34a460188e04a8fe3e98d0f9c0377dac2b1068f2 Mon Sep 17 00:00:00 2001 From: Victek Date: Tue, 9 Jun 2009 22:42:47 -0500 Subject: [PATCH] Add extra button actions --- release/src/router/httpd/tomato.c | 11 +++++++---- release/src/router/nvram/defaults.c | 3 +++ release/src/router/rc/buttons.c | 14 ++++++++++++-- release/src/router/www/admin-buttons.asp | 11 +++++++---- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/release/src/router/httpd/tomato.c b/release/src/router/httpd/tomato.c index 837a20d62f..2828456050 100644 --- a/release/src/router/httpd/tomato.c +++ b/release/src/router/httpd/tomato.c @@ -593,11 +593,14 @@ static const nvset_t nvset_list[] = { // admin-buttons { "sesx_led", V_RANGE(0, 255) }, // amber, white, aoss - { "sesx_b0", V_RANGE(0, 4) }, // 0-4: toggle wireless, reboot, shutdown, script - { "sesx_b1", V_RANGE(0, 4) }, // " - { "sesx_b2", V_RANGE(0, 4) }, // " - { "sesx_b3", V_RANGE(0, 4) }, // " + { "sesx_b0", V_RANGE(0, 6) }, // 0-6: toggle wireless, reboot, shutdown, script, script 1, script 2 + { "sesx_b1", V_RANGE(0, 6) }, // " + { "sesx_b2", V_RANGE(0, 6) }, // " + { "sesx_b3", V_RANGE(0, 6) }, // " + { "sesx_b4", V_RANGE(0, 6) }, // " { "sesx_script", V_TEXT(0, 1024) }, // + { "sesx_script_1", V_TEXT(0, 1024) }, // + { "sesx_script_2", V_TEXT(0, 1024) }, // // admin-debug { "debug_nocommit", V_01 }, diff --git a/release/src/router/nvram/defaults.c b/release/src/router/nvram/defaults.c index 2231069516..5ccd817d36 100644 --- a/release/src/router/nvram/defaults.c +++ b/release/src/router/nvram/defaults.c @@ -408,9 +408,12 @@ const defaults_t defaults[] = { { "sesx_b1", "4" }, { "sesx_b2", "4" }, { "sesx_b3", "4" }, + { "sesx_b4", "4" }, { "sesx_script", "[ $1 -ge 20 ] && telnetd -p 233 -l /bin/sh\n" }, + { "sesx_script_1", "" }, + { "sesx_script_2", "" }, { "script_brau", "if [ ! -e /tmp/switch-start ]; then\n" " # do something at startup\n" diff --git a/release/src/router/rc/buttons.c b/release/src/router/rc/buttons.c index d343ec53db..4b966ace92 100644 --- a/release/src/router/rc/buttons.c +++ b/release/src/router/rc/buttons.c @@ -207,16 +207,18 @@ int buttons_main(int argc, char *argv[]) #ifdef DEBUG_TEST cprintf("ses count=%d\n", count); + #endif - if ((count != 3) && (count != 7) && (count != 11)) { + if ((count != 3) && (count != 7) && (count != 11) && (count != 15) && (count != 19)) { n = count >> 2; if (n > 3) n = 3; /* 0-2 = func0 4-6 = func1 8-10 = func2 - 12+ = func3 + 12-14 = func3 + 18+ = func4 */ #ifdef DEBUG_TEST @@ -239,6 +241,14 @@ int buttons_main(int argc, char *argv[]) sprintf(s, "%d", count); run_nvscript("sesx_script", s, 2); break; + case '5': // run a script + sprintf(s, "%d", count); + run_nvscript("sesx_script_1", s, 2); + break; + case '6': // run a script + sprintf(s, "%d", count); + run_nvscript("sesx_script_2", s, 2); + break; } } #endif diff --git a/release/src/router/www/admin-buttons.asp b/release/src/router/www/admin-buttons.asp index 392328cab4..1fe16fcba0 100644 --- a/release/src/router/www/admin-buttons.asp +++ b/release/src/router/www/admin-buttons.asp @@ -28,7 +28,7 @@ textarea { -- 2.11.4.GIT