aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-04-20 11:35:47 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-04-20 11:35:47 -0700
commita74e5d87c3c1b38a678f0cd8f366841b0d985682 (patch)
tree549fb7837f1bf2032b85a7291a3273a3a5611b32
parentb8752b88492d8f321037ad29e56a2fdf9e798e15 (diff)
downloadsyslinux-a74e5d87c3c1b38a678f0cd8f366841b0d985682.tar.gz
syslinux-a74e5d87c3c1b38a678f0cd8f366841b0d985682.tar.xz
syslinux-a74e5d87c3c1b38a678f0cd8f366841b0d985682.zip
Centralize shift_is_held(), make it work to force the command lineobsolete-20140420
Holding down shift is supposed to force a command line unless noescape is provided; make it behave that way. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/elflink/ldlinux/ldlinux.c8
-rw-r--r--com32/include/console.h1
-rw-r--r--com32/menu/menumain.c5
-rw-r--r--core/include/core.h9
4 files changed, 16 insertions, 7 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 76d117c7..e4747d4b 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -297,6 +297,11 @@ void ldlinux_console_init(void)
openconsole(&dev_stdcon_r, &dev_ansiserial_w);
}
+static inline int shift_is_held(void)
+{
+ return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */
+}
+
__export int main(int argc __unused, char **argv)
{
const void *adv;
@@ -337,8 +342,7 @@ __export int main(int argc __unused, char **argv)
ldlinux_enter_command();
}
- /* TODO: Check KbdFlags? */
- if (!forceprompt)
+ if (!forceprompt && !shift_is_held())
ldlinux_auto_boot();
if (defaultlevel > 1)
diff --git a/com32/include/console.h b/com32/include/console.h
index 74e68f1a..94ffb9fa 100644
--- a/com32/include/console.h
+++ b/com32/include/console.h
@@ -35,6 +35,7 @@
#define _CONSOLE_H
#include <klibc/extern.h>
+#include <inttypes.h>
#include <dev.h>
__extern int openconsole(const struct input_dev *, const struct output_dev *);
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 1d239a7f..b8cb06fd 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -609,11 +609,6 @@ static const char *edit_cmdline(const char *input, int top)
}
}
-static inline int shift_is_held(void)
-{
- return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */
-}
-
static void print_timeout_message(int tol, int row, const char *msg)
{
static int last_msg_len = 0;
diff --git a/core/include/core.h b/core/include/core.h
index c8689dfd..4783d75f 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -130,6 +130,15 @@ extern void writechr(char data);
extern void crlf(void);
extern int pollchar(void);
extern char getchar(char *hi);
+extern uint8_t kbd_shiftflags(void);
+static inline bool shift_is_held(void)
+{
+ return !!(kbd_shiftflags() & 0x5d); /* Caps/Scroll/Alt/Shift */
+}
+static inline bool ctrl_is_held(void)
+{
+ return !!(kbd_shiftflags() & 0x04); /* Only Ctrl */
+}
extern void cleanup_hardware(void);
extern void sirq_cleanup(void);