wifipineapple-openwrt/obsolete-buildroot/sources/busybox-openwrt-130-resetmo...

90 lines
2.7 KiB
Diff

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;
+}