From da1aa74cec5175da25babd5e64d86c5bdb145313 Mon Sep 17 00:00:00 2001 From: "nslu2-linux.adm@bkbits.net" Date: Mon, 27 Dec 2004 23:40:06 +0000 Subject: Merge bk://oe-devel.bkbits.net/openembedded into bkbits.net:/repos/n/nslu2-linux/openembedded 2004/12/28 00:27:48+01:00 handhelds.org!CoreDump Add opie-sh-snes, an opie-sh wrapper to launch SNES ROMs. Credits to MrSquishy @ ZUG 2004/12/27 23:40:10+01:00 handhelds.org!zecke Merge bk://oe-devel@oe-devel.bkbits.net/openembedded into handhelds.org:/home/ich/programming/oe/openembedded 2004/12/27 23:39:51+01:00 handhelds.org!zecke On machines with console=null getkey returned bogus key presses. For example the Opie start script suffered from that problem on the Familiar 0.8 release. Now busybox getkey checks if the different terminal get and set methods succeeded and if not it returns an error instead of a key press. BKrev: 41d09d56WrrbUycwzhd_c3vA63p1qg --- .../busybox/busybox-1.00/add-getkey-applet.patch | 138 +++++++++++++++++++++ 1 file changed, 138 insertions(+) (limited to 'packages/busybox') diff --git a/packages/busybox/busybox-1.00/add-getkey-applet.patch b/packages/busybox/busybox-1.00/add-getkey-applet.patch index e69de29bb2..54b58936d5 100644 --- a/packages/busybox/busybox-1.00/add-getkey-applet.patch +++ b/packages/busybox/busybox-1.00/add-getkey-applet.patch @@ -0,0 +1,138 @@ + +# +# Patch managed by http://www.holgerschurig.de/patcher.html +# + +--- /dev/null ++++ busybox-1.00/console-tools/getkey.c +@@ -0,0 +1,75 @@ ++/* vi: set sw=4 ts=4: */ ++/* ++ * getkey.c - Michael 'Mickey' Lauer ++ * ++ * Version 0.1 ++ * ++ * A simple keygrapper. Displays a configurable message and waits a dedicated number ++ * of seconds for a keypress. Sets the exit code accordingly (SUCCESS on keypress). ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "busybox.h" ++ ++extern int getkey_main(int argc, char **argv) ++{ ++ int status = EXIT_FAILURE; ++ ++ if ( argc < 2 ) { ++ bb_show_usage(); ++ } ++ ++ //bb_printf( "DEBUG: time = '%s'\n", argv[1] ); ++ //bb_printf( "DEBUG: mesg = '%s'\n", argv[2] ); ++ ++ struct termios orig; ++ struct termios attr; ++ ++ if ( tcgetattr(STDIN_FILENO, &orig) == -1 ) ++ return EXIT_FAILURE; ++ ++ attr = orig; ++ attr.c_cc[VMIN] = 0; ++ attr.c_cc[VTIME] = 0; ++ attr.c_iflag |= INLCR; ++ attr.c_oflag |= OPOST|ONLCR; ++ attr.c_cflag &= ~PARENB; ++ attr.c_lflag &= ~(ICANON/*|ECHO*/); ++ if ( tcsetattr(STDIN_FILENO,TCSANOW,&attr) == -1 ) ++ return EXIT_FAILURE; ++ ++ fd_set rfds; ++ struct timeval tv; ++ int retval; ++ ++ FD_ZERO(&rfds); ++ FD_SET(0, &rfds); ++ ++ tv.tv_sec = atoi( argv[1] ); ++ tv.tv_usec = 0; ++ ++ if ( argc == 3 ) ++ { ++ bb_printf( argv[2], tv.tv_sec ); ++ bb_printf( "\n" ); ++ fflush(stdout); ++ } ++ retval = select(1, &rfds, NULL, NULL, &tv); ++ if (retval > 0) ++ { ++ status = EXIT_SUCCESS; ++ } ++ ++ if (tcsetattr(STDIN_FILENO,TCSANOW,&orig) == -1 ) ++ return EXIT_FAILURE; ++ ++ return status; ++}; ++ +--- busybox-1.00/console-tools/Makefile.in~add-getkey-applet.patch ++++ busybox-1.00/console-tools/Makefile.in +@@ -28,6 +28,7 @@ + CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o + CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o + CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o ++CONSOLETOOLS_DIR-$(CONFIG_GETKEY) += getkey.o + CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o + CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o + CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o +--- busybox-1.00/console-tools/Config.in~add-getkey-applet.patch ++++ busybox-1.00/console-tools/Config.in +@@ -31,6 +31,14 @@ + This program dumps the kernel's keyboard translation table to + stdout, in binary format. You can then use loadkmap to load it. + ++config CONFIG_GETKEY ++ bool "getkey" ++ default n ++ help ++ This program displays a configurable message and waits ++ a dedicated number of seconds for a keypress. It sets ++ the exit code accordingly, i.e. SUCCESS if there was a keypress. ++ + config CONFIG_LOADFONT + bool "loadfont" + default n +--- busybox-1.00/include/applets.h~add-getkey-applet.patch ++++ busybox-1.00/include/applets.h +@@ -223,6 +223,9 @@ + #ifdef CONFIG_FTPPUT + APPLET(ftpput, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) + #endif ++#ifdef CONFIG_GETKEY ++ APPLET(getkey, getkey_main, _BB_DIR_SBIN, _BB_SUID_NEVER) ++#endif + #ifdef CONFIG_GETOPT + APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER) + #endif +--- busybox-1.00/include/usage.h~add-getkey-applet.patch ++++ busybox-1.00/include/usage.h +@@ -734,6 +734,13 @@ + "\t-p, --password Password to be used\n" \ + "\t-P, --port Port number to be used" + ++#define getkey_trivial_usage \ ++ "time [message]" ++#define getkey_full_usage \ ++ "Display a message and wait for a keypress." ++#define getkey_example_usage \ ++ "$ getkey 5 'Press a key within %d seconds to interrupt autoboot.'" ++ + #define getopt_trivial_usage \ + "[OPTIONS]..." + #define getopt_full_usage \ -- cgit v1.2.3