Subject: petitboot: Update petitboot fixup patches
[openwrt/svn-archive/archive.git] / utils / petitboot / patches / 020-petitboot-fix-pb-twin.diff
index ed8f93d..aa24f56 100644 (file)
@@ -6,10 +6,43 @@ Update the PS3 twin GUI program to work with petitboot-multi-ui.
 
 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 ---
- rules.mk           |   13 
- ui/twin/ps3-twin.c | 1434 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 1443 insertions(+), 4 deletions(-)
+ Makefile.in        |    1 
+ configure.ac       |   12 
+ rules.mk           |   14 
+ ui/twin/ps3-twin.c | 1441 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 1463 insertions(+), 5 deletions(-)
 
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -18,6 +18,7 @@ twin_LDFLAGS = @twin_LIBS@
+ # build target
+ ENABLE_PS3 = @ENABLE_PS3@
++ENABLE_X11 = @ENABLE_X11@
+ # other programs
+ INSTALL = @INSTALL@
+--- a/configure.ac
++++ b/configure.ac
+@@ -56,7 +56,17 @@ AS_IF([test "x$with_twin" != xno],
+               [if test "x$with_twin" != xcheck; then
+                       AC_MSG_FAILURE([--with-twin was given, but test for twin failed])
+               fi],
+-              [${twin_LIBS}])])
++              [${twin_LIBS}])
++      AC_CHECK_HEADERS([libtwin/twin_x11.h])])
++
++AC_ARG_ENABLE([x11],
++      [AS_HELP_STRING([--enable-x11],
++              [build for x11])],
++      [],
++      [enable_x11=check])
++
++AS_IF([test "x$enable_x11" != xno], [AC_SUBST([ENABLE_X11], ["y"])], [])
++
+ mkdir -p discover lib/list lib/log lib/pb-protocol lib/system lib/talloc \
+       lib/waiter test ui/common ui/ncurses ui/test ui/twin utils
 --- a/rules.mk
 +++ b/rules.mk
 @@ -54,7 +54,7 @@ ui_common_objs = ui/common/discover-clie
@@ -21,13 +54,14 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
  
  # Makefiles
  makefiles = Makefile $(top_srcdir)/rules.mk
-@@ -89,11 +89,16 @@ $(pb_test): $(pb_test_objs)
+@@ -89,11 +89,17 @@ $(pb_test): $(pb_test_objs)
        $(LINK.o) -o $@ $^
  
  # twin gui
 -pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
 +pb_twin_objs-y$(ENABLE_PS3) += ui/twin/pb-twin.o
 +pb_twin_objs-$(ENABLE_PS3) += ui/twin/ps3-twin.o ui/common/ps3.o
++pb_twin_cflags-$(ENABLE_X11) += -DUSE_X11
 +pb_twin_ldflags-$(ENABLE_PS3) += -lps3-utils
 +
 +pb_twin_objs = $(client_objs) $(twin_objs)  $(pb_twin_objs-y)
@@ -36,14 +70,14 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 -$(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
 -$(pb_twin): CFLAGS+=$(twin_CFLAGS)
 +$(pb_twin): LDFLAGS += $(pb_twin_ldflags-y) $(twin_LDFLAGS) $(LIBTWIN)
-+$(pb_twin): CFLAGS += $(twin_CFLAGS) \
++$(pb_twin): CFLAGS += $(pb_twin_cflags-y) $(twin_CFLAGS) \
 +      -DPB_ARTWORK_PATH='"$(pkgdatadir)/artwork/"'
  
  $(pb_twin): $(pb_twin_objs)
        $(LINK.o) -o $@ $^
 --- /dev/null
 +++ b/ui/twin/ps3-twin.c
-@@ -0,0 +1,1434 @@
+@@ -0,0 +1,1441 @@
 +/*
 + * Petitboot twin bootloader for the PS3 game console
 + *
@@ -82,7 +116,7 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +#include <libtwin/twin_linux_mouse.h>
 +#include <libtwin/twin_linux_js.h>
 +#include <libtwin/twin_png.h>
-+#if defined(TWIN_X11)
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
 +# include <libtwin/twin_x11.h>
 +#endif
 +#include <linux/input.h>
@@ -213,11 +247,10 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +      enum pbt_sig sig;
 +      struct pbt_cursor cursor;
 +      twin_screen_t *tscreen;
-+#if defined(USE_TWIN_X11)
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
 +      twin_x11_t *x11;
-+#else
-+      twin_fbdev_t *fbdev;
 +#endif
++      twin_fbdev_t *fbdev;
 +};
 +
 +struct pbt_frame {
@@ -1420,37 +1453,45 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +
 +      ps3.scr.sig = pbt_scr_sig;
 +
-+#if defined(USE_TWIN_X11)
-+      ps3.scr.x11 = twin_x11_create(XOpenDisplay(0), 1024, 768);
-+
-+      if (!ps3.scr.x11) {
-+              perror("failed to create x11 screen !\n");
-+              return EXIT_FAILURE;
-+      }
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
++# if defined(USE_X11)
++      if (1) {
++# else
++      if (0) {
++# endif
++              ps3.scr.x11 = twin_x11_create(XOpenDisplay(0), 1024, 768);
++
++              if (!ps3.scr.x11) {
++                      perror("failed to create x11 screen !\n");
++                      return EXIT_FAILURE;
++              }
 +
-+      ps3.scr.tscreen = ps3.scr.x11->screen;
++              ps3.scr.tscreen = ps3.scr.x11->screen;
++      } else {
 +#else
-+      result = ps3_get_video_mode(&mode);
++      if (1) {
++#endif
++              result = ps3_get_video_mode(&mode);
 +
-+      /* Current becomes default if ps3_flash_get_values() failed. */
++              /* Current becomes default if ps3_flash_get_values() failed. */
 +
-+      if (ps3.dirty_values && !result)
-+              ps3.values.video_mode = mode;
++              if (ps3.dirty_values && !result)
++                      ps3.values.video_mode = mode;
 +
-+      /* Set mode if not at default. */
++              /* Set mode if not at default. */
 +
-+      if (!result && (ps3.values.video_mode != (uint16_t)mode))
-+              ps3_set_video_mode(ps3.values.video_mode);
++              if (!result && (ps3.values.video_mode != (uint16_t)mode))
++                      ps3_set_video_mode(ps3.values.video_mode);
 +
-+      ps3.scr.fbdev = twin_fbdev_create(-1, SIGUSR1);
++              ps3.scr.fbdev = twin_fbdev_create(-1, SIGUSR1);
 +
-+      if (!ps3.scr.fbdev) {
-+              perror("failed to create fbdev screen !\n");
-+              return EXIT_FAILURE;
-+      }
++              if (!ps3.scr.fbdev) {
++                      perror("failed to create fbdev screen !\n");
++                      return EXIT_FAILURE;
++              }
 +
-+      ps3.scr.tscreen = ps3.scr.fbdev->screen;
-+#endif
++              ps3.scr.tscreen = ps3.scr.fbdev->screen;
++      }
 +
 +      ps3.scr.tscreen->event_filter = pbt_scr_event;
 +