[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] kbc: mögliche Endlosschleife gefixt



! Wenn in send_kbc_command kein 0xfa (ACK), sondern 0xfe (Resend) zurück-
  kommt, hätte es eine Endlosschleife gegeben.

Signed-off-by: Arne Hasselbring <arne.hasselbring@xxxxxxxxxxxxxx>
---
 src/modules/kbc/keyboard.c | 11 ++++++-----
 1 Datei geändert, 6 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)

diff --git a/src/modules/kbc/keyboard.c b/src/modules/kbc/keyboard.c
index bfacf01..4fdaadc 100644
--- a/src/modules/kbc/keyboard.c
+++ b/src/modules/kbc/keyboard.c
@@ -85,11 +85,12 @@ static void send_key_event(uint8_t keycode, bool release);
  */
 static void send_kbd_command(uint8_t command)
 {
-    while (inb(0x64) & 0x2) {
-        yield();
-    }
-    outb(0x60, command);
-    while (inb(0x60) != 0xfa);
+    do {
+	while (inb(0x64) & 0x2) {
+	    yield();
+	}
+	outb(0x60, command);
+    } while (inb(0x60) == 0xfe);
 }
 
 
-- 
1.7.11.1