]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[client] add "has active vt?" request
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 21:10:52 +0000 (21:10 +0000)
committerRay Strode <rstrode@redhat.com>
Mon, 22 Mar 2010 03:23:39 +0000 (23:23 -0400)
This asks the daemon whether it has an active VT, used for a smooth
transition into X.

I've implemented this to look like ping.

src/client/ply-boot-client.c
src/client/ply-boot-client.h
src/client/plymouth.c

index 58c5e44d9a3d44dfa7c73da276425a9869a2bd99..c3373f0efc3fab8974d3e2860935dac3cced1b66 100644 (file)
@@ -722,6 +722,16 @@ ply_boot_client_tell_daemon_to_progress_unpause (ply_boot_client_t
                                  NULL, handler, failed_handler, user_data);
 }
 
+void
+ply_boot_client_ask_daemon_has_active_vt (ply_boot_client_t                  *client,
+                                          ply_boot_client_response_handler_t  handler,
+                                          ply_boot_client_response_handler_t  failed_handler,
+                                          void                               *user_data)
+{
+  ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HAS_ACTIVE_VT,
+                                 NULL, handler, failed_handler, user_data);
+}
+
 void
 ply_boot_client_tell_daemon_about_error (ply_boot_client_t                  *client,
                                          ply_boot_client_response_handler_t  handler,
index 046b6f75778f5f92e69a986c2ad419e68aeed83a..1608876124e0f605df831f1517df9debba781b31 100644 (file)
@@ -125,6 +125,10 @@ void ply_boot_client_tell_daemon_to_progress_unpause (ply_boot_client_t
                                                       ply_boot_client_response_handler_t  handler,
                                                       ply_boot_client_response_handler_t  failed_handler,
                                                       void                               *user_data);
+void ply_boot_client_ask_daemon_has_active_vt (ply_boot_client_t                  *client,
+                                               ply_boot_client_response_handler_t  handler,
+                                               ply_boot_client_response_handler_t  failed_handler,
+                                               void                               *user_data);
 void ply_boot_client_disconnect (ply_boot_client_t *client);
 void ply_boot_client_attach_to_event_loop (ply_boot_client_t *client,
                                            ply_event_loop_t  *loop);
index 5dffba818ce0e7f0559b2075d4d7cdda8f7686b0..d3920070b0d4dbbee99456dc8246b88f2b140e27 100644 (file)
@@ -740,7 +740,7 @@ main (int    argc,
       char **argv)
 {
   state_t state = { 0 };
-  bool should_help, should_quit, should_ping, should_sysinit, should_ask_for_password, should_show_splash, should_hide_splash, should_wait, should_be_verbose, report_error, should_get_plugin_path;
+  bool should_help, should_quit, should_ping, should_check_for_active_vt, should_sysinit, should_ask_for_password, should_show_splash, should_hide_splash, should_wait, should_be_verbose, report_error, should_get_plugin_path;
   bool is_connected;
   char *status, *chroot_dir, *ignore_keystroke;
   int exit_code;
@@ -760,6 +760,7 @@ main (int    argc,
                                   "newroot", "Tell boot daemon that new root filesystem is mounted", PLY_COMMAND_OPTION_TYPE_STRING,
                                   "quit", "Tell boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "ping", "Check of boot daemon is running", PLY_COMMAND_OPTION_TYPE_FLAG,
+                                  "has-active-vt", "Check if boot daemon has an active vt", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "sysinit", "Tell boot daemon root filesystem is mounted read-write", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "show-splash", "Show splash screen", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "hide-splash", "Hide splash screen", PLY_COMMAND_OPTION_TYPE_FLAG,
@@ -868,6 +869,7 @@ main (int    argc,
                                   "newroot", &chroot_dir,
                                   "quit", &should_quit,
                                   "ping", &should_ping,
+                                  "has-active-vt", &should_check_for_active_vt,
                                   "sysinit", &should_sysinit,
                                   "show-splash", &should_show_splash,
                                   "hide-splash", &should_hide_splash,
@@ -921,6 +923,11 @@ main (int    argc,
           ply_trace ("ping failed");
           return 1;
         }
+      if (should_check_for_active_vt)
+        {
+          ply_trace ("has active vt? failed");
+          return 1;
+        }
     }
 
   ply_boot_client_attach_to_event_loop (state.client, state.loop);
@@ -950,6 +957,12 @@ main (int    argc,
                                  on_success, 
                                  (ply_boot_client_response_handler_t)
                                  on_failure, &state);
+  else if (should_check_for_active_vt)
+    ply_boot_client_ask_daemon_has_active_vt (state.client,
+                                              (ply_boot_client_response_handler_t)
+                                              on_success,
+                                              (ply_boot_client_response_handler_t)
+                                              on_failure, &state);
   else if (status != NULL)
     ply_boot_client_update_daemon (state.client, status,
                                    (ply_boot_client_response_handler_t)