All of lore.kernel.org
 help / color / mirror / Atom feed
* [psplash][PATCH] psplash: add option to read startup message from file
@ 2016-04-15  8:49 Richard Leitner
  2016-04-22  7:53 ` Richard Leitner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Leitner @ 2016-04-15  8:49 UTC (permalink / raw)
  To: yocto

This patch adds an option to read the displayed message from a file.
Additionally the maximum length for the read string can be defined.
If both, a message (STARTUP_MSG) and a file (STARTUP_MSG_FILE) are
defined the content of the file will be appended to the message.
The string will be cutted after the given maximum number of chars.

For these changes the following defines were introduced:
  PSPLASH_STARTUP_MSG_MAX_LEN ... maximum lenght of the complete message
  PSPLASH_STARTUP_MSG_FILE ...... path to the file to read

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 psplash-config.h |  5 +++++
 psplash.c        | 29 ++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/psplash-config.h b/psplash-config.h
index 82bb76d..7fa44fa 100644
--- a/psplash-config.h
+++ b/psplash-config.h
@@ -21,6 +21,11 @@
 
 /* Text to output on program start; if undefined, output nothing */
 #define PSPLASH_STARTUP_MSG ""
+#define PSPLASH_STARTUP_MSG_MAX_LEN 32
+
+/* File to read and display its first line on program start;
+ * if undefined, output nothing; if MSG is defined also, append to it */
+#define PSPLASH_STARTUP_MSG_FILE ""
 
 /* Bool indicating if the image is fullscreen, as opposed to split screen */
 #define PSPLASH_IMG_FULLSCREEN 0
diff --git a/psplash.c b/psplash.c
index 04d3d49..b7d2d28 100644
--- a/psplash.c
+++ b/psplash.c
@@ -208,6 +208,9 @@ main (int argc, char** argv)
   int        pipe_fd, i = 0, angle = 0, ret = 0;
   PSplashFB *fb;
   bool       disable_console_switch = FALSE;
+  char       msg[PSPLASH_STARTUP_MSG_MAX_LEN];
+  int        msglen;
+  FILE      *fd_msg;
   
   signal(SIGHUP, psplash_exit);
   signal(SIGINT, psplash_exit);
@@ -298,9 +301,33 @@ main (int argc, char** argv)
 
   psplash_draw_progress (fb, 0);
 
+  memset(msg, 0, PSPLASH_STARTUP_MSG_MAX_LEN);
+  msglen = 0;
 #ifdef PSPLASH_STARTUP_MSG
-  psplash_draw_msg (fb, PSPLASH_STARTUP_MSG);
+  snprintf(msg, PSPLASH_STARTUP_MSG_MAX_LEN, "%s", PSPLASH_STARTUP_MSG);
+  msglen = strlen(msg);
 #endif
+#ifdef PSPLASH_STARTUP_MSG_FILE
+  fd_msg = fopen (PSPLASH_STARTUP_MSG_FILE, "r");
+  if (fd_msg)
+    {
+      if (msglen == 0)
+        {
+          fgets (msg, PSPLASH_STARTUP_MSG_MAX_LEN, fd_msg);
+        }
+      else
+        {
+          fgets (&msg[msglen + 1], PSPLASH_STARTUP_MSG_MAX_LEN - msglen - 1, fd_msg);
+          msg[msglen] = ' ';
+        }
+      fclose (fd_msg);
+    }
+  msglen = strlen(msg);
+#endif
+
+  /* draw message if we have one */
+  if (msglen > 0)
+    psplash_draw_msg (fb, msg);
 
   psplash_main (fb, pipe_fd, 0);
 
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [psplash][PATCH] psplash: add option to read startup message from file
  2016-04-15  8:49 [psplash][PATCH] psplash: add option to read startup message from file Richard Leitner
@ 2016-04-22  7:53 ` Richard Leitner
  2016-05-25  8:02 ` Richard Leitner
  2016-08-18  7:09 ` Richard Leitner
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Leitner @ 2016-04-22  7:53 UTC (permalink / raw)
  To: yocto

Hi,
are any comments or possible improvements?
On 04/15/2016 10:49 AM, Richard Leitner wrote:
> This patch adds an option to read the displayed message from a file.
> Additionally the maximum length for the read string can be defined.
> If both, a message (STARTUP_MSG) and a file (STARTUP_MSG_FILE) are
> defined the content of the file will be appended to the message.
> The string will be cutted after the given maximum number of chars.
> 
> For these changes the following defines were introduced:
>   PSPLASH_STARTUP_MSG_MAX_LEN ... maximum lenght of the complete message
>   PSPLASH_STARTUP_MSG_FILE ...... path to the file to read

regards,
Richard


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [psplash][PATCH] psplash: add option to read startup message from file
  2016-04-15  8:49 [psplash][PATCH] psplash: add option to read startup message from file Richard Leitner
  2016-04-22  7:53 ` Richard Leitner
@ 2016-05-25  8:02 ` Richard Leitner
  2016-08-18  7:09 ` Richard Leitner
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Leitner @ 2016-05-25  8:02 UTC (permalink / raw)
  To: yocto

Any comments/updates on that patch of mine?


On 04/15/2016 10:49 AM, Richard Leitner wrote:
> This patch adds an option to read the displayed message from a file.
> Additionally the maximum length for the read string can be defined.
> If both, a message (STARTUP_MSG) and a file (STARTUP_MSG_FILE) are
> defined the content of the file will be appended to the message.
> The string will be cutted after the given maximum number of chars.
> 
> For these changes the following defines were introduced:
>   PSPLASH_STARTUP_MSG_MAX_LEN ... maximum lenght of the complete message
>   PSPLASH_STARTUP_MSG_FILE ...... path to the file to read
> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
>  psplash-config.h |  5 +++++
>  psplash.c        | 29 ++++++++++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/psplash-config.h b/psplash-config.h
> index 82bb76d..7fa44fa 100644
> --- a/psplash-config.h
> +++ b/psplash-config.h
> @@ -21,6 +21,11 @@
>  
>  /* Text to output on program start; if undefined, output nothing */
>  #define PSPLASH_STARTUP_MSG ""
> +#define PSPLASH_STARTUP_MSG_MAX_LEN 32
> +
> +/* File to read and display its first line on program start;
> + * if undefined, output nothing; if MSG is defined also, append to it */
> +#define PSPLASH_STARTUP_MSG_FILE ""
>  
>  /* Bool indicating if the image is fullscreen, as opposed to split screen */
>  #define PSPLASH_IMG_FULLSCREEN 0
> diff --git a/psplash.c b/psplash.c
> index 04d3d49..b7d2d28 100644
> --- a/psplash.c
> +++ b/psplash.c
> @@ -208,6 +208,9 @@ main (int argc, char** argv)
>    int        pipe_fd, i = 0, angle = 0, ret = 0;
>    PSplashFB *fb;
>    bool       disable_console_switch = FALSE;
> +  char       msg[PSPLASH_STARTUP_MSG_MAX_LEN];
> +  int        msglen;
> +  FILE      *fd_msg;
>    
>    signal(SIGHUP, psplash_exit);
>    signal(SIGINT, psplash_exit);
> @@ -298,9 +301,33 @@ main (int argc, char** argv)
>  
>    psplash_draw_progress (fb, 0);
>  
> +  memset(msg, 0, PSPLASH_STARTUP_MSG_MAX_LEN);
> +  msglen = 0;
>  #ifdef PSPLASH_STARTUP_MSG
> -  psplash_draw_msg (fb, PSPLASH_STARTUP_MSG);
> +  snprintf(msg, PSPLASH_STARTUP_MSG_MAX_LEN, "%s", PSPLASH_STARTUP_MSG);
> +  msglen = strlen(msg);
>  #endif
> +#ifdef PSPLASH_STARTUP_MSG_FILE
> +  fd_msg = fopen (PSPLASH_STARTUP_MSG_FILE, "r");
> +  if (fd_msg)
> +    {
> +      if (msglen == 0)
> +        {
> +          fgets (msg, PSPLASH_STARTUP_MSG_MAX_LEN, fd_msg);
> +        }
> +      else
> +        {
> +          fgets (&msg[msglen + 1], PSPLASH_STARTUP_MSG_MAX_LEN - msglen - 1, fd_msg);
> +          msg[msglen] = ' ';
> +        }
> +      fclose (fd_msg);
> +    }
> +  msglen = strlen(msg);
> +#endif
> +
> +  /* draw message if we have one */
> +  if (msglen > 0)
> +    psplash_draw_msg (fb, msg);
>  
>    psplash_main (fb, pipe_fd, 0);
>  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [psplash][PATCH] psplash: add option to read startup message from file
  2016-04-15  8:49 [psplash][PATCH] psplash: add option to read startup message from file Richard Leitner
  2016-04-22  7:53 ` Richard Leitner
  2016-05-25  8:02 ` Richard Leitner
@ 2016-08-18  7:09 ` Richard Leitner
  2016-08-22 16:42   ` Paul Eggleton
  2 siblings, 1 reply; 5+ messages in thread
From: Richard Leitner @ 2016-08-18  7:09 UTC (permalink / raw)
  To: yocto

Any comments/news on that patch from APRIL?
On 04/15/2016 10:49 AM, Richard Leitner wrote:
> This patch adds an option to read the displayed message from a file.
> Additionally the maximum length for the read string can be defined.
> If both, a message (STARTUP_MSG) and a file (STARTUP_MSG_FILE) are
> defined the content of the file will be appended to the message.
> The string will be cutted after the given maximum number of chars.
> 
> For these changes the following defines were introduced:
>   PSPLASH_STARTUP_MSG_MAX_LEN ... maximum lenght of the complete message
>   PSPLASH_STARTUP_MSG_FILE ...... path to the file to read
> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [psplash][PATCH] psplash: add option to read startup message from file
  2016-08-18  7:09 ` Richard Leitner
@ 2016-08-22 16:42   ` Paul Eggleton
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Eggleton @ 2016-08-22 16:42 UTC (permalink / raw)
  To: Richard Leitner, Jussi Kukkonen; +Cc: yocto

Hi Richard,

Sorry, we've clearly not been good at responding to this.

I'm actually not sure who is maintaining psplash these days - Jussi/Ross, is 
it one of you?

Cheers,
Paul

On Thu, 18 Aug 2016 09:09:30 Richard Leitner wrote:
> Any comments/news on that patch from APRIL?
> 
> On 04/15/2016 10:49 AM, Richard Leitner wrote:
> > This patch adds an option to read the displayed message from a file.
> > Additionally the maximum length for the read string can be defined.
> > If both, a message (STARTUP_MSG) and a file (STARTUP_MSG_FILE) are
> > defined the content of the file will be appended to the message.
> > The string will be cutted after the given maximum number of chars.
> > 
> > For these changes the following defines were introduced:
> >   PSPLASH_STARTUP_MSG_MAX_LEN ... maximum lenght of the complete message
> >   PSPLASH_STARTUP_MSG_FILE ...... path to the file to read
> > 
> > Signed-off-by: Richard Leitner <richard.leitner@skidata.com>

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-22 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15  8:49 [psplash][PATCH] psplash: add option to read startup message from file Richard Leitner
2016-04-22  7:53 ` Richard Leitner
2016-05-25  8:02 ` Richard Leitner
2016-08-18  7:09 ` Richard Leitner
2016-08-22 16:42   ` Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.