[syslinux:master] Centralize shift_is_held(), make it work to force the command line
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Sun Apr 20 11:42:06 PDT 2014
Commit-ID: a74e5d87c3c1b38a678f0cd8f366841b0d985682
Gitweb: http://www.syslinux.org/commit/a74e5d87c3c1b38a678f0cd8f366841b0d985682
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 20 Apr 2014 11:35:47 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 20 Apr 2014 11:35:47 -0700
Centralize shift_is_held(), make it work to force the command line
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 at zytor.com>
---
com32/elflink/ldlinux/ldlinux.c | 8 ++++++--
com32/include/console.h | 1 +
com32/menu/menumain.c | 5 -----
core/include/core.h | 9 +++++++++
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 76d117c..e4747d4 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 74e68f1..94ffb9f 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 1d239a7..b8cb06f 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 c8689df..4783d75 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);
More information about the Syslinux-commits
mailing list