Description: Undocumented changes This patch contains undocumented changes accumulated during previous versions of the Ubuntu plymouth package, that have not yet been split up into individually-documented patches. Please try not to add further things to this patch. Using quilt for new changes is recommended, but if you don't, they'll end up in a separate debian-changes patch at the end of the patch series. Last-Update: 2011-01-21 Index: trunk/src/main.c =================================================================== --- trunk.orig/src/main.c +++ trunk/src/main.c @@ -116,6 +116,7 @@ const char *default_tty; int number_of_errors; + ply_list_t *pending_messages; } state_t; static ply_boot_splash_t *start_boot_splash (state_t *state, @@ -164,14 +165,34 @@ const char *status) { ply_trace ("updating status to '%s'", status); - ply_progress_status_update (state->progress, - status); + if (strncmp (status, "fsck:", 5)) + ply_progress_status_update (state->progress, + status); if (state->boot_splash != NULL) ply_boot_splash_update_status (state->boot_splash, status); } static void +flush_pending_messages (state_t *state) +{ + ply_list_node_t *node = ply_list_get_first_node (state->pending_messages); + while (node != NULL) + { + ply_list_node_t *next_node; + char *message = ply_list_node_get_data (node); + + ply_trace ("displaying queued message"); + + ply_boot_splash_display_message (state->boot_splash, message); + next_node = ply_list_get_next_node (state->pending_messages, node); + ply_list_remove_node (state->pending_messages, node); + free(message); + node = next_node; + } +} + +static void show_detailed_splash (state_t *state) { if (state->boot_splash != NULL) @@ -319,11 +340,15 @@ ply_trace ("Could not start default splash screen," "showing text splash screen"); state->boot_splash = start_boot_splash (state, - PLYMOUTH_THEME_PATH "text/text.plymouth"); + PLYMOUTH_THEME_PATH "text.plymouth"); } if (state->boot_splash == NULL) - ply_error ("could not start boot splash: %m"); + { + if (errno != ENOENT) + ply_error ("could not start boot splash: %m"); + show_detailed_splash (state); + } } static void @@ -374,6 +399,8 @@ ply_trace ("displaying message %s", message); if (state->boot_splash != NULL) ply_boot_splash_display_message (state->boot_splash, message); + else + ply_list_append_data (state->pending_messages, strdup(message)); } static void @@ -720,6 +747,7 @@ show_detailed_splash (state); state->showing_details = true; } + flush_pending_messages (state); } static void @@ -1259,6 +1287,10 @@ state->terminal = ply_terminal_new (tty_name); + // urgh + if (!ply_terminal_open (state->terminal)) + return; + keyboard = ply_keyboard_new_for_terminal (state->terminal); display = ply_text_display_new (state->terminal); @@ -1674,6 +1706,7 @@ state->entry_buffer = ply_buffer_new(); state->pixel_displays = ply_list_new (); state->text_displays = ply_list_new (); + state->pending_messages = ply_list_new (); state->keyboard = NULL; if (!state->default_tty) @@ -1904,12 +1937,7 @@ { state.should_be_attached = attach_to_session; if (!attach_to_running_session (&state)) - { - ply_error ("could not create session: %m"); - if (! no_daemon) - ply_detach_daemon (daemon_handle, EX_UNAVAILABLE); - return EX_UNAVAILABLE; - } + ply_trace ("could not create session: %m"); } state.boot_server = start_boot_server (&state); Index: trunk/src/plugins/splash/details/plugin.c =================================================================== --- trunk.orig/src/plugins/splash/details/plugin.c +++ trunk/src/plugins/splash/details/plugin.c @@ -73,6 +73,7 @@ ply_boot_splash_mode_t mode; ply_list_t *views; ply_boot_splash_display_type_t state; + ply_list_t *messages; }; @@ -120,6 +121,31 @@ plugin->views = NULL; } +static void +free_messages (ply_boot_splash_plugin_t *plugin) +{ + ply_list_node_t *node; + + node = ply_list_get_first_node (plugin->messages); + + while (node != NULL) + { + ply_list_node_t *next_node; + char *message; + + message = ply_list_node_get_data (node); + next_node = ply_list_get_next_node (plugin->messages, node); + + free (message); + ply_list_remove_node (plugin->messages, node); + + node = next_node; + } + + ply_list_free (plugin->messages); + plugin->messages = NULL; +} + static ply_boot_splash_plugin_t * create_plugin (ply_key_file_t *key_file) { @@ -130,6 +156,7 @@ plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); plugin->views = ply_list_new (); plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; + plugin->messages = ply_list_new (); return plugin; } @@ -141,6 +168,7 @@ if (plugin == NULL) return; + free_messages (plugin); free_views (plugin); free (plugin); @@ -203,7 +231,10 @@ terminal = ply_text_display_get_terminal (view->display); if (ply_terminal_open (terminal)) - ply_terminal_activate_vt (terminal); + { + ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT); + ply_terminal_activate_vt (terminal); + } ply_list_append_data (plugin->views, view); } @@ -294,10 +325,28 @@ static void display_normal (ply_boot_splash_plugin_t *plugin) { + ply_list_node_t *node; + if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL) write_on_views (plugin, "\r\n", strlen ("\r\n")); plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; + + node = ply_list_get_first_node (plugin->messages); + while (node != NULL) + { + const char *message; + ply_list_node_t *next_node; + + message = ply_list_node_get_data (node); + next_node = ply_list_get_next_node (plugin->messages, node); + + write_on_views (plugin, message, strlen (message)); + write_on_views (plugin, "\r\n", strlen ("\r\n")); + + ply_list_remove_node (plugin->messages, node); + node = next_node; + } } /* @shorten_prompt: @@ -371,6 +420,26 @@ write_on_views (plugin, entry_text, strlen (entry_text)); } +static void +display_message (ply_boot_splash_plugin_t *plugin, + const char *message) +{ + const char *message_to_display; + + if (!strncmp (message, "keys:", strlen ("keys:"))) + message_to_display = message + strlen ("keys:"); + else + message_to_display = message; + + if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) + { + write_on_views (plugin, message_to_display, strlen (message_to_display)); + write_on_views (plugin, "\r\n", strlen ("\r\n")); + } + else + ply_list_append_data (plugin->messages, strdup (message_to_display)); +} + ply_boot_splash_plugin_interface_t * ply_boot_splash_plugin_get_interface (void) { @@ -387,6 +456,7 @@ .display_normal = display_normal, .display_password = display_password, .display_question = display_question, + .display_message = display_message, }; return &plugin_interface; Index: trunk/src/plugins/splash/script/script-lib-image.c =================================================================== --- trunk.orig/src/plugins/splash/script/script-lib-image.c +++ trunk/src/plugins/splash/script/script-lib-image.c @@ -171,7 +171,7 @@ alpha_obj = script_obj_hash_peek_element (state->local, "alpha"); - if (alpha_obj) + if (alpha_obj && !script_obj_is_null(alpha_obj)) { alpha = CLAMP(script_obj_as_number (alpha_obj), 0, 1); script_obj_unref(alpha_obj); Index: trunk/src/plugins/splash/script/script-lib-sprite.c =================================================================== --- trunk.orig/src/plugins/splash/script/script-lib-sprite.c +++ trunk/src/plugins/splash/script/script-lib-sprite.c @@ -399,6 +399,45 @@ return script_return_obj_null (); } +static script_return_t sprite_window_get_bits_per_pixel (script_state_t *state, + void *user_data) +{ + script_lib_sprite_data_t *data = user_data; + ply_list_node_t *node; + int index; + script_obj_t *index_obj; + script_lib_display_t *display; + unsigned int bits_per_pixel; + + index_obj = script_obj_hash_peek_element (state->local, "window"); + + if (index_obj) + { + index = script_obj_as_number (index_obj); + script_obj_unref(index_obj); + if (index < 0) + return script_return_obj_null (); + node = ply_list_get_nth_node (data->displays, index); + if (node == NULL) + return script_return_obj_null (); + display = ply_list_node_get_data (node); + bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display); + return script_return_obj (script_obj_new_number (bits_per_pixel)); + } + + bits_per_pixel = 0; + for (node = ply_list_get_first_node (data->displays); + node; + node = ply_list_get_next_node (data->displays, node)) + { + display = ply_list_node_get_data (node); + bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display); + if (bits_per_pixel) + break; + } + return script_return_obj (script_obj_new_number (bits_per_pixel)); +} + static uint32_t extract_rgb_color (script_state_t *state) { uint8_t red = CLAMP (255 * script_obj_hash_get_number (state->local, "red"), 0, 255); @@ -651,6 +690,12 @@ "value", NULL); script_add_native_function (window_hash, + "GetBitsPerPixel", + sprite_window_get_bits_per_pixel, + data, + "window", + NULL); + script_add_native_function (window_hash, "SetBackgroundTopColor", sprite_window_set_background_top_color, data, Index: trunk/src/plugins/splash/script/plugin.c =================================================================== --- trunk.orig/src/plugins/splash/script/plugin.c +++ trunk/src/plugins/splash/script/plugin.c @@ -418,6 +418,8 @@ become_idle (ply_boot_splash_plugin_t *plugin, ply_trigger_t *idle_trigger) { + stop_animation (plugin); + ply_trigger_pull (idle_trigger, NULL); } Index: trunk/src/plugins/splash/text/plugin.c =================================================================== --- trunk.orig/src/plugins/splash/text/plugin.c +++ trunk/src/plugins/splash/text/plugin.c @@ -485,7 +485,10 @@ terminal = ply_text_display_get_terminal (view->display); if (ply_terminal_open (terminal)) - ply_terminal_activate_vt (terminal); + { + ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT); + ply_terminal_activate_vt (terminal); + } ply_text_display_set_draw_handler (view->display, (ply_text_display_draw_handler_t) Index: trunk/src/plugins/renderers/frame-buffer/plugin.c =================================================================== --- trunk.orig/src/plugins/renderers/frame-buffer/plugin.c +++ trunk/src/plugins/renderers/frame-buffer/plugin.c @@ -56,7 +56,7 @@ #include "ply-renderer-plugin.h" #ifndef PLY_FRAME_BUFFER_DEFAULT_FB_DEVICE_NAME -#define PLY_FRAME_BUFFER_DEFAULT_FB_DEVICE_NAME "/dev/fb" +#define PLY_FRAME_BUFFER_DEFAULT_FB_DEVICE_NAME "/dev/fb0" #endif struct _ply_renderer_head @@ -646,6 +646,16 @@ return backend->head.pixel_buffer; } +static unsigned int +get_bits_per_pixel_for_head (ply_renderer_backend_t *backend, + ply_renderer_head_t *head) +{ + if (head != &backend->head) + return 0; + + return backend->bytes_per_pixel * 8; +} + static bool has_input_source (ply_renderer_backend_t *backend, ply_renderer_input_source_t *input_source) @@ -739,6 +749,7 @@ .flush_head = flush_head, .get_heads = get_heads, .get_buffer_for_head = get_buffer_for_head, + .get_bits_per_pixel_for_head = get_bits_per_pixel_for_head, .get_input_source = get_input_source, .open_input_source = open_input_source, .set_handler_for_input_source = set_handler_for_input_source, Index: trunk/src/libply-splash-core/ply-pixel-display.h =================================================================== --- trunk.orig/src/libply-splash-core/ply-pixel-display.h +++ trunk/src/libply-splash-core/ply-pixel-display.h @@ -48,6 +48,7 @@ unsigned long ply_pixel_display_get_width (ply_pixel_display_t *display); unsigned long ply_pixel_display_get_height (ply_pixel_display_t *display); +unsigned int ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display); void ply_pixel_display_set_draw_handler (ply_pixel_display_t *display, ply_pixel_display_draw_handler_t draw_handler, Index: trunk/src/libply-splash-core/ply-renderer.c =================================================================== --- trunk.orig/src/libply-splash-core/ply-renderer.c +++ trunk/src/libply-splash-core/ply-renderer.c @@ -310,6 +310,21 @@ head); } +unsigned int +ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer, + ply_renderer_head_t *head) +{ + assert (renderer != NULL); + assert (renderer->plugin_interface != NULL); + assert (head != NULL); + + if (!renderer->plugin_interface->get_bits_per_pixel_for_head) + return 0; + + return renderer->plugin_interface->get_bits_per_pixel_for_head (renderer->backend, + head); +} + void ply_renderer_flush_head (ply_renderer_t *renderer, ply_renderer_head_t *head) Index: trunk/src/libply-splash-core/ply-renderer.h =================================================================== --- trunk.orig/src/libply-splash-core/ply-renderer.h +++ trunk/src/libply-splash-core/ply-renderer.h @@ -50,6 +50,8 @@ ply_list_t *ply_renderer_get_heads (ply_renderer_t *renderer); ply_pixel_buffer_t *ply_renderer_get_buffer_for_head (ply_renderer_t *renderer, ply_renderer_head_t *head); +unsigned int ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer, + ply_renderer_head_t *head); void ply_renderer_flush_head (ply_renderer_t *renderer, ply_renderer_head_t *head); Index: trunk/src/libply-splash-core/ply-pixel-display.c =================================================================== --- trunk.orig/src/libply-splash-core/ply-pixel-display.c +++ trunk/src/libply-splash-core/ply-pixel-display.c @@ -51,6 +51,7 @@ unsigned long width; unsigned long height; + unsigned int bits_per_pixel; ply_pixel_display_draw_handler_t draw_handler; void *draw_handler_user_data; @@ -79,6 +80,9 @@ display->width = size.width; display->height = size.height; + display->bits_per_pixel = ply_renderer_get_bits_per_pixel_for_head (renderer, + head); + return display; } @@ -94,6 +98,12 @@ return display->height; } +unsigned int +ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display) +{ + return display->bits_per_pixel; +} + static void ply_pixel_display_flush (ply_pixel_display_t *display) { Index: trunk/src/libply-splash-core/ply-renderer-plugin.h =================================================================== --- trunk.orig/src/libply-splash-core/ply-renderer-plugin.h +++ trunk/src/libply-splash-core/ply-renderer-plugin.h @@ -54,6 +54,8 @@ ply_pixel_buffer_t * (* get_buffer_for_head) (ply_renderer_backend_t *backend, ply_renderer_head_t *head); + unsigned int (* get_bits_per_pixel_for_head) (ply_renderer_backend_t *backend, + ply_renderer_head_t *head); ply_renderer_input_source_t * (* get_input_source) (ply_renderer_backend_t *backend); bool (* open_input_source) (ply_renderer_backend_t *backend, Index: trunk/src/client/ply-boot-client.c =================================================================== --- trunk.orig/src/client/ply-boot-client.c +++ trunk/src/client/ply-boot-client.c @@ -257,15 +257,32 @@ return; } - request_node = ply_list_get_first_node (client->requests_waiting_for_replies); - assert (request_node != NULL); - - request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node); - assert (request != NULL); - if (!ply_read (client->socket_fd, byte, sizeof (uint8_t))) goto out; + for (request_node = ply_list_get_first_node (client->requests_waiting_for_replies); + request_node; request_node = ply_list_get_next_node (client->requests_waiting_for_replies, request_node)) + { + assert (request_node != NULL); + request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node); + assert (request != NULL); + + if (! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD) + || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION) + || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE)) + { + if (! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t)) + || ! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t))) + break; + } + else + { + if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t)) + && memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t))) + break; + } + } + if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK, sizeof (uint8_t)) == 0) request->handler (request->user_data, client); else if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t)) == 0) @@ -743,6 +760,17 @@ } void +ply_boot_client_flush (ply_boot_client_t *client) +{ + assert (client != NULL); + + while (ply_list_get_length (client->requests_to_send) > 0) + { + ply_event_loop_process_pending_events (client->loop); + } +} + +void ply_boot_client_disconnect (ply_boot_client_t *client) { assert (client != NULL); Index: trunk/src/client/ply-boot-client.h =================================================================== --- trunk.orig/src/client/ply-boot-client.h +++ trunk/src/client/ply-boot-client.h @@ -129,6 +129,7 @@ ply_boot_client_response_handler_t handler, ply_boot_client_response_handler_t failed_handler, void *user_data); +void ply_boot_client_flush (ply_boot_client_t *client); 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);