Hello community,

here is the log from the commit of package suspend for openSUSE:Factory checked 
in at 2012-04-23 16:13:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/suspend (Old)
 and      /work/SRC/openSUSE:Factory/.suspend.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "suspend", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/suspend/suspend.changes  2011-11-28 
12:57:58.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.suspend.new/suspend.changes     2012-04-23 
16:13:47.000000000 +0200
@@ -1,0 +2,5 @@
+Mon Apr  2 08:35:26 UTC 2012 - [email protected]
+
+- Added patch from Frederic Crozat to enable plymouth support
+
+-------------------------------------------------------------------

New:
----
  suspend-plymouth.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ suspend.spec ++++++
--- /var/tmp/diff_new_pack.9Nr4uQ/_old  2012-04-23 16:13:48.000000000 +0200
+++ /var/tmp/diff_new_pack.9Nr4uQ/_new  2012-04-23 16:13:48.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package suspend
 #
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,15 +15,16 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
-
 
 Name:           suspend
-BuildRequires:  glib2-devel gnutls-devel pciutils-devel pkgconfig
-BuildRequires:  libgcrypt-devel libtool
-%if 0%{?suse_version} > 1020
+BuildRequires:  glib2-devel
+BuildRequires:  gnutls-devel
+BuildRequires:  libgcrypt-devel
+BuildRequires:  libtool
+BuildRequires:  pciutils-devel
+BuildRequires:  pkgconfig
+BuildRequires:  plymouth-devel
 BuildRequires:  splashy-devel
-%endif
 %if 0%{?mandriva_version}
 BuildRequires:  liblzo-devel
 %else
@@ -36,8 +37,8 @@
 Release:        0
 Summary:        A Set Of Tools To Support Sleep Modes
 License:        GPL-2.0+
-Url:            http://sourceforge.net/projects/suspend
 Group:          System/Console
+Url:            http://sourceforge.net/projects/suspend
 Source:         %name-utils-%{version}.tar.bz2
 Source2:        configure-suspend-encryption.sh
 Source3:        README.scripts
@@ -54,6 +55,8 @@
 Patch12:        suspend-buildfixes.diff
 Patch13:        suspend-0.80-vbetool-retry-on-errors.diff
 Patch16:        suspend-splash-verbose-debug.diff
+#Mandriva patch to enable plymouth support (Thanks to F. Crozat)
+Patch17:        suspend-plymouth.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 ExclusiveArch:  %ix86 x86_64 ppc ppc64
 %if 0%{?suse_version}
@@ -85,6 +88,7 @@
 %patch12 -p0
 %patch13 -p0
 %patch16 -p1
+%patch17 -p1
 cp %{S:3} scripts/
 #cp -vb --suffix=-0.5 %{S:99} whitelist.c
 
@@ -95,26 +99,19 @@
        --sysconfdir=/etc \
        --with-initramfsdir=/usr/sbin \
        --enable-encrypt \
-%if 0%{?suse_version} > 1020
+        --enable-plymouth \
        --enable-splashy \
        --disable-resume-static \
-%endif
        --enable-threads \
-%if 0%{?suse_version} > 1010
        --docdir=%{_docdir}/%{name} \
-%else
-       --datadir=/usr/share \
-%endif
        --enable-compress
 make
 
 %install
 make install DESTDIR=$RPM_BUILD_ROOT
-%if 0%{?suse_version} > 1100
 install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
 install -m 755 %{S:4} 
$RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-resume.kernel.sh
 install -m 755 %{S:5} 
$RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-resume.userspace.sh
-%endif
 install -m 755 %{S:2} $RPM_BUILD_ROOT/usr/sbin/
 touch $RPM_BUILD_ROOT/etc/suspend.key
 
@@ -122,7 +119,6 @@
 rm -rf $RPM_BUILD_ROOT
 
 %post
-%if 0%{?suse_version} > 1100
 if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
   echo "Skipping recreation of existing initial ramdisks, due"
   echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
@@ -133,7 +129,6 @@
 if [ -x /sbin/mkinitrd_setup ] ; then
   mkinitrd_setup
 fi
-%endif
 if [ "$YAST_IS_RUNNING" != "instsys" -a \
      ! -e /.buildenv -a \
      -x /sbin/update-bootloader -a \
@@ -141,7 +136,6 @@
   /sbin/mkinitrd
   /sbin/update-bootloader --refresh
 fi
-%if 0%{?suse_version} > 1100
 
 %postun
 if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
@@ -152,17 +146,14 @@
 if [ -x /sbin/mkinitrd_setup ] ; then
   mkinitrd_setup
 fi
-%endif
 
 %files
 %defattr (-,root,root)
 %config /etc/suspend.conf
-%if 0%{?suse_version} > 1100
 %dir /lib/mkinitrd
 %dir /lib/mkinitrd/scripts
 /lib/mkinitrd/scripts/boot-resume.kernel.sh
 /lib/mkinitrd/scripts/boot-resume.userspace.sh
-%endif
 %ghost %config(noreplace) /etc/suspend.key
 /usr/sbin/s2disk
 /usr/sbin/s2ram
@@ -172,8 +163,5 @@
 /usr/sbin/swap-offset
 /usr/sbin/configure-suspend-encryption.sh
 %doc README README.s2ram-whitelist README.encryption HOWTO COPYING 
conf/suspend.conf
-%if %suse_version < 1020
-%doc doc/installation-on-SUSE-10.1.txt scripts/
-%endif
 
 %changelog

++++++ suspend-plymouth.patch ++++++
diff -urNB suspend-utils-1.0/configure.ac new/configure.ac
--- suspend-utils-1.0/configure.ac      2011-03-07 00:24:15.000000000 +0100
+++ new/configure.ac    2012-02-16 16:47:16.909290161 +0100
@@ -74,6 +74,12 @@
        ,
        [enable_fbsplash="no"]
 )
+AC_ARG_ENABLE(
+       [plymouth],
+       [AC_HELP_STRING([--enable-plymouth], [enable plymouth support])],
+       ,
+       [enable_plymouth="no"]
+)
 AC_ARG_WITH(
        [devdir],
        [AC_HELP_STRING([--with-devdir=DIR], [use if --enable-create-device, 
put devices in this directory, default /dev])],
@@ -249,6 +255,21 @@
        )
 fi
 
+if test "${enable_plymouth}" = "yes"; then
+       CONFIG_FEATURES="${CONFIG_FEATURES} plymouth"
+       AC_DEFINE([CONFIG_PLYMOUTH], [1], [Define if plymouth enabled])
+       PKG_CHECK_MODULES(
+               [PLYMOUTH],
+               [ply-splash-core],
+               ,
+               [AC_MSG_ERROR([Required plymouth-devel was not found])]
+       )
+       AC_DEFINE_UNQUOTED([PLYMOUTH_THEMESDIR],["`$PKG_CONFIG 
--variable=themesdir ply-splash-core`"], [Plymouth theme directory])
+       AC_DEFINE_UNQUOTED([PLYMOUTH_PLUGINSDIR],["`$PKG_CONFIG 
--variable=pluginsdir ply-splash-core`"], [Plymouth plugins directory])
+       AC_DEFINE_UNQUOTED([PLYMOUTH_CONFDIR],["`$PKG_CONFIG --variable=confdir 
ply-splash-core`"], [Plymouth configuration directory])
+       AC_DEFINE_UNQUOTED([PLYMOUTH_POLICYDIR],["`$PKG_CONFIG 
--variable=policydir ply-splash-core`"], [Plymouth policy directory])
+fi
+
 if test "${enable_threads}" = "yes"; then
        CONFIG_FEATURES="${CONFIG_FEATURES} threads"
        AC_DEFINE([CONFIG_THREADS], [1], [Define if threads enabled])
@@ -301,6 +322,7 @@
 AM_CONDITIONAL([ENABLE_CREATE_DEVICE], [test "${enable_create_device}" = 
"yes"])
 AM_CONDITIONAL([ENABLE_SPLASHY], [test "${enable_splashy}" = "yes"])
 AM_CONDITIONAL([ENABLE_FBSPLASH], [test "${enable_fbsplash}" = "yes"])
+AM_CONDITIONAL([ENABLE_PLYMOUTH], [test "${enable_plymouth}" = "yes"])
 AC_CONFIG_FILES([
        Makefile
        doc/Makefile
diff -urNB suspend-utils-1.0/Makefile.am new/Makefile.am
--- suspend-utils-1.0/Makefile.am       2011-03-07 00:24:15.000000000 +0100
+++ new/Makefile.am     2012-02-16 16:47:16.909290161 +0100
@@ -29,6 +29,9 @@
 if ENABLE_FBSPLASH
 noinst_PROGRAMS+=fbsplash-test
 endif
+if ENABLE_PLYMOUTH
+noinst_PROGRAMS+=plymouth-test
+endif
 endif
 noinst_LIBRARIES=\
        libsuspend-common.a
@@ -88,6 +91,12 @@
 common_s2disk_libs+=\
        ${FBSPLASH_LIBS}
 endif
+if ENABLE_PLYMOUTH
+AM_CFLAGS+=\
+       ${PLYMOUTH_CFLAGS}
+common_s2disk_libs+=\
+       ${PLYMOUTH_LIBS}
+endif
 
 libsuspend_common_a_SOURCES=\
        swsusp.h suspend_ioctls.h \
@@ -99,6 +108,7 @@
        splash.h splash.c \
        splashy_funcs.h splashy_funcs.c \
        fbsplash_funcs.h fbsplash_funcs.c \
+       plymouth_funcs.h plymouth_funcs.c \
        bootsplash.h bootsplash.c \
        memalloc.h memalloc.c load.c \
        whitelist.h whitelist.csv whitelist.c \
@@ -179,6 +189,11 @@
 clean-local:
        rm -f whitelist.c
 
+plymouth_test_SOURCES=\
+       plymouth_funcs.c \
+       plymouth-test.c
+plymouth_test_LDADD=\
+       $(PLYMOUTH_LIBS)
 #
 # Misc functions
 #
diff -urNB suspend-utils-1.0/plymouth_funcs.c new/plymouth_funcs.c
--- suspend-utils-1.0/plymouth_funcs.c  1970-01-01 01:00:00.000000000 +0100
+++ new/plymouth_funcs.c        2012-02-16 17:18:06.983379699 +0100
@@ -0,0 +1,258 @@
+/*
+ * plymouth_funcs.c
+ *
+ * Plymouth (userspace splash) splash method support
+ *
+ * Copyright (c) 2009 Frederic Crozat <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#include "config.h"
+
+#ifdef CONFIG_PLYMOUTH
+#include <string.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "splash.h"
+#include "encrypt.h"
+#include "plymouth_funcs.h"
+#include <ply-event-loop.h>
+#include <ply-boot-splash-plugin.h>
+#include <ply-boot-splash.h>
+//#include <ply-window.h>
+#include <ply-progress.h>
+#include <ply-utils.h>
+#include <ply-terminal.h>
+#include <ply-keyboard.h>
+#include <ply-pixel-display.h>
+#include <ply-text-display.h>
+#include <ply-renderer.h>
+
+static    ply_boot_splash_t *ply_splash;
+static    ply_buffer_t *buffer;
+//static    ply_window_t *window;
+static    ply_keyboard_t *keyboard;
+static    ply_terminal_t *terminal;
+static    ply_progress_t *ply_progress;
+static   ply_renderer_t *renderer;
+static   ply_list_t *pixel_displays;
+static   ply_text_display_t *text_display;
+static    int key_pressed = 0;
+static   char last_key = -1;
+
+static void keyboard_input_handler (void *user_data, const char 
*keyboard_input, size_t      character_size) {
+       fprintf(stderr, "key pressed\n");
+       key_pressed = 1;
+       if (character_size > 0) {
+               last_key = keyboard_input[character_size - 1];
+       }
+}
+
+int plymouth_update(const char *arg) {
+       const char *cmd = "/usr/bin/plymouth";
+       pid_t pid = fork();
+       if (!pid) {
+               int fd = open("/dev/null", O_RDWR);
+               dup2(fd, 2);
+               close(fd);
+               execl(cmd, cmd, arg, (char *) NULL);
+       }
+       else {
+               int status;
+               waitpid(pid, &status, 0);
+               return status;
+       }
+       return 1;
+}
+
+void terminate_plymouth() {
+        ply_keyboard_stop_watching_for_input (keyboard);
+       ply_keyboard_remove_input_handler (keyboard, keyboard_input_handler); 
+        ply_boot_splash_unset_keyboard (ply_splash);
+       ply_boot_splash_hide (ply_splash);
+       ply_boot_splash_free (ply_splash);
+       ply_progress_free (ply_progress);
+       ply_renderer_close (renderer);
+       ply_renderer_free (renderer);
+       ply_terminal_close (terminal);
+       ply_terminal_free (terminal);
+       ply_buffer_free (buffer);
+}
+
+static int plymouth_init() {
+       
+       int ret;
+       ply_key_file_t *key_file;
+       char *splash_string;
+       char *splash_path;
+       ply_list_t *heads;
+       ply_list_node_t *node;
+
+
+       buffer = ply_buffer_new ();
+
+       key_file = ply_key_file_new (PLYMOUTH_CONFDIR "plymouthd.conf");
+
+       if ((ret = ply_key_file_load (key_file)) == 0)
+       {
+               return ret;
+       }
+       splash_string = ply_key_file_get_value (key_file, "Daemon", "Theme");
+
+       asprintf(&splash_path, PLYMOUTH_THEMESDIR "%s/%s.plymouth", 
splash_string, splash_string);
+       free (splash_string);
+       terminal =  ply_terminal_new ("tty63");
+       ply_splash = ply_boot_splash_new (splash_path, PLYMOUTH_PLUGINSDIR, 
buffer);
+       free (splash_path);
+       if ((ret = ply_boot_splash_load (ply_splash)) == 0) {
+               fprintf(stderr,"could not open splash\n");
+               return ret;
+       }
+       renderer = ply_renderer_new (NULL, NULL, terminal);
+       if ((ret = ply_renderer_open (renderer))== 0) {
+               fprintf(stderr,"could not open renderer /dev/fb\n");
+               return ret;
+       }
+       keyboard =  ply_keyboard_new_for_terminal (terminal);
+
+       text_display = ply_text_display_new (terminal);
+       ply_boot_splash_add_text_display (ply_splash, text_display);
+
+       heads = ply_renderer_get_heads (renderer);
+       pixel_displays = ply_list_new();
+
+
+       node = ply_list_get_first_node (heads);
+
+       while (node != NULL)
+        { 
+         ply_list_node_t *next_node;
+          ply_renderer_head_t *head;
+          ply_pixel_display_t *display;
+
+          head = ply_list_node_get_data (node);
+         next_node = ply_list_get_next_node (heads, node);
+
+         display = ply_pixel_display_new (renderer, head);
+
+         ply_list_append_data (pixel_displays, display);
+          node = next_node;
+          ply_boot_splash_add_pixel_display (ply_splash, display);
+         }
+
+       ply_progress = ply_progress_new();
+       ply_boot_splash_attach_progress (ply_splash, ply_progress);
+       ply_boot_splash_attach_to_event_loop (ply_splash, 
ply_event_loop_get_default());
+
+
+       ply_keyboard_add_input_handler(keyboard, keyboard_input_handler, NULL); 
+       return ret;
+
+}
+
+int plymouth_open(int mode)
+{
+       int ret;
+
+       if ((ret = plymouth_init ()) == 0 )
+       {
+               fprintf(stderr,"could not initialize plymouth : error %d 
\n",ret);
+               return -1;
+       }
+
+       ply_boot_splash_set_keyboard (ply_splash, keyboard);
+       ply_renderer_activate (renderer);
+       if (mode==SPL_RESUME) {
+               ply_boot_splash_show (ply_splash, PLY_BOOT_SPLASH_MODE_RESUME);
+       }
+       else {
+               ply_boot_splash_show (ply_splash, PLY_BOOT_SPLASH_MODE_SUSPEND);
+               ply_boot_splash_display_message (ply_splash, "Suspending..." );
+       }
+       ply_keyboard_watch_for_input(keyboard);
+
+       ply_event_loop_process_pending_events (ply_event_loop_get_default());
+
+       return 0;
+}
+
+
+inline int plymouth_finish(void)
+{
+
+       terminate_plymouth();
+
+       return 0;
+}
+
+inline int plymouth_progress(int p)
+{
+       ply_progress_set_percentage (ply_progress, (double) p / 100);
+
+       ply_event_loop_process_pending_events (ply_event_loop_get_default());
+
+       return 0;
+}
+
+
+void plymouth_read_password(char *buf, int vrfy)
+{
+#if 0
+#if CONFIG_ENCRYPT
+        char *vrfy_buf = vrfy ? buf + PASS_SIZE : buf;
+
+        do {
+            while (plymouth_get_password(buf,PASS_SIZE, 
+                        "Passphrase please (must be non-empty): ") <= 0);
+            
+            if (vrfy)
+                while (plymouth_get_password(vrfy_buf,PASS_SIZE,
+                            "Verify passphrase: ") <= 0);
+            
+       } while (vrfy && strncmp(buf, vrfy_buf, PASS_SIZE));
+#endif
+#endif
+}
+
+
+void plymouth_set_caption(const char *message)
+{
+       ply_boot_splash_display_message (ply_splash, message);
+       ply_event_loop_process_pending_events (ply_event_loop_get_default());
+}
+
+int plymouth_dialog(const char *prompt) 
+{
+       key_pressed = 0;
+       ply_progress_pause (ply_progress);
+               ply_boot_splash_display_message (ply_splash, prompt);
+       while (key_pressed == 0) {
+               ply_event_loop_process_pending_events 
(ply_event_loop_get_default());
+       }
+       ply_progress_unpause (ply_progress);
+       return last_key;
+}
+
+char plymouth_key_pressed(void) {
+#if 1
+       ply_event_loop_process_pending_events (ply_event_loop_get_default());
+       if (key_pressed == 0) {
+              return 0;
+       }
+       else {
+               int key = last_key;
+               last_key = -1;
+               key_pressed = 0;
+               return key;
+       }
+#endif
+//     return 0;
+}
+
+
+#endif
diff -urNB suspend-utils-1.0/plymouth_funcs.h new/plymouth_funcs.h
--- suspend-utils-1.0/plymouth_funcs.h  1970-01-01 01:00:00.000000000 +0100
+++ new/plymouth_funcs.h        2012-02-16 17:18:15.332380115 +0100
@@ -0,0 +1,28 @@
+/*
+ * plymouth_funcs.h
+ *
+ * Boot splash related definitions for plymouth method
+ *
+ * Copyright (C) 2009 Frederic Crozat <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#ifndef PLYMOUTH_FUNCS_H
+#define PLYMOUTH_FUNCS_H
+#ifdef CONFIG_PLYMOUTH
+
+int plymouth_open(int mode);
+int plymouth_finish(void);
+int plymouth_progress(int p);
+void plymouth_read_password(char *, int);
+int plymouth_dialog(const char *);
+void plymouth_set_caption(const char *message);
+char plymouth_key_pressed(void);
+
+
+
+#endif
+#endif /* PLYMOUTH_FUNCS_H */
+
diff -urNB suspend-utils-1.0/plymouth-test.c new/plymouth-test.c
--- suspend-utils-1.0/plymouth-test.c   1970-01-01 01:00:00.000000000 +0100
+++ new/plymouth-test.c 2012-02-16 17:18:23.931380520 +0100
@@ -0,0 +1,72 @@
+/*
+ * plymouth-test.c
+ *
+ * plymouth (framebuffer splash) splash method support
+ *
+ * Copyright (c) 2009 Frederic Crozat <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <linux/types.h>
+#include <syscall.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#include "swsusp.h"
+#include "splash.h"
+#include "plymouth_funcs.h"
+
+int main (void)
+{
+       char c;
+       int r;
+       int i;
+       printf("plymouth_open...\n");
+       r = plymouth_open(SPL_SUSPEND);
+       printf("plymouth_open=%d\n", r);
+       if (r) {
+               return 1;
+       }
+
+       for (i=0; i<=100; i+=10) {
+               printf("plymouth_progress (%d)...\n", i);
+               plymouth_progress(i);
+               sleep(1);
+               if (i == 50) {
+                       printf("plymouth_dialog()...\n");
+                       printf("plymouth_dialog=%c\n", plymouth_dialog ("Hello 
world!\nPlease press a key: "));
+               }
+#ifdef CONFIG_ENCRYPT
+               else if (i==60) {
+                       char pass[PASS_SIZE];
+                       printf("plymouth_read_password(,0)..\n");
+                       plymouth_read_password(pass, 0);
+                       printf("plymouth_read_password=%s\n", pass);
+               }
+               else if (i==80) {
+                       char pass[PASS_SIZE];
+                       printf("plymouth_read_password(,1)..\n");
+                       plymouth_read_password(pass, 1);
+                       printf("plymouth_read_password=%s\n", pass);
+               }
+#endif
+               
+               c = plymouth_key_pressed();
+               if (c) {
+                       char buffer[SPLASH_GENERIC_MESSAGE_SIZE];
+                       sprintf(buffer, "Key %c (%02x) pressed", c, (unsigned 
char)c);
+                       plymouth_set_caption(buffer);
+               }
+       }
+
+       printf("plymouth_finish...\n");
+       plymouth_finish();
+       return 0;
+}
diff -urNB suspend-utils-1.0/splash.c new/splash.c
--- suspend-utils-1.0/splash.c  2011-03-07 00:24:15.000000000 +0100
+++ new/splash.c        2012-02-16 16:48:13.382292845 +0100
@@ -27,6 +27,7 @@
 #include "bootsplash.h"
 #include "splashy_funcs.h"
 #include "fbsplash_funcs.h"
+#include "plymouth_funcs.h"
 #include "encrypt.h"
 
 #define INPUT_PATH "/dev/input/by-path"
@@ -202,6 +203,10 @@
        splash->key_pressed     = simple_key_pressed;
        splash->set_caption     = splash_dummy_set_caption;
 
+#ifdef CONFIG_PLYMOUTH
+       plymouth_update ("quit");
+#endif
+
        if (!mode)
                return;
 
@@ -233,6 +238,15 @@
                if (!open_input_fd())
                        splash->key_pressed = key_pressed;
 #endif
+#ifdef CONFIG_PLYMOUTH
+       } else if (!plymouth_open(mode)) {
+               splash->finish      = plymouth_finish;
+               splash->progress    = plymouth_progress;
+               splash->dialog      = plymouth_dialog;
+               splash->read_password   = plymouth_read_password;
+               if (!open_input_fd())
+                       splash->key_pressed = key_pressed;
+#endif
        } else if (0) {
                /* add another splash system here */
        } else {
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to