Hello community,
here is the log from the commit of package suspend
checked in at Fri Aug 3 22:50:45 CEST 2007.
--------
--- arch/i386/suspend/suspend.changes 2007-07-31 14:37:42.000000000 +0200
+++ /mounts/work_src_done/STABLE/suspend/suspend.changes 2007-08-03 20:58:22.289100000 +0200
@@ -1,0 +2,8 @@
+Fri Aug 3 20:24:10 CEST 2007 - hmacht@suse.de
+
+- add suspend-input.diff: Read keyboard events from
+ /dev/input/event*. DirectFB implementation uses threads which are
+ frozen during image writing (novell bug 293826)
+- suspend-default-splash.diff: default to using splash for s2disk
+
+-------------------------------------------------------------------
New:
----
suspend-default-splash.diff
suspend-input.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ suspend.spec ++++++
--- /var/tmp/diff_new_pack.c19388/_old 2007-08-03 22:48:52.000000000 +0200
+++ /var/tmp/diff_new_pack.c19388/_new 2007-08-03 22:48:52.000000000 +0200
@@ -13,7 +13,7 @@
Name: suspend
BuildRequires: gnutls-devel libx86-devel pciutils-devel splashy-devel
Version: 0.50.20070731
-Release: 1
+Release: 3
Summary: A Set Of Tools To Support Sleep Modes
License: GPL v2 or later
URL: http://sourceforge.net/projects/suspend
@@ -28,6 +28,8 @@
Patch4: suspend-disable-bootsplash.diff
Patch5: suspend-s2ram-suspend-fbcon.diff
Patch6: suspend-0.50.20070730-makefile-old-make-fix.diff
+Patch7: suspend-input.diff
+Patch8: suspend-default-splash.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
Supplements: powersave
@@ -54,6 +56,8 @@
%patch4 -p0
%patch5 -p0
%patch6 -p0
+%patch7 -p0
+%patch8 -p0
cp %{S:3} scripts/
#cp -vb --suffix=-0.5 %{S:99} whitelist.c
@@ -101,6 +105,11 @@
%doc doc/installation-on-SUSE-10.1.txt scripts/
%changelog
+* Fri Aug 03 2007 - hmacht@suse.de
+- add suspend-input.diff: Read keyboard events from
+ /dev/input/event*. DirectFB implementation uses threads which are
+ frozen during image writing (novell bug 293826)
+- suspend-default-splash.diff: default to using splash for s2disk
* Tue Jul 31 2007 - seife@suse.de
- update to current cvs:
- whitelist updates
++++++ suspend-default-splash.diff ++++++
--- resume.c
+++ resume.c
@@ -812,10 +812,10 @@
if (error)
return -error;
- if (splash_param != 'y' && splash_param != 'Y')
- splash_param = 0;
- else
+ if (splash_param != 'n' && splash_param != 'N')
splash_param = SPL_RESUME;
+ else
+ splash_param = 0;
page_size = getpagesize();
buffer_size = BUFFER_PAGES * page_size;
--- suspend.c
+++ suspend.c
@@ -1387,10 +1387,10 @@
if (encrypt != 'y' && encrypt != 'Y')
encrypt = 0;
#endif
- if (splash_param != 'y' && splash_param != 'Y')
- splash_param = 0;
- else
+ if (splash_param != 'n' && splash_param != 'N')
splash_param = SPL_SUSPEND;
+ else
+ splash_param = 0;
if (early_writeout != 'n' && early_writeout != 'N')
early_writeout = 1;
++++++ suspend-input.diff ++++++
--- encrypt.h
+++ encrypt.h
@@ -58,5 +58,5 @@
void encrypt_init(unsigned char *, unsigned char *, char *);
void get_random_salt(unsigned char *salt, size_t size);
-#define KEY_FILE "/etc/suspend.key"
+#define KEY_FILE_PATH "/etc/suspend.key"
#endif
--- splash.c
+++ splash.c
@@ -51,15 +51,6 @@
return ret;
}
-static char key_pressed(void)
-{
- char c;
- if (read(0, &c, 1) == 0)
- return 0;
-
- return c;
-}
-
static void restore_abort(struct termios *oldtrm)
{
tcsetattr(0, TCSANOW, oldtrm);
@@ -79,7 +70,6 @@
#endif
splash->prepare_abort = prepare_abort;
splash->restore_abort = restore_abort;
- splash->key_pressed = key_pressed;
if (!mode)
return;
--- suspend.c
+++ suspend.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -32,6 +33,7 @@
#include
#include
#include
+#include
#ifdef CONFIG_COMPRESS
#include
#else
@@ -68,7 +70,7 @@
#ifdef CONFIG_ENCRYPT
static char encrypt;
static char use_RSA;
-static char key_name[MAX_STR_LEN] = KEY_FILE;
+static char key_name[MAX_STR_LEN] = KEY_FILE_PATH;
static char password[PASS_SIZE];
#else
#define encrypt 0
@@ -79,6 +81,7 @@
#endif
static char early_writeout;
static char splash_param;
+#define INPUT_PATH "/dev/input/by-path"
#define SHUTDOWN_LEN 16
static char shutdown_method_value[SHUTDOWN_LEN] = "";
static enum {
@@ -300,6 +303,22 @@
return 0;
}
+static char key_pressed(int input_fd)
+{
+ int rd;
+ struct input_event ev;
+
+ if (input_fd < 0)
+ return 0;
+
+ while ((rd = read(input_fd, &ev, sizeof(struct input_event))) != -1) {
+ /* we only need key release events */
+ if (ev.type == EV_KEY && ev.value == 0)
+ return ev.code;
+ }
+ return 0;
+}
+
static int prepare(struct swap_map_handle *handle, int disp)
{
struct buf_block *block;
@@ -451,10 +470,10 @@
*/
static int save_image(struct swap_map_handle *handle,
- unsigned int nr_pages)
+ unsigned int nr_pages, int input_fd)
{
unsigned int m, writeout_rate;
- int ret, abort_possible;
+ int ret, abort_possible, key;
struct termios newtrm, savedtrm;
int error = 0;
@@ -494,7 +513,8 @@
printf("\b\b\b\b%3d%%", nr_pages / m);
splash.progress(20 + (nr_pages / m) * 0.75);
- switch (splash.key_pressed()) {
+ while ((key = key_pressed(input_fd)) > 0) {
+ switch (key) {
case ABORT_KEY_CODE:
if (abort_possible) {
printf(" aborted!\n");
@@ -504,7 +524,8 @@
case REBOOT_KEY_CODE:
printf (" reboot enabled\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
shutdown_method = SHUTDOWN_METHOD_REBOOT;
- break;
+ break;
+ }
}
}
if (!(nr_pages % writeout_rate))
@@ -575,7 +596,7 @@
* write_image - Write entire image and metadata.
*/
-int write_image(int snapshot_fd, int resume_fd)
+int write_image(int snapshot_fd, int resume_fd, int input_fd)
{
static struct swap_map_handle handle;
struct swsusp_info *header = mem_pool;
@@ -656,7 +677,7 @@
#endif
if (!error) {
gettimeofday(&begin, NULL);
- error = save_image(&handle, header->pages - 1);
+ error = save_image(&handle, header->pages - 1, input_fd);
}
/*
@@ -760,7 +781,7 @@
sleep (60);
}
-int suspend_system(int snapshot_fd, int resume_fd)
+int suspend_system(int snapshot_fd, int resume_fd, int input_fd)
{
loff_t avail_swap;
unsigned long image_size;
@@ -811,7 +832,7 @@
free_snapshot(snapshot_fd);
break;
}
- error = write_image(snapshot_fd, resume_fd);
+ error = write_image(snapshot_fd, resume_fd, input_fd);
if (!error) {
splash.progress(100);
#ifdef CONFIG_BOTH
@@ -1285,11 +1306,49 @@
return 0;
}
+int open_input_fd(void)
+{
+ int fd;
+ struct dirent *it;
+ DIR *dir;
+ char *input_dev;
+
+ if (!(dir = opendir(INPUT_PATH))) {
+ perror("Cannot open input directory");
+ return -1;
+ }
+
+ while ((it = readdir(dir))) {
+ if (strstr(it->d_name, "-event-kbd"))
+ break;
+ }
+
+ if (!it) {
+ if (errno)
+ perror("readdir()");
+ return -1;
+ }
+
+ input_dev = malloc(strlen(INPUT_PATH) + strlen(it->d_name) + 2);
+ if (!input_dev) {
+ perror("malloc");
+ return -ENOMEM;
+ }
+ sprintf(input_dev, "%s/%s", INPUT_PATH, it->d_name);
+
+ if ((fd = open(input_dev, O_RDONLY|O_NONBLOCK)) == -1)
+ perror("opening input fd");
+ free(input_dev);
+ free(dir);
+
+ return fd;
+}
+
int main(int argc, char *argv[])
{
unsigned int mem_size;
struct stat stat_buf;
- int resume_fd, snapshot_fd, vt_fd, orig_vc = -1, suspend_vc = -1;
+ int resume_fd, snapshot_fd, input_fd, vt_fd, orig_vc = -1, suspend_vc = -1;
dev_t resume_dev;
int orig_loglevel, orig_swappiness, ret;
struct rlimit rlim;
@@ -1458,6 +1517,9 @@
goto Close_snapshot_fd;
}
+ if ((input_fd = open_input_fd()) < 0)
+ fprintf(stderr, "Could not open keyboard input device\n");
+
splash_prepare(&splash, splash_param);
if (lock_vt() < 0) {
@@ -1498,7 +1560,7 @@
setrlimit(RLIMIT_NPROC, &rlim);
setrlimit(RLIMIT_CORE, &rlim);
- ret = suspend_system(snapshot_fd, resume_fd);
+ ret = suspend_system(snapshot_fd, resume_fd, input_fd);
if (orig_loglevel >= 0)
set_kernel_console_loglevel(orig_loglevel);
--- swsusp.h
+++ swsusp.h
@@ -214,7 +214,7 @@
#define PARAM_NO (GEN_PARAM + COMPRESS_PARAM + ENCRYPT_PARAM)
-#define ABORT_KEY_CODE 127
+#define ABORT_KEY_CODE 14
#define ABORT_KEY_NAME "backspace"
-#define REBOOT_KEY_CODE 'r'
+#define REBOOT_KEY_CODE 19
#define REBOOT_KEY_NAME "r"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org