[syslinux:elflink] rawcon_read: Fix reading high part of input keys

syslinux-bot for Matt Fleming matt.fleming at intel.com
Tue Aug 14 09:21:07 PDT 2012


Commit-ID:  2e512282fd37f7dcb6d33e025e389f11d6d6d42f
Gitweb:     http://www.syslinux.org/commit/2e512282fd37f7dcb6d33e025e389f11d6d6d42f
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 2 Aug 2012 10:34:17 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 2 Aug 2012 10:34:17 +0100

rawcon_read: Fix reading high part of input keys

commit 8486142cf304 ("elflink: Replace __intcall() with direct
function calls") made the mistake of zero'ing the high part of the
input key on every invocation of __rawcon_read() instead of preserving
it across calls like the old code, which lead to function keys such as
KEY_UP, KEY_DOWN, etc not working.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/lib/sys/rawcon_read.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/com32/lib/sys/rawcon_read.c b/com32/lib/sys/rawcon_read.c
index 7eae95f..51bb953 100644
--- a/com32/lib/sys/rawcon_read.c
+++ b/com32/lib/sys/rawcon_read.c
@@ -44,15 +44,16 @@ ssize_t __rawcon_read(struct file_info *fp, void *buf, size_t count)
 {
     char *bufp = buf;
     size_t n = 0;
-    char hi = 0;
+    static char hi = 0;
+    static bool hi_key = false;
 
     (void)fp;
 
     while (n < count) {
-	if (hi) {
+	if (hi_key) {
 	    *bufp++ = hi;
 	    n++;
-	    hi = 0;
+	    hi_key = false;
 	    continue;
 	}
 
@@ -61,7 +62,11 @@ ssize_t __rawcon_read(struct file_info *fp, void *buf, size_t count)
 	    break;
 
 	/* We have data, go get it */
-	*bufp++ = getchar(&hi);
+	*bufp = getchar(&hi);
+	if (!*bufp)
+		hi_key = true;
+
+	bufp++;
 	n++;
     }
 


More information about the Syslinux-commits mailing list