lkml.org 
[lkml]   [2006]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 12/21] [Suspend2] Abort a cycle.
Date
Let the user know that we're aborting if they don't already know, possibly
also waiting for a keypress expressing acknowledgement.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/ui.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/kernel/power/ui.c b/kernel/power/ui.c
index 6271a24..6542f3f 100644
--- a/kernel/power/ui.c
+++ b/kernel/power/ui.c
@@ -402,3 +402,40 @@ out:
return key;
}

+/* abort_suspend
+ *
+ * Description: Begin to abort a cycle. If this wasn't at the user's request
+ * (and we're displaying output), tell the user why and wait for
+ * them to acknowledge the message.
+ * Arguments: A parameterised string (imagine this is printk) to display,
+ * telling the user why we're aborting.
+ */
+
+void abort_suspend(const char *fmt, ...)
+{
+ va_list args;
+ int printed_len = 0;
+
+ if (!test_result_state(SUSPEND_ABORTED)) {
+ if (!test_result_state(SUSPEND_ABORT_REQUESTED)) {
+ va_start(args, fmt);
+ printed_len = vsnprintf(local_printf_buf,
+ sizeof(local_printf_buf), fmt, args);
+ va_end(args);
+ if (ui_helper_data.pid != -1)
+ printed_len = sprintf(local_printf_buf + printed_len,
+ " (Press SPACE to continue)");
+ suspend_prepare_status(CLEAR_BAR, local_printf_buf);
+
+ /*
+ * Make sure message seen - wait for shift to be
+ * released if being pressed
+ */
+ if (ui_helper_data.pid != -1)
+ suspend_wait_for_keypress(0);
+ }
+ /* Turn on aborting flag */
+ set_result_state(SUSPEND_ABORTED);
+ }
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 06:53    [W:0.122 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site