[package] update aoetools to 30 (#5523)
[openwrt/svn-archive/archive.git] / utils / petitboot / patches / 020-petitboot-fix-pb-twin.diff
1 a work-in-progress
2
3 Subject: Update PS3 twin GUI program
4
5 Update the PS3 twin GUI program to work with petitboot-multi-ui.
6
7 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
8 ---
9 rules.mk | 2 +-
10 ui/twin/ps3-twin.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
11 2 files changed, 50 insertions(+), 1 deletion(-)
12
13 --- a/rules.mk
14 +++ b/rules.mk
15 @@ -54,7 +54,7 @@ ui_common_objs = ui/common/discover-clie
16 ui/common/url.o
17 ncurses_objs = ui/ncurses/nc-scr.o ui/ncurses/nc-menu.o ui/ncurses/nc-ked.o \
18 ui/ncurses/nc-cui.o
19 -twin_objs = ui/twin/pb-twin.o
20 +twin_objs =
21
22 # Makefiles
23 makefiles = Makefile $(top_srcdir)/rules.mk
24 --- /dev/null
25 +++ b/ui/twin/ps3-twin.c
26 @@ -0,0 +1,49 @@
27 +/*
28 + * Petitboot twin bootloader for the PS3 game console
29 + *
30 + */
31 +
32 +#define _GNU_SOURCE
33 +
34 +#include <assert.h>
35 +#include <signal.h>
36 +
37 +#include <libtwin/twin.h>
38 +#include <libtwin/twin_fbdev.h>
39 +static twin_fbdev_t *pboot_fbdev;
40 +
41 +#include "log/log.h"
42 +
43 +/**
44 + * main - twin bootloader main routine.
45 + *
46 + * Returns:
47 + * 0 = Returned as success by ps3-utils programs.
48 + * 1 = Error, expecting a restart.
49 + * 22 = Exit to shell.
50 + */
51 +
52 +int main(void)
53 +{
54 + FILE *log;
55 +
56 + log = fopen("pb-twin.log", "a");
57 + assert(log);
58 + pb_log_set_stream(log);
59 +
60 +#if defined(DEBUG)
61 + pb_log_always_flush(1);
62 +#endif
63 +
64 + pb_log("--- pb-twin ---\n");
65 +
66 + pboot_fbdev = twin_fbdev_create(-1, SIGUSR1);
67 + if (pboot_fbdev == NULL) {
68 + perror("failed to create fbdev screen !\n");
69 + return 1;
70 + }
71 +
72 + pb_log("--- end ---\n");
73 +
74 + return 22;
75 +}