~vcs-imports/suspend/trunk

376 by rjwysocki
1
/*
2
 * fbsplash.c
3
 *
4
 * fbsplash (framebuffer splash) splash method support
5
 *
6
 * Copyright (C) 2007 Alon Bar-Lev <alon.barlev@gmail.com>
7
 *
8
 * This file is released under the GPLv2.
9
 *
10
 */
11
12
#include "config.h"
13
14
#include <string.h>
15
#include <stdio.h>
16
#include <linux/types.h>
17
#include <syscall.h>
18
19
#include "swsusp.h"
20
#include "splash.h"
21
#include "fbsplash_funcs.h"
22
23
char fbsplash_theme[] = "";
24
25
int main (void)
26
{
27
	char c;
28
	int r;
29
	int i;
30
	printf("fbsplashfuncs_open...\n");
31
	r = fbsplashfuncs_open(SPL_SUSPEND);
32
	printf("fbsplashfuncs_open=%d\n", r);
33
	if (r) {
34
		return 1;
35
	}
36
37
	for (i=0; i<=100; i+=10) {
38
		printf("fbsplashfuncs_progress (%d)...\n", i);
39
		fbsplashfuncs_progress(i);
40
		sleep(1);
41
		if (i == 50) {
42
			printf("fbsplashfuncs_dialog()...\n");
43
			printf("fbsplashfuncs_dialog=%c\n", fbsplashfuncs_dialog ("Hello world!\nPlease press a key: "));
44
		}
45
#ifdef CONFIG_ENCRYPT
46
		else if (i==60) {
47
			char pass[PASS_SIZE];
48
			printf("fbsplashfuncs_read_password(,0)..\n");
49
			fbsplashfuncs_read_password(pass, 0);
50
			printf("fbsplashfuncs_read_password=%s\n", pass);
51
		}
52
		else if (i==80) {
53
			char pass[PASS_SIZE];
54
			printf("fbsplashfuncs_read_password(,1)..\n");
55
			fbsplashfuncs_read_password(pass, 1);
56
			printf("fbsplashfuncs_read_password=%s\n", pass);
57
		}
58
#endif
59
		c = fbsplashfuncs_key_pressed();
60
		if (c) {
61
			char buffer[SPLASH_GENERIC_MESSAGE_SIZE];
62
			sprintf(buffer, "Key %c (%02x) pressed", c, (unsigned char)c);
63
			fbsplashfuncs_set_caption(buffer);
64
		}
65
	}
66
67
	printf("fbsplashfuncs_finish...\n");
68
	fbsplashfuncs_finish();
69
	return 0;
70
}