summaryrefslogtreecommitdiff
path: root/obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch
diff options
context:
space:
mode:
authormbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2004-07-31 07:30:57 +0000
committermbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2004-07-31 07:30:57 +0000
commit1dfdb01703ee80d615586a72d3e8de29d5c9c97e (patch)
tree917bbbcb8a47bea87b391155c1c0170bf6175f14 /obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch
parent59c30bc41c97b06995b3285f287bc38a69d36fe5 (diff)
restructure; cleanup
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@120 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch')
-rw-r--r--obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch b/obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch
new file mode 100644
index 0000000000..b41315e1f7
--- /dev/null
+++ b/obsolete-buildroot/sources/openwrt/busybox/patches/130-resetmon.patch
@@ -0,0 +1,89 @@
+diff -urN busybox-dist/include/applets.h busybox/include/applets.h
+--- busybox-dist/include/applets.h 2004-03-16 09:56:27.000000000 -0600
++++ busybox/include/applets.h 2004-03-16 10:00:14.000000000 -0600
+@@ -484,6 +484,9 @@
+ #ifdef CONFIG_RESET
+ APPLET(reset, reset_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
+ #endif
++#ifdef CONFIG_RESETMON
++ APPLET(resetmon, resetmon_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
++#endif
+ #ifdef CONFIG_RM
+ APPLET(rm, rm_main, _BB_DIR_BIN, _BB_SUID_NEVER)
+ #endif
+diff -urN busybox-dist/include/usage.h busybox/include/usage.h
+--- busybox-dist/include/usage.h 2004-03-16 09:56:27.000000000 -0600
++++ busybox/include/usage.h 2004-03-16 10:00:14.000000000 -0600
+@@ -2024,6 +2024,11 @@
+ #define reset_full_usage \
+ "Resets the screen."
+
++#define resetmon_trivial_usage \
++ ""
++#define resetmon_full_usage \
++ "Return an exit code of TRUE (0) if reset is NOT pressed."
++
+ #define rm_trivial_usage \
+ "[OPTION]... FILE..."
+ #define rm_full_usage \
+diff -urN busybox-dist/miscutils/Config.in busybox/miscutils/Config.in
+--- busybox-dist/miscutils/Config.in 2004-03-15 02:28:46.000000000 -0600
++++ busybox/miscutils/Config.in 2004-03-16 10:00:14.000000000 -0600
+@@ -156,6 +156,12 @@
+ to advance or rewind a tape past a specified number of archive
+ files on the tape.
+
++config CONFIG_RESETMON
++ bool "resetmon"
++ default y
++ help
++ Linksys wrt54g reset button monitor. Returns TRUE if NOT pressed.
++
+ config CONFIG_RX
+ bool "rx"
+ default n
+diff -urN busybox-dist/miscutils/Makefile.in busybox/miscutils/Makefile.in
+--- busybox-dist/miscutils/Makefile.in 2004-03-15 02:28:46.000000000 -0600
++++ busybox/miscutils/Makefile.in 2004-03-16 10:00:14.000000000 -0600
+@@ -33,6 +33,7 @@
+ MISCUTILS-$(CONFIG_LAST) += last.o
+ MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o
+ MISCUTILS-$(CONFIG_MT) += mt.o
++MISCUTILS-$(CONFIG_RESETMON) += resetmon.o
+ MISCUTILS-$(CONFIG_RX) += rx.o
+ MISCUTILS-$(CONFIG_STRINGS) += strings.o
+ MISCUTILS-$(CONFIG_TIME) += time.o
+diff -urN busybox-dist/miscutils/resetmon.c busybox/miscutils/resetmon.c
+--- busybox-dist/miscutils/resetmon.c 1969-12-31 18:00:00.000000000 -0600
++++ busybox/miscutils/resetmon.c 2004-03-16 10:00:14.000000000 -0600
+@@ -0,0 +1,30 @@
++#include <unistd.h>
++#include <fcntl.h>
++#include "busybox.h"
++
++#define RESET (1<<6)
++
++int resetmon_main(int argc, char **argv) {
++ int fd = -1;
++ unsigned int val=0;
++
++#if 0
++ if ((fd = open("/dev/gpio/control",O_RDWR))<0) goto error;
++ read(fd,&val,4);
++ val|=RESET;
++ write(fd,&val,4);
++
++ if ((fd = open("/dev/gpio/outen",O_RDWR))<0) goto error;
++ read(fd,&val,4);
++ val&=~RESET;
++ write(fd,&val,4);
++#endif
++
++ if ((fd = open("/dev/gpio/in",O_RDONLY))<0) goto error;
++ read(fd,&val,4);
++
++ return !(val&RESET);
++
++error:
++ return 1;
++}