All of lore.kernel.org
 help / color / mirror / Atom feed
* [psplash][PATCH 1/2] Allow users to specify a horizontal offset parameter
@ 2019-05-14  0:22 Philipp Schrader
  2019-05-14  0:23 ` [psplash][PATCH 2/2] Add config option to disable fifo Philipp Schrader
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Schrader @ 2019-05-14  0:22 UTC (permalink / raw)
  To: yocto; +Cc: Philipp Schrader

I have a system where the framebuffer size doesn't match the display
size. In order to figure out which portion of the framebuffer makes it
to the screen I wanted a way to quickly move the picture around. I
decided to add a command line option for a horizontal offset that at
runtime lets you change where exactly the image gets written.

This patch adds a new --horizontal-offset argument to let the user
specify this offset. I was tempted to make the short option "-h"
instead of "-o", but figured that was a bit misleading. "-h" is very
often used for a help.

Signed-off-by: Philipp Schrader <philipp@peloton-tech.com>
---
 psplash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/psplash.c b/psplash.c
index 992e199..166db73 100644
--- a/psplash.c
+++ b/psplash.c
@@ -206,6 +206,7 @@ main (int argc, char** argv)
 {
   char      *tmpdir;
   int        pipe_fd, i = 0, angle = 0, fbdev_id = 0, ret = 0;
+  int        horizontal_offset = 0;
   PSplashFB *fb;
   bool       disable_console_switch = FALSE;
 
@@ -234,9 +235,16 @@ main (int argc, char** argv)
         continue;
       }
 
+    if (!strcmp(argv[i],"-o") || !strcmp(argv[i],"--horizontal-offset"))
+      {
+        if (++i >= argc) goto fail;
+        horizontal_offset = atoi(argv[i]);
+        continue;
+      }
+
     fail:
       fprintf(stderr, 
-              "Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>]\n", 
+              "Usage: %s [-n|--no-console-switch][-a|--angle <0|90|180|270>][-f|--fbdev <0..9>][-o|--horizontal-offset X]\n", 
               argv[0]);
       exit(-1);
   }
@@ -280,7 +288,7 @@ main (int argc, char** argv)
 
   /* Draw the Poky logo  */
   psplash_fb_draw_image (fb, 
-			 (fb->width  - POKY_IMG_WIDTH)/2, 
+			 (fb->width  - POKY_IMG_WIDTH)/2 + horizontal_offset, 
 #if PSPLASH_IMG_FULLSCREEN
 			 (fb->height - POKY_IMG_HEIGHT)/2,
 #else
-- 
2.1.4



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

end of thread, other threads:[~2019-05-14  0:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14  0:22 [psplash][PATCH 1/2] Allow users to specify a horizontal offset parameter Philipp Schrader
2019-05-14  0:23 ` [psplash][PATCH 2/2] Add config option to disable fifo Philipp Schrader

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.