[PATCH 2/6] nokia_rx51: Correct tstc() implementation

Simon Glass sjg at chromium.org
Sat Jun 17 12:49:49 CEST 2023


This returns false even when there are keys in the buffer. Fix it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 board/nokia/rx51/rx51.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 238b9637badd..138f5a811eb6 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -668,6 +668,9 @@ static int rx51_kp_tstc(struct udevice *dev)
 	u8 intr;
 	u8 mods;
 
+	if ((KEYBUF_SIZE + keybuf_tail - keybuf_head) % KEYBUF_SIZE)
+		return 1;
+
 	/* localy lock twl4030 i2c bus */
 	if (test_and_set_bit(0, &twl_i2c_lock))
 		return 0;
-- 
2.41.0.162.gfafddb0af9-goog



More information about the U-Boot mailing list