diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/debian/changelog /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/debian/changelog --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/debian/changelog 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/debian/changelog 2007-09-29 11:23:21.000000000 +0200 @@ -1,3 +1,11 @@ +uswsusp (0.6~cvs20070618-1ubuntu3) gutsy; urgency=low + + * re-adding usplash support. + * add libusplash0 to Depends (LP:144688). + * remove splashy Suggests as the package is not built with splashy support. + + -- Whoopie Wed, 12 Sep 2007 23:21:52 +0200 + uswsusp (0.6~cvs20070618-1ubuntu2) gutsy; urgency=low * Don't build s2ram. It's not sensible on Ubuntu. diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/debian/control /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/debian/control --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/debian/control 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/debian/control 2007-09-29 11:23:21.000000000 +0200 @@ -8,9 +8,8 @@ Package: uswsusp Architecture: i386 amd64 powerpc -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, libusplash0 Recommends: initramfs-tools (>= 0.74), mount (>= 2.12r-17) -Suggests: splashy (>= 0.3) Description: tools to use userspace software suspend provided by Linux uswsusp (also known as µswsusp or simply suspend) contains the programs to use the userspace software suspend facility available in Linux kernel diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/Makefile /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/Makefile --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/Makefile 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,160 +0,0 @@ -#CONFIG_COMPRESS=yes -CONFIG_ENCRYPT=yes -#CONFIG_SPLASHY=yes -CONFIG_USPLASH=yes -CONFIG_UDEV=yes -CONFIG_RESUME_DYN=yes - -SUSPEND_DIR=/sbin -RESUME_DIR=/usr/local/lib/suspend -CONFIG_DIR=/etc -RESUME_DEVICE= -BOOT_DIR=/boot -CONFIGFILE=suspend.conf -CFLAGS := -O2 -Wall - -############################################################### - -ARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/ppc.*/ppc/) - -CC_FLAGS=-I/usr/local/include -DS2RAM $(CFLAGS) -LD_FLAGS=-L/usr/local/lib - -BINARIES=s2disk s2both s2ram swap-offset resume -BINARIES_MIN=s2disk swap-offset - -S2RAM_OBJ=vt.o config.o -SWSUSP_OBJ=vt.o md5.o encrypt.o config.o loglevel.o splash.o bootsplash.o - -S2RAM_LD_FLAGS = $(LD_FLAGS) -SWSUSP_LD_FLAGS = $(LD_FLAGS) -ifeq ($(ARCH), x86) -S2RAM_OBJ += s2ram-x86.o dmidecode.o radeontool.o vbetool/vbetool.o -S2RAM_LD_FLAGS += -lx86 -lpci -lz -else ifeq ($(ARCH), ppc) -S2RAM_OBJ += s2ram-ppc.o -endif - -ifndef CONFIG_RESUME_DYN -STATIC_LD_FLAGS = -static -endif - -ifdef CONFIG_COMPRESS -CC_FLAGS += -DCONFIG_COMPRESS -SWSUSP_LD_FLAGS += -llzf -endif - -ifdef CONFIG_ENCRYPT -BINARIES += suspend-keygen -BINARIES_MIN += suspend-keygen -CC_FLAGS += -DCONFIG_ENCRYPT -GCRYPT_CC_FLAGS = $(shell libgcrypt-config --cflags) -SWSUSP_CC_FLAGS += $(GCRYPT_CC_FLAGS) -GCRYPT_LD_FLAGS = $(shell libgcrypt-config --libs) -SWSUSP_LD_FLAGS += $(GCRYPT_LD_FLAGS) -INSTALL_KEYGEN = install-keygen -endif - -ifndef CONFIG_UDEV -SNAPSHOT=$(DESTDIR)/dev/snapshot -endif - -ifdef CONFIG_SPLASHY -SWSUSP_OBJ += splashy_funcs.o -CC_FLAGS += -DCONFIG_SPLASHY -SWSUSP_LD_FLAGS += -lsplashy -ifndef CONFIG_RESUME_DYN -STATIC_LD_FLAGS += -lsplashycnf \ - $(shell directfb-config --libs --input=keyboard \ - --imageprovider=jpeg,gif,png\ - --font=ft2,default) \ - $(shell pkg-config --static --libs glib-2.0) -STATIC_CC_FLAGS=$(shell directfb-config --cflags)\ - $(shell pkg-config --static --cflags glib-2.0) -else -SWSUSP_LD_FLAGS += -lgcc_s -endif -endif -ifdef CONFIG_USPLASH -CC_FLAGS += -DCONFIG_USPLASH -SWSUSP_LD_FLAGS += -lusplash -SWSUSP_OBJ += usplash_funcs.o -endif - - -all: $(BINARIES) - -clean: - rm -f $(BINARIES) suspend-keygen suspend.keys *.o vbetool/*.o - -#### Rules for objects -s2ram-x86.o: %.o : %.c %.h whitelist.c - $(CC) $(CC_FLAGS) -c $< -o $@ - -s2ram-both.o: s2ram.c s2ram.h - $(CC) $(CC_FLAGS) -DCONFIG_BOTH -c $< -o $@ - -md5.o encrypt.o: %.o : %.c %.h md5.h - $(CC) $(CC_FLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H -c $< -o $@ - -# Simple objects with header -config.o vt.o bootsplash.o splash.o splashy_funcs.o usplash_funcs.o vbetool/vbetool.o s2ram-ppc.o: %.o : %.c %.h - $(CC) $(CC_FLAGS) -c $< -o $@ - -# Simple object without header -dmidecode.o radeontool.o : %.o: %.c - $(CC) $(CC_FLAGS) -c $< -o $@ - -#### Rules for binaries -s2disk: $(SWSUSP_OBJ) suspend.c - $(CC) -g $(CC_FLAGS) $^ -o $@ $(SWSUSP_LD_FLAGS) - -s2ram: $(S2RAM_OBJ) s2ram.c - $(CC) -g $(CC_FLAGS) -include s2ram-$(ARCH).h $^ -o $@ $(S2RAM_LD_FLAGS) - -s2both: $(SWSUSP_OBJ) $(S2RAM_OBJ) s2ram-both.o suspend.c - $(CC) -g $(CC_FLAGS) -include s2ram-$(ARCH).h -DCONFIG_BOTH $^ -o $@ $(SWSUSP_LD_FLAGS) $(S2RAM_LD_FLAGS) - -resume: resume.c $(SWSUSP_OBJ) - $(CC) $(CC_FLAGS) $(STATIC_CC_FLAGS) $^ -o $@ $(SWSUSP_LD_FLAGS) $(STATIC_LD_FLAGS) -swap-offset: swap-offset.c - $(CC) $(CC_FLAGS) $< -o $@ $(LD_FLAGS) - -suspend-keygen: keygen.c md5.o encrypt.h - $(CC) $(CC_FLAGS) $(GCRYPT_CC_FLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H md5.o $< -o $@ $(LD_FLAGS) $(GCRYPT_LD_FLAGS) - - - - -#### Install targets -$(SNAPSHOT): - mknod $(SNAPSHOT) c 10 231; - -install-conf: conf/$(CONFIGFILE) - if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then \ - install --mode=644 conf/$(CONFIGFILE) \ - $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new;\ - else \ - install -D --mode=644 conf/$(CONFIGFILE) \ - $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); \ - fi - -install-resume: - install -D --mode=755 resume $(DESTDIR)$(RESUME_DIR)/resume - -install-% : % - install -D --mode=755 $< $(DESTDIR)$(SUSPEND_DIR)/$< - -# Some convenience targets -install-resume-new-initrd: resume conf/$(CONFIGFILE) - BOOT_DIR=$(DESTDIR)$(BOOT_DIR) ./scripts/create-resume-initrd.sh $(RESUME_DEVICE) - -install-resume-on-initrd: resume - ./scripts/install-resume.sh - -install-minimal: $(patsubst %,install-%,$(BINARIES_MIN)) $(SNAPSHOT) install-conf - -install: $(patsubst %,install-%,$(BINARIES)) $(SNAPSHOT) install-conf - - -.PHONY: clean install install-minimal install-resume-on-initrd install-resume-new-initrd diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/splash.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/splash.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/splash.c 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/splash.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,118 +0,0 @@ -/* - * splash.c - * - * Bootsplash integration into the suspend and resume tools - * - * Copyright (C) 2006 Holger Macht - * - * This file is released under the GPLv2. - * - */ - -#include -#include -#include -#include - -#include "splash.h" -#include "bootsplash.h" -#include "splashy_funcs.h" -#include "usplash_funcs.h" -#include "encrypt.h" - -/** - * dummy functions in case if no splash system was found or - * bootsplashing is disabled - */ -static int splash_dummy_int_void(void) { return 0; } -static int splash_dummy_int_int(int p) { return 0; } -static void splash_dummy_void_void(void) { return; } -#ifndef CONFIG_ENCRYPT -static void splash_dummy_readpass(char *a, int b) { } -#endif -static int splash_dialog(const char *prompt) -{ - printf(prompt); - return getchar(); -} -static int prepare_abort(struct termios *oldtrm, struct termios *newtrm) -{ - int ret; - - ret = tcgetattr(0, oldtrm); - if (!ret) { - *newtrm = *oldtrm; - newtrm->c_cc[VMIN] = 0; - newtrm->c_cc[VTIME] = 0; - newtrm->c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL; - newtrm->c_lflag = 0; - ret = tcsetattr(0, TCSANOW, newtrm); - } - - return ret; -} - -static int key_pressed(const char key) -{ - char c; - if (read(0, &c, 1) > 0 && c == key) - return 1; - - return 0; -} - -static void restore_abort(struct termios *oldtrm) -{ - tcsetattr(0, TCSANOW, oldtrm); -} - -/* Tries to find a splash system and initializes interface functions */ -void splash_prepare(struct splash *splash, int mode) -{ - splash->finish = splash_dummy_int_void; - splash->progress = splash_dummy_int_int; - splash->switch_to = splash_dummy_void_void; - splash->dialog = splash_dialog; -#ifdef CONFIG_ENCRYPT - splash->read_password = read_password; -#else - splash->read_password = splash_dummy_readpass; -#endif - splash->prepare_abort = prepare_abort; - splash->restore_abort = restore_abort; - splash->key_pressed = key_pressed; - if (!mode) - return; - - printf("Looking for splash system... "); - - if (!bootsplash_open()) { - splash->finish = bootsplash_finish; - splash->progress = bootsplash_progress; - splash->switch_to = bootsplash_switch_to; - splash->dialog = bootsplash_dialog; - splash->read_password = bootsplash_read_password; -#ifdef CONFIG_SPLASHY - } else if (!splashy_open(mode)) { - splash->finish = splashy_finish; - splash->progress = splashy_progress; - splash->dialog = splashy_dialog; - splash->read_password = splashy_read_password; -#endif -#ifdef CONFIG_USPLASH - } else if (usplash_open() == 0) { - splash->finish = usplash_finish; - splash->progress = usplash_progress; - splash->dialog = usplash_dialog; - splash->read_password = usplash_read_password; -#endif - } else if (0) { - /* add another splash system here */ - } else { - printf("none\n"); - return; - } - printf("found\n"); - - splash->progress(0); -} diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.c 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -/* - * usplash_funcs.c - * - * usplash splash method support - * - * Copyright (C) 2006 Matthew Garrett - * - * This file is released under the GPLv2. - * - */ - -#ifdef CONFIG_USPLASH -#include - -#include -#include - -#include "encrypt.h" -#include "usplash_funcs.h" - -int usplash_open() -{ - usplash_setup (0, 0, 0); - clear_screen(); - return 0; -} - - -inline int usplash_finish(void) -{ - usplash_restore_console(); - return 0; -} - -inline int usplash_progress(int p) -{ - draw_progressbar (p); - return 0; -} - -void usplash_read_password(char *buf, int vrfy) -{ -#if CONFIG_ENCRYPT - char *vrfy_buf = vrfy ? buf + PASS_SIZE : buf; - char query_phrase[] = "Passphrase please (must be non-empty): "; - char verify_phrase[] = "Verify passphrase: "; - - do { - draw_text_urgent(query_phrase, strlen(query_phrase)); - - while (usplash_get_string(buf, PASS_SIZE, 1) <= 0); - - if (vrfy) { - draw_text_urgent(verify_phrase, strlen(verify_phrase)); - while (usplash_get_string (vrfy_buf, PASS_SIZE, 1) - <= 0); - } - } while (vrfy && strncmp(buf, vrfy_buf, PASS_SIZE)); -#endif -} - -int usplash_dialog(const char *prompt) -{ - char buf[2] = ""; - draw_text_urgent (prompt, strlen(prompt)); - usplash_get_string (buf, 2, 0); - return buf[0]; -} - -void usplash_print(const char *prompt) -{ - draw_text_urgent (prompt, strlen(prompt)); -} - -#endif diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.h /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.h --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.h 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070513/usplash_funcs.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -/* - * usplash_funcs.h - * - * Boot splash related definitions for usplash method - * - * Copyright (C) 2006 Tollef Fog Heen - * - * This file is released under the GPLv2. - * - */ - -#ifndef USPLASH_FUNCS_H -#define USPLASH_FUNCS_H -#ifdef CONFIG_USPLASH - -int usplash_open(void); -int usplash_finish(void); -int usplash_progress(int p); -void usplash_read_password(char *, int); -int usplash_dialog(const char *); -void usplash_print(const char *); -#endif -#endif /* SPLASHY_FUNCS_H */ - diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/Makefile /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/Makefile --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/Makefile 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/Makefile 2007-09-29 11:23:21.000000000 +0200 @@ -1,10 +1,11 @@ #CONFIG_COMPRESS=yes -#CONFIG_ENCRYPT=yes +CONFIG_ENCRYPT=yes #CONFIG_SPLASHY=yes -#CONFIG_UDEV=yes -#CONFIG_RESUME_DYN=yes +CONFIG_USPLASH=yes +CONFIG_UDEV=yes +CONFIG_RESUME_DYN=yes -SUSPEND_DIR=/usr/local/sbin +SUSPEND_DIR=/sbin RESUME_DIR=/usr/local/lib/suspend CONFIG_DIR=/etc RESUME_DEVICE= @@ -74,7 +75,11 @@ SWSUSP_LD_FLAGS += -lgcc_s endif endif - +ifdef CONFIG_USPLASH +CC_FLAGS += -DCONFIG_USPLASH +SWSUSP_LD_FLAGS += -lusplash +SWSUSP_OBJ += usplash_funcs.o +endif all: $(BINARIES) @@ -93,7 +98,7 @@ $(CC) $(CC_FLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H -c $< -o $@ # Simple objects with header -config.o vt.o bootsplash.o splash.o splashy_funcs.o vbetool/vbetool.o s2ram-ppc.o: %.o : %.c %.h +config.o vt.o bootsplash.o splash.o splashy_funcs.o usplash_funcs.o vbetool/vbetool.o s2ram-ppc.o: %.o : %.c %.h $(CC) $(CC_FLAGS) -c $< -o $@ # Simple object without header diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/resume.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/resume.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/resume.c 2007-05-13 22:28:20.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/resume.c 2007-09-29 11:23:21.000000000 +0200 @@ -136,6 +136,10 @@ static unsigned int buffer_size; static void *mem_pool; +#ifdef CONFIG_USPLASH +int xres = 0, yres = 0; +#endif + /** * read_area - Read data from a swap location. * @fd: File handle of the resume partition @@ -752,6 +756,16 @@ "resume_offset\0offset of swap file in resume device.", required_argument, NULL, 'o' }, +#ifdef CONFIG_USPLASH + { + "xres\0\t\tdesired X resolution for usplash.", + required_argument, NULL, 'x' + }, + { + "yres\0\t\tdesired Y resolution for usplash.", + required_argument, NULL, 'y' + }, +#endif { NULL, 0, NULL, 0 } }; int i, error; @@ -760,7 +774,11 @@ unsigned long long int off = 0; int set_rdev = 0; char *rdev = NULL; +#ifdef CONFIG_USPLASH + const char *optstring = "hf:o:r:x:y:"; +#else const char *optstring = "hf:o:r:"; +#endif while ((i = getopt_long(argc, argv, optstring, options, NULL)) != -1) { switch (i) { @@ -778,6 +796,14 @@ rdev = optarg; set_rdev = 1; break; +#ifdef CONFIG_USPLASH + case 'x': + xres = atoll(optarg); + break; + case 'y': + yres = atoll(optarg); + break; +#endif default: usage("resume", options, optstring); return -EINVAL; diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/splash.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/splash.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/splash.c 2007-05-13 22:28:20.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/splash.c 2007-09-29 11:23:21.000000000 +0200 @@ -17,6 +17,7 @@ #include "splash.h" #include "bootsplash.h" #include "splashy_funcs.h" +#include "usplash_funcs.h" #include "encrypt.h" /** @@ -98,6 +99,13 @@ splash->dialog = splashy_dialog; splash->read_password = splashy_read_password; #endif +#ifdef CONFIG_USPLASH + } else if (usplash_open() == 0) { + splash->finish = usplash_finish; + splash->progress = usplash_progress; + splash->dialog = usplash_dialog; + splash->read_password = usplash_read_password; +#endif } else if (0) { /* add another splash system here */ } else { diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/suspend.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/suspend.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/suspend.c 2007-09-29 11:23:21.000000000 +0200 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/suspend.c 2007-09-29 11:23:21.000000000 +0200 @@ -88,6 +88,9 @@ static struct vt_mode orig_vtm; static int vfd; char *my_name; +#ifdef CONFIG_USPLASH +int xres = 0, yres = 0; +#endif static struct config_par parameters[PARAM_NO] = { { @@ -1187,6 +1190,16 @@ "image_size\0\tdesired size of the image.", required_argument, NULL, 's' }, +#ifdef CONFIG_USPLASH + { + "xres\0\t\tdesired X resolution for usplash.", + required_argument, NULL, 'x' + }, + { + "yres\0\t\tdesired Y resolution for usplash.", + required_argument, NULL, 'y' + }, +#endif #ifdef CONFIG_BOTH HACKS_LONG_OPTS #endif @@ -1200,7 +1213,11 @@ unsigned long int im_size = 0; char *rdev = NULL; int set_rdev = 0; +#ifdef CONFIG_USPLASH + const char *optstring = "hf:s:o:r:x:y:"; +#else const char *optstring = "hf:s:o:r:"; +#endif while ((i = getopt_long(argc, argv, optstring, options, NULL)) != -1) { switch (i) { @@ -1222,6 +1239,14 @@ rdev = optarg; set_rdev = 1; break; +#ifdef CONFIG_USPLASH + case 'x': + xres = atoll(optarg); + break; + case 'y': + yres = atoll(optarg); + break; +#endif case '?': usage(my_name, options, optstring); return -EINVAL; diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.c /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.c --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.c 1970-01-01 01:00:00.000000000 +0100 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.c 2007-09-29 11:23:21.000000000 +0200 @@ -0,0 +1,78 @@ +/* + * usplash_funcs.c + * + * usplash splash method support + * + * Copyright (C) 2006 Matthew Garrett + * + * This file is released under the GPLv2. + * + */ + +#ifdef CONFIG_USPLASH +#include + +#include +#include + +#include "encrypt.h" +#include "usplash_funcs.h" + +extern int xres; +extern int yres; + +int usplash_open() +{ + usplash_setup (xres, yres, 0); + clear_screen(); + return 0; +} + + +inline int usplash_finish(void) +{ + usplash_restore_console(); + return 0; +} + +inline int usplash_progress(int p) +{ + draw_progressbar (p); + return 0; +} + +void usplash_read_password(char *buf, int vrfy) +{ +#if CONFIG_ENCRYPT + char *vrfy_buf = vrfy ? buf + PASS_SIZE : buf; + char query_phrase[] = "Passphrase please (must be non-empty): "; + char verify_phrase[] = "Verify passphrase: "; + + do { + draw_text_urgent(query_phrase, strlen(query_phrase)); + + while (usplash_get_string(buf, PASS_SIZE, 1) <= 0); + + if (vrfy) { + draw_text_urgent(verify_phrase, strlen(verify_phrase)); + while (usplash_get_string (vrfy_buf, PASS_SIZE, 1) + <= 0); + } + } while (vrfy && strncmp(buf, vrfy_buf, PASS_SIZE)); +#endif +} + +int usplash_dialog(const char *prompt) +{ + char buf[2] = ""; + draw_text_urgent (prompt, strlen(prompt)); + usplash_get_string (buf, 2, 0); + return buf[0]; +} + +void usplash_print(const char *prompt) +{ + draw_text_urgent (prompt, strlen(prompt)); +} + +#endif diff -Nru /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.h /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.h --- /tmp/mNSwEjaMT5/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.h 1970-01-01 01:00:00.000000000 +0100 +++ /tmp/A8SBwYFKq2/uswsusp-0.6~cvs20070618/suspend-cvs20070618/usplash_funcs.h 2007-09-29 11:23:21.000000000 +0200 @@ -0,0 +1,24 @@ +/* + * usplash_funcs.h + * + * Boot splash related definitions for usplash method + * + * Copyright (C) 2006 Tollef Fog Heen + * + * This file is released under the GPLv2. + * + */ + +#ifndef USPLASH_FUNCS_H +#define USPLASH_FUNCS_H +#ifdef CONFIG_USPLASH + +int usplash_open(void); +int usplash_finish(void); +int usplash_progress(int p); +void usplash_read_password(char *, int); +int usplash_dialog(const char *); +void usplash_print(const char *); +#endif +#endif /* SPLASHY_FUNCS_H */ +