[Intel-gfx] [PATCH i-g-t 8/9] lib/igt_aux: Extend igt_debug_wait_for_keypres.
Rodrigo Vivi
rodrigo.vivi at intel.com
Tue Dec 9 18:01:56 PST 2014
Return key pressed and allow different messages.
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
lib/igt_aux.c | 9 ++++++---
lib/igt_aux.h | 2 +-
lib/igt_kms.c | 3 ++-
tests/kms_psr_sink_crc.c | 5 +++--
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index ff668d4..a6c5ba6 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -386,9 +386,10 @@ void igt_drop_root(void)
* inspection of the display is useful. Or when running a testcase in the
* background.
*/
-void igt_debug_wait_for_keypress(const char *var)
+char igt_debug_wait_for_keypress(const char *var, const char *msg)
{
struct termios oldt, newt;
+ char key;
if (!isatty(STDIN_FILENO))
return;
@@ -400,14 +401,16 @@ void igt_debug_wait_for_keypress(const char *var)
!strstr(igt_interactive_debug, "all"))
return;
- igt_info("Press any key to continue ...\n");
+ igt_info(msg);
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~ICANON;
tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
- getchar();
+ key = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
+
+ return key;
}
#define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 59022cd..158e4c5 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -60,7 +60,7 @@ void igt_system_suspend_autoresume(void);
/* dropping priviledges */
void igt_drop_root(void);
-void igt_debug_wait_for_keypress(const char *var);
+char igt_debug_wait_for_keypress(const char *var, const char *msg);
enum igt_runtime_pm_status {
IGT_RUNTIME_PM_STATUS_ACTIVE,
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 1387d01..5c7b2c7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1561,7 +1561,8 @@ static int do_display_commit(igt_display_t *display,
LOG_UNINDENT(display);
- igt_debug_wait_for_keypress("modeset");
+ igt_debug_wait_for_keypress("modeset",
+ "Press any key to continue ...\n");
return 0;
}
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index e7a2ef4..8103ebb 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -256,7 +256,7 @@ static void get_sink_crc(data_t *data, char *crc) {
fclose(file);
igt_debug("%s\n", crc);
- igt_debug_wait_for_keypress("crc");
+ igt_debug_wait_for_keypress("crc", "Press any key to continue ...\n");
/* The important value was already taken.
* Now give a time for human eyes
@@ -305,7 +305,8 @@ static void assert_or_manual(bool condition, const char *expected)
igt_info("Is %s?\n", expected);
else
igt_debug("%s\n", expected);
- igt_debug_wait_for_keypress("manual");
+ igt_debug_wait_for_keypress("manual",
+ "Press any key to continue ...\n");
igt_assert(igt_interactive_debug || condition);
}
--
1.9.3
More information about the Intel-gfx
mailing list