Skip to contentSkip to conversation

Nokia RX-51: Fix double space key press

PATCH In review Pali Rohár 2 participants 2 messages Oct 9, 2022 – Oct 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Nokia RX-51: Fix double space key press

Space key is indicated by two different bits. Some HW models indicate press of space key only by the first bit. Qemu indicates it by both bits at the same time, which is currently interpreted by u-boot as double key press.

Fix this issue by setting first bit when only second is set (to support HW models which indicate press only by second bit) and always clearing second bit before processing to not report double space key press.

---
 board/nokia/rx51/rx51.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/nokia/rx51/rx51.c +5 -1
index 9548c3c7be71..c1b4b91b6070 100644
@@ -561,7 +561,7 @@ static const char keymap[] = {
 	'q',  'o',  'p',  ',', '\b',    0,  'a',  's',
 	'w',  'd',  'f',  'g',  'h',  'j',  'k',  'l',
 	'e',  '.',    0,  '\r',   0,  'z',  'x',  'c',
-	'r',  'v',  'b',  'n',  'm',  ' ',  ' ',    0,
+	'r',  'v',  'b',  'n',  'm',  ' ',    0,    0,
 	't',    0,    0,    0,    0,    0,    0,    0,
 	'y',    0,    0,    0,    0,    0,    0,    0,
 	'u',    0,    0,    0,    0,    0,    0,    0,
@@ -691,6 +691,10 @@ static int rx51_kp_tstc(struct udevice *dev)
 		mods = keys[4] >> 4;
 		keys[4] &= 0x0f;
 
+		/* space key is indicated by two different bits */
+		keys[3] |= (keys[3] & (1 << 6)) >> 1;
+		keys[3] &= ~(1 << 6);
+
 		for (c = 0; c < 8; c++) {
 
 			/* get newly pressed keys only */
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Pali Rohár

Space key is indicated by two different bits. Some HW models indicate press of space key only by the first bit. Qemu indicates it by both bits at the same time, which is currently interpreted by u-boot as double key press.

Fix this issue by setting first bit when only second is set (to support HW models which indicate press only by second bit) and always clearing second bit before processing to not report double space key press.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom