summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-11-07 22:58:20 +0100
committerHung-Te Lin <hungte@chromium.org>2020-12-24 08:20:32 +0000
commitb2569eaa829a44287bcf97672f086c079d939536 (patch)
tree343b16b7758494fac26b71777ffcd102f40921c4
parente9c572f203b18e5095676cb226e775caf4226cfe (diff)
libpayload/keyboard: Hide console output by default
Change-Id: I855d975a4729da34a6fa73a63dbbd12c856bdc00 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47590 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index 14089bd51e..cb386e919f 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -36,6 +36,12 @@
#include "i8042.h"
+#ifdef DEBUG
+#define debug(x...) printf(x)
+#else
+#define debug(x...) do {} while (0)
+#endif
+
#define POWER_BUTTON 0x90
#define MEDIA_KEY_PREFIX 0xE0
@@ -200,12 +206,12 @@ static bool keyboard_cmd(unsigned char cmd)
default:
/* Warn only if we already disabled keyboard input. */
if (cmd != I8042_KBCMD_DEFAULT_DIS)
- printf("WARNING: Keyboard sent spurious 0x%02x.\n", data);
+ debug("WARNING: Keyboard sent spurious 0x%02x.\n", data);
break;
}
} while (timer_us(start_time) < timeout_us);
- printf("ERROR: Keyboard command timed out.\n");
+ debug("ERROR: Keyboard command timed out.\n");
return false;
}
@@ -218,13 +224,13 @@ static bool set_scancode_set(const unsigned char set)
ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE);
if (!ret) {
- printf("ERROR: Keyboard set scancode failed!\n");
+ debug("ERROR: Keyboard set scancode failed!\n");
return ret;
}
ret = keyboard_cmd(set);
if (!ret) {
- printf("ERROR: Keyboard scancode set#%u failed!\n", set);
+ debug("ERROR: Keyboard scancode set#%u failed!\n", set);
return ret;
}
@@ -291,7 +297,7 @@ static void keyboard_poll(void)
case STATE_START_SELF_TEST:
if (!keyboard_cmd(I8042_KBCMD_RESET))
- printf("ERROR: Keyboard self-test couldn't be started.\n");
+ debug("ERROR: Keyboard self-test couldn't be started.\n");
/* We ignore errors and always move to the self-test state
which will simply try again if necessary. */
next_state = STATE_SELF_TEST;
@@ -316,7 +322,7 @@ static void keyboard_poll(void)
next_state = STATE_START_SELF_TEST;
break;
default:
- printf("WARNING: Keyboard self-test received spurious 0x%02x\n",
+ debug("WARNING: Keyboard self-test received spurious 0x%02x\n",
self_test_result);
break;
}
@@ -331,7 +337,7 @@ static void keyboard_poll(void)
case STATE_CONFIGURE_SET1:
if (!set_scancode_set(1)) {
- printf("ERROR: Keyboard failed to set any scancode set.\n");
+ debug("ERROR: Keyboard failed to set any scancode set.\n");
next_state = STATE_DISABLE_SCAN;
break;
}
@@ -341,7 +347,7 @@ static void keyboard_poll(void)
case STATE_ENABLE_TRANSLATION:
if (i8042_set_kbd_translation(true) != 0) {
- printf("ERROR: Keyboard controller set translation failed!\n");
+ debug("ERROR: Keyboard controller set translation failed!\n");
next_state = STATE_DISABLE_SCAN;
break;
}
@@ -351,7 +357,7 @@ static void keyboard_poll(void)
case STATE_ENABLE_SCAN:
if (!keyboard_cmd(I8042_KBCMD_EN)) {
- printf("ERROR: Keyboard enable scanning failed!\n");
+ debug("ERROR: Keyboard enable scanning failed!\n");
next_state = STATE_DISABLE_SCAN;
break;
}