A minor debug message is now removed from the attached patch.
On Mon, 2009-02-02 at 11:36 +0000, Debian Bug Tracking System wrote: > Thank you for the additional information you have supplied regarding > this Bug report. > > This is an automatically generated reply to let you know your message > has been received. > > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > > Your message has been sent to the package maintainer(s): > Splashy Devel <splashy-de...@lists.alioth.debian.org> > > If you wish to submit further information on this problem, please > send it to 487...@bugs.debian.org, as before. > > Please do not send mail to ow...@bugs.debian.org unless you wish > to report a problem with the Bug-tracking system. > > -- Tim Richardson t...@tim-richardson.net Skype: te.richardson Mobile: +61 458998541 Melbourne, Australia.
--- a/src/splashycnf.h +++ b/src/splashycnf.h @@ -42,6 +42,7 @@ #define SPL_THEME_CONFIG_FILE_NAME "theme.xml" /** xpaths for common xml strings in config files */ #define SPL_AUTO_VERBOSE_ON_ERROR "/splashy/autoverboseonerror" +#define SPL_TEXTBOX_ENABLED "/splashy/textbox/enable" #define SPL_CURRENT_THEME "/splashy/current_theme" #define SPL_DEFAULT_THEME "/splashy/default_theme" #define SPL_THEMES_DIR "/splashy/themes" --- a/src/splashy_functions.c +++ b/src/splashy_functions.c @@ -89,10 +89,9 @@ * * * * * to true at cmd_exit() */ static gboolean read_console = FALSE; /* flag to turn on/off reading the * /dev/vcs* files */ -static gboolean switched_to_verbose = FALSE; /* flag to know when verbose - * image is displayed */ static gboolean F2_toggle_pressed = FALSE; /* keeps track of the depress * F2 key */ + static gint timeout = 120; /* time out when reading from splashy socket * (in seconds). If splashy doesn't recvmsg * for this long, splashy will exit. */ @@ -663,6 +662,7 @@ } + inline void _switch_to_verbose_image () { @@ -678,250 +678,7 @@ splashy_change_splash (background); } -/** - * When autoverboseonerror is set we show the scrolling - * text from the consoles /dev/vcs* - * @param data - not used - * @return - * - * TODO - * - make use of real console - * - this is a slow function - */ -inline void * -verbose_text_loop (void *data) -{ - FILE *dev_vcs; - char buf[81]; - GString *buf_str; /* what to display */ - GString *device; /* /dev/vcs to read */ - gshort i, j; - const gchar *error_pattern; - - gboolean found_error; - gboolean autoverbose; - struct timespec _sleep; - - dev_vcs = NULL; - switched_to_verbose = FALSE; /* verbose image flag */ - splashy_set_textbox_area_visible (FALSE); - - autoverbose = FALSE; /* assume we don't need verbose mode for now */ - read_console = TRUE; /* assume we will be able to read from a - * console */ - found_error = FALSE; /* we have not found any errors yet */ - error_pattern = "(FATAL|fail|error|abort|===|recovering journal)"; - - _sleep.tv_sec = 1; - _sleep.tv_nsec = 0; - device = g_string_new (""); - - /* - * get autoverboseonerror from config file and set autoverbose - * accordingly - */ - if (g_ascii_strncasecmp - (splashy_get_config_string (SPL_AUTO_VERBOSE_ON_ERROR), "yes", - 3) == 0) - autoverbose = TRUE; - - /* - * set the cancellation parameters -- - Enable thread cancellation - - * Defer the action of the cancellation - */ - pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL); - - while (1) - { - if (exiting || read_console == FALSE) - { - DEBUG_PRINT ("Not reading console at all..."); - /* - * this thread shouldn't be holding a lock on this - * but... - */ - sched_yield (); - nanosleep (&_sleep, NULL); - continue; - } - /* - * read the realcons console and look for error patterns - * on error, set our background image accordingly and display - * text printing 1 line (80 char) at a time - */ - /* - * Ubuntu uses /dev/vcs2, every other distro /dev/vcs1 - */ - for (i = 1; i <= 7; i++) - { - g_string_printf (device, "/dev/vcs%d", i); - if (!g_file_test (device->str, G_FILE_TEST_EXISTS)) - { - sched_yield (); - continue; - } - dev_vcs = g_fopen (device->str, "r"); - if (!dev_vcs) - { - DEBUG_PRINT ("Can't open %s for reading", - device->str); - sched_yield (); - /* - * short wait - */ - _sleep.tv_sec = 0; - /* - * 1/2 second - */ - _sleep.tv_nsec = 459999999; - nanosleep (&_sleep, NULL); - continue; - } - while (fgets_unlocked (buf, 81, dev_vcs)) - { - if (strlen (buf) < 8) - continue; - /* - * we need to find where the spaces end - */ - for (j = 0; j < strlen (buf); j++) - { - if (buf[j] != ' ') - { - break; - } - } - - /* - * copy only the characters now (no leading spaces) - */ - - buf_str = g_string_new (""); - for (; j < strlen (buf); j++) - { - g_string_append_c (buf_str, buf[j]); - } - - /* - * we don't need to print blank lines or new-lines - */ - /* - * if (strlen(buf) < 8) - */ - if (search_pattern_str - ("[^a-zA-Z0-9]", buf_str->str, - 0) == FALSE) - { - - g_string_free (buf_str, TRUE); - continue; - } - - /* - * look for error messages only if we weren't asked - * to display text right the way - */ - if (splashy_get_textbox_area_visible () != - TRUE) - { - /* - * we only look for errors if autoverbose - * is set to TRUE - * once an error is found, we keep printing - * the text to the textbox area without - * matching any more errors - */ - - if (found_error == FALSE) - { - if (autoverbose == TRUE) - { - found_error = - search_pattern_str - (error_pattern, - buf, 1); - } - - /* - * when the user presses F2 - * we want to show the buffer - * in the textbox anyway. - * regardless of whether an - * error was found or not - */ - if (F2_toggle_pressed != TRUE) - { - g_string_free - (buf_str, - TRUE); - continue; - } - } - else - { - /* - * error was found, we need to display the error image - * and allow the textbox area to be shown - */ - found_error = TRUE; - splashy_set_textbox_area_visible - (TRUE); - - if (autoverbose == TRUE - && switched_to_verbose == - FALSE) - { - _switch_to_verbose_image - (); - switched_to_verbose = - TRUE; - /* - * fake F2 pressed so that users can press - * this key to turn off the textbox area - */ - F2_toggle_pressed = - TRUE; - } - } - } - - /* - * pressing F2 will cause text to be printed to the textbox - * as well as having autoverbose set to ON in the config.xml - */ - if (autoverbose == TRUE - || F2_toggle_pressed == TRUE) - { - if (!exiting) - splashy_printline_s ((char *) - buf_str-> - str); - - sched_yield (); - - for (j = 0; j < 81; j++) - { - buf[j] = '\0'; /* make it - * all NULs */ - } - - /* - * wait for 1/6 seconds - */ - _sleep.tv_sec = 0; - _sleep.tv_nsec = 114999999; - nanosleep (&_sleep, NULL); - } - g_string_free (buf_str, TRUE); - } - fclose (dev_vcs); - } - } - g_string_free (device, TRUE); /* never reached */ - pthread_exit (NULL); /* never reached */ -} inline void * socket_loop (void *data) { @@ -1112,6 +869,23 @@ pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL); + /* check if we should show the verbose text by default */ + /* for important initialisation code, see also start_text_area () + * in splashy_video.c; + */ + + if ( g_ascii_strncasecmp + (splashy_get_config_string (SPL_TEXTBOX_ENABLED), "yes", + 3) == 0) + { + splashy_set_textbox_area_visible (TRUE); + F2_toggle_pressed = TRUE; /* the next F2 will turn off text */ + + } else + { + F2_toggle_pressed = FALSE; + splashy_set_textbox_area_visible (FALSE); + } while (1) { if (exiting) @@ -1122,6 +896,8 @@ /* * sub-parent (we are a fork after all). init is our parent */ + + /* Wait for keyboard input or getstring/getpass */ splashy_wait_for_event (); /* seize the keyboard, blocking if getstring/getpass running */ @@ -1200,21 +976,15 @@ _splashy_child (const gchar * seq) { gint i; /* general purpose counter */ - gint thr_id_c, thr_id_d; /* thread ID for the newly * created - * thread: c - keyboard events d - - * SplashyClient handler */ + gint thr_id_c, thr_id_d; /* thread ID for the newly * created + * thread: c - keyboard events d - + * SplashyClient handler + * thread: f verbose text loop + */ pthread_t p_thread_c, p_thread_d; /* we need thread C and D to * manage our keyboard events - * * * and SplashyClient */ + * and SplashyClient */ - /* - * gint thr_id_f; * Handles /dev/vcs1 text to be displayed to * - * splashy overlay textbox ... when pressing * F2 we launch a thread - * to handle the * console text - */ - /* - * pthread_t p_thread_f; - */ gboolean _preview = FALSE; @@ -1271,7 +1041,7 @@ close (i); } - if ((ret = splashy_start_splash ()) < 0) + if ((ret = splashy_start_splash ()) < 0) /* in splashy_video.c */ { ERROR_PRINT ("Couldn't splashy_start_splashy(). Error %d\n", ret); @@ -1279,15 +1049,13 @@ } else { - /* send a SIGUSR2 signal to parent process. This signal lets the parent process exit so that init can continue */ - /* stalling init until this point is necessary to avoid the race condition causing bug 505270 */ - /* the signal handler is defined in splashy_main.c */ + /* send a SIGUSR2 signal to parent process. This signal lets the parent process + * exit so that init can continue. Until this signal is sent, the parent waits, stalling the boot. + * Stalling init until this point is necessary to avoid the race condition which caused bug #505270 + * the signal handler is defined in splashy_main.c + */ - /***** for testing ***** - * ERROR_PRINT("deliberate failure for testing purposes"); - * g_usleep(2000000); - *****/ pid_t parentID = getppid(); kill(parentID,SIGUSR2); @@ -1311,11 +1079,6 @@ thr_id_d = pthread_create (&p_thread_d, NULL, keyevent_loop, NULL); /* - * thr_id_f = pthread_create (&p_thread_f, NULL, verbose_text_loop, - * NULL); - */ - - /* * Wait till thread is finished reading the socket... ie 'forever' */ pthread_join (p_thread_c, NULL); --- a/src/xml_functions.h +++ b/src/xml_functions.h @@ -119,7 +119,8 @@ guint textfont_blue; guint textfont_alpha; - gchar *verbose; + gchar *verbose_error; + gchar *verbose_start; gchar *fadein; gchar *fadeout; } XmlFields; --- a/src/splashy_video.c +++ b/src/splashy_video.c @@ -93,7 +93,7 @@ static gboolean _draw_progressbar_forward = TRUE; static gboolean _show_progressbar = FALSE; -static int _show_textbox_area = 0; /* flag to toggle showing * +static gboolean _show_textbox_area = FALSE; /* flag to toggle showing * * textbox area. @see * splashy_function::keyevent_loop() */ @@ -137,27 +137,34 @@ } void -splashy_set_textbox_area_visible (int visible) +splashy_set_textbox_area_visible (gboolean visible) { - _show_textbox_area = visible; + /* _show_textbox_area = visible; */ /* wait to see what actually happens */ /* * users expect to see something happen as soon * as F2 is pressed. Let's give'm a show for their * money! */ - if (visible && video.textbox) /* close #473230 thanks John Hughes */ + + _show_textbox_area = FALSE; + if (visible) { + if (video.textbox != NULL) /* #473230 thanks John Hughes if the text box objects don't exist avoid crash */ + { video.textbox->offscreen->Blit (video.textbox->surface, - video.textbox->offscreen, - NULL, 0, 0); + video.textbox->offscreen, + NULL, 0, 0); + _show_textbox_area = TRUE; + } } else { _clear_offscreen (); + _show_textbox_area = FALSE; } } -int +gboolean splashy_get_textbox_area_visible (void) { return _show_textbox_area; @@ -976,19 +983,23 @@ gint red, green, blue; /* alpha; */ gint temp; DFBSurfaceDescription desc; - - - /* - * Check if there will be a text area. + /* TODO autoverboseonerror implies /splashy/textbox/enable="yes" */ - /* - * TODO autoverboseonerror implies /splashy/textbox/enable="yes" + /* bug #473230: the textbox needs to be always initialised + * because /splashy/textbox/enable="yes" ow means show text box by default. + * It does not mean "never show the textbox". + * a setting of "no" should still allow the textbox to appear if F2 is pressed. + * So to allow for this, the textbox needs to be created. + * In other words, it is mandatory for a theme to support a textbox. */ + + /* const gchar *enable = splashy_get_config_string ("/splashy/textbox/enable"); if (g_ascii_strncasecmp (enable, "yes", 3) != 0) return; + */ _get_screen_size (&screen_width, &screen_height); _get_divider (÷r_w, ÷r_h); @@ -1123,8 +1134,14 @@ * - linux_input := we loose input from keyboard on dfb 0.9.25 * - radeon := we use fbdev on Linux */ - DirectFBSetOption ("quiet", NULL); + +#ifdef DEBUG + DirectFBSetOption ("debug", NULL); +#else + DirectFBSetOption ("quiet", NULL);\ DirectFBSetOption ("no-debug", NULL); +#endif + DirectFBSetOption ("graphics-vt", NULL); DirectFBSetOption ("no-cursor", NULL); /* @@ -1455,6 +1472,7 @@ void splashy_printline (const char *string) { + char *sp = NULL, *tok, *str; DFBRectangle rect; int x, y, ls; --- a/doc/splashy-theme.xml.pod +++ b/doc/splashy-theme.xml.pod @@ -232,9 +232,8 @@ <height>0</height> </background> <textbox> - <!-- whether you want the textbox enabled. - If no, the F2 key does nothing - see autoverboseonerror --> + <!-- whether you want the textbox enabled automatically on start. + The F2 key toggles the text box--> <enable>yes</enable> <!-- here are tags to set the text area... x coordinate, y coordinate, width and height are for the text area. @@ -276,6 +275,7 @@ <alpha>255</alpha> </text> </textbox> + <!-- autoverboseonerror is not implemented and does nothing --> <autoverboseonerror>yes</autoverboseonerror> <progressbaronboot>yes</progressbaronboot> <progressbaronshutdown>yes</progressbaronshutdown> --- a/src/splashy_main.c +++ b/src/splashy_main.c @@ -52,17 +52,17 @@ switch( sig ) { case SIGCHLD: g_printerr ("Splashy boot: splashy setup via child process failed (SIGCHLD received). Exiting..."); - break; + break; case SIGUSR2: g_printerr ("Splashy boot: splashy setup succeeded (SIGUSR2 received)."); - break; + break; default: g_printerr ("Splashy boot: Unexpected signal received."); - break; + break; } DEBUG_PRINT ("Splashy boot caught signal number %d. Exiting...", sig); - + exit(0); return; /* we never reach this */ } --- a/doc/splashy_config.pod +++ b/doc/splashy_config.pod @@ -182,7 +182,7 @@ =item B<--textbox-show> yes|no -Set a text box +Automatically start with a text box with boot messages (key F2 toggles this) =item B<--textbox-x> X-POS @@ -260,9 +260,9 @@ Set the ALPHA channel of the text area font (0->255) -=item B<--autoverbose> yes|no +=item B<--autoverbose-on-error> yes|no -Set if Splashy turn into verbose mode when an error appears at boot +Set to make Splashy turn into verbose mode when an error appears at boot. Not implemented =item B<--progressbar-visibility-boot> yes|no --- a/src/splashy_config-main.c +++ b/src/splashy_config-main.c @@ -127,7 +127,7 @@ {"text-font-green", required_argument, 0, 'O'}, {"text-font-blue", required_argument, 0, 'P'}, {"text-font-alpha", required_argument, 0, 'Q'}, - {"autoverbose", required_argument, 0, 'R'}, + {"autoverbose-on-error", required_argument, 0, 'R'}, {"fadein", required_argument, 0, 'U'}, {"fadeout", required_argument, 0, 'V'}, {"progressbar-background-red", required_argument, 0, 'W'}, @@ -383,7 +383,7 @@ g_strtod (optarg, 0); break; case 'R': - inline_theme->verbose = + inline_theme->verbose_error = g_strdup (optarg); break; case 'U': @@ -483,8 +483,8 @@ g_free (inline_theme->textbox_border_show); if (inline_theme->textfont_file) g_free (inline_theme->textfont_file); - if (inline_theme->verbose) - g_free (inline_theme->verbose); + if (inline_theme->verbose_error) + g_free (inline_theme->verbose_error); if (inline_theme->fadein) g_free (inline_theme->fadein); if (inline_theme->fadeout) --- a/src/splashy_config-functions.c +++ b/src/splashy_config-functions.c @@ -794,6 +794,7 @@ { XmlFields *NewTheme = g_new0 (XmlFields, 1); gboolean use_pixel_units = FALSE; + gboolean repeat_question = FALSE; /* provide feedback about failed input */ check_fields (NewTheme); @@ -806,9 +807,16 @@ NewTheme->name = NULL; } ask_string (_("* Name"), &NewTheme->name); + if (theme_name_exists (NewTheme->name) ) + { + repeat_question = TRUE; + g_print("%s\n", "this theme name exists, try another"); + } + else repeat_question = FALSE; } - while (theme_name_exists (NewTheme->name) == TRUE); + while (repeat_question); + repeat_question = FALSE; // Boot image do { @@ -818,8 +826,15 @@ NewTheme->bg_boot = NULL; } ask_string (_("* Boot image"), &NewTheme->bg_boot); + if (check_image (NewTheme->bg_boot) != 0) + { + repeat_question = TRUE; + g_print("%s\n", "Error: Not an accepted image format, or can't find that file. Use full path, or check that it is in the current directory."); + } + else repeat_question = FALSE; } - while (check_image (NewTheme->bg_boot) != 0); + while (repeat_question); + repeat_question = FALSE; /* not logically needed, just being safe */ // Shutdown image do @@ -830,8 +845,15 @@ NewTheme->bg_shutdown = NULL; } ask_string (_("* Shutdown image"), &NewTheme->bg_shutdown); + if (check_image (NewTheme->bg_shutdown) != 0) + { + repeat_question = TRUE; + g_print("%s\n", "Error: Not an accepted image format, or can't find that file. Use full path, or check that it is in the current directory."); + } + else repeat_question = FALSE; } - while (check_image (NewTheme->bg_shutdown) != 0); + while (repeat_question); + repeat_question = FALSE; /* not logically needed, just being safe */ // Error image do @@ -842,8 +864,15 @@ NewTheme->bg_error = NULL; } ask_string (_("* Error image"), &NewTheme->bg_error); + if (check_image (NewTheme->bg_error) != 0) + { + repeat_question = TRUE; + g_print("%s\n", "Error: Not an accepted image format, or can't find that file. Use full path, or check that it is in the current directory."); + } + else repeat_question = FALSE; } - while (check_image (NewTheme->bg_error) != 0); + while (repeat_question); + repeat_question = FALSE; /* not logically needed, just being safe */ // Resume image do @@ -854,8 +883,15 @@ NewTheme->bg_resume = NULL; } ask_string (_("* Resume image"), &NewTheme->bg_resume); + if (check_image (NewTheme->bg_resume) != 0) + { + repeat_question = TRUE; + g_print("%s\n", "Error: Not an accepted image format, or can't find that file. Use full path, or check that it is in the current directory."); + } + else repeat_question = FALSE; } - while (check_image (NewTheme->bg_resume) != 0); + while (repeat_question); + repeat_question = FALSE; /* not logically needed, just being safe */ // Suspend image do @@ -866,8 +902,15 @@ NewTheme->bg_suspend = NULL; } ask_string (_("* Suspend image"), &NewTheme->bg_suspend); + if (check_image (NewTheme->bg_suspend) != 0) + { + repeat_question = TRUE; + g_print("%s\n", "Error: Not an accepted image format, or can't find that file. Use full path, or check that it is in the current directory."); + } + else repeat_question = FALSE; } - while (check_image (NewTheme->bg_suspend) != 0); + while (repeat_question); + repeat_question = FALSE; /* not logically needed, just being safe */ // Ask if the height & width of the background must be set gchar *resolution = "no"; @@ -1056,16 +1099,17 @@ } // if progressbar // Auto verbose - ask_string (_("Pass in verbose mode on error? (yes|no)"), - &NewTheme->verbose); + ask_string (_("Pass in verbose mode on error (not implemented)? (yes|no)"), + &NewTheme->verbose_error); + // Text box or not - ask_string (_("Do you want to see a text box? (yes|no)"), + ask_string (_("Do you want to see a text box by default? (yes|no)"), &NewTheme->textbox_show); // Text box - if ((g_strcasecmp (NewTheme->verbose, "yes") == 0) - || (g_strcasecmp (NewTheme->textbox_show, "yes") == 0)) + if ((g_strcasecmp (NewTheme->verbose_error, "yes") == 0) + || (g_strcasecmp (NewTheme->textbox_show, "yes") == 0)) { g_print (_("Text box\n")); @@ -1584,11 +1628,11 @@ CheckMe->textfont_alpha = 255; // Autoverbose on error ? - if (CheckMe->verbose == NULL - || (g_strcasecmp (CheckMe->verbose, "yes") != 0 - && g_strcasecmp (CheckMe->verbose, "no"))) + if (CheckMe->verbose_error == NULL + || (g_strcasecmp (CheckMe->verbose_error, "yes") != 0 + && g_strcasecmp (CheckMe->verbose_error, "no"))) { - CheckMe->verbose = g_strdup ("no"); + CheckMe->verbose_error = g_strdup ("no"); } // Progressbar on boot ? --- a/src/xml_functions.c +++ b/src/xml_functions.c @@ -118,7 +118,7 @@ spl_theme->textfont_green, spl_theme->textfont_blue, spl_theme->textfont_alpha, - spl_theme->verbose, + spl_theme->verbose_error, spl_theme->fadein, spl_theme->fadeout ); --- a/src/xml_format.h.in +++ b/src/xml_format.h.in @@ -17,6 +17,8 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ + +/* this file is used to create xml_format.h so modify this, not xml_format.h */ #ifndef _XML_FORMAT_H #define _XML_FORMAT_H --- a/src/splashy.h +++ b/src/splashy.h @@ -64,12 +64,12 @@ * toggles whether the textbox area will be shown for * splashy_printline_s() */ -void splashy_set_textbox_area_visible (int visible); +void splashy_set_textbox_area_visible (gboolean visible); /* * returns the status of the textbox area visibility flag */ -int splashy_get_textbox_area_visible (void); +gboolean splashy_get_textbox_area_visible (void); /* * allows to print a single message to the center of the textbox area --- a/themes/default/theme.xml +++ b/themes/default/theme.xml @@ -81,9 +81,8 @@ </dimension> </background> <textbox> - <!-- whether you want the textbox enabled. - If no, the F2 key does nothing - see autoverboseonerror --> + <!-- whether you want the textbox enabled automatically at start. + The F2 key toggles the textbox --> <enable>yes</enable> <!-- here are tags to set the text area... x coordinate, y coordinate, width and height are for the text area. @@ -131,6 +130,7 @@ </color> </text> </textbox> + <!-- autoverboseonerror is not enabled --> <autoverboseonerror>no</autoverboseonerror> <fadein>no</fadein> <fadeout>no</fadeout>
signature.asc
Description: This is a digitally signed message part