summaryrefslogtreecommitdiff
authorFlorian Schäfer <florian.schaefer@gmail.com>2008-06-08 16:53:31 (GMT)
committer Christoph Brill <egore911@egore911.de>2008-06-08 20:14:20 (GMT)
commita3d4930699f6544794befe00e0ceb91d55b8b65f (patch) (side-by-side diff)
tree8a178b76180d93c72df71079d55406e0536fde1b
parent6269fdaf3283ba4a8051858fc2b43fa102823e96 (diff)
downloadxf86-input-synaptics-suse-patches.zip
xf86-input-synaptics-suse-patches.tar.gz
Add synaptics-0.14.6-poll-delay.patch from SuSEsuse-patches
syndaemon is a program that monitors keyboard activity and disables the touchpad when the keyboard is being used. Syndaemon is commonly used on laptop computers. Monitored with PowerTOP (http://www.lesswatts.org/projects/powertop/), syndaemon causing 45 wakeups a second because of a hardcoded 20 ms timer. This behavior significantly reduce battery life. This patch introduces a commandline switch to modify the poll delay. Running e.g. "synadmon -m 500" uses a 500 ms timer instead of the hardcoded 20 ms one, makes syndaemon disappear from PowerTOP, while still doing a accurate job. (bnc #386709)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/syndaemon.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/syndaemon.c b/src/syndaemon.c
index c72977a..4befb64 100644
--- a/src/syndaemon.c
+++ b/src/syndaemon.c
@@ -47,9 +47,11 @@ static unsigned char keyboard_mask[KEYMAP_SIZE];
static void
usage()
{
- fprintf(stderr, "Usage: syndaemon [-i idle-time] [-d] [-t] [-k]\n");
+ fprintf(stderr, "Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t] [-k]\n");
fprintf(stderr, " -i How many seconds to wait after the last key press before\n");
fprintf(stderr, " enabling the touchpad. (default is 2.0s)\n");
+ fprintf(stderr, " -m How many milli-seconds to wait until next poll.\n");
+ fprintf(stderr, " (default is 20ms)\n");
fprintf(stderr, " -d Start as a daemon, ie in the background.\n");
fprintf(stderr, " -p Create a pid file with the specified name.\n");
fprintf(stderr, " -t Only disable tapping and scrolling, not mouse movements.\n");
@@ -163,9 +165,8 @@ get_time()
}
static void
-main_loop(Display *display, double idle_time)
+main_loop(Display *display, double idle_time, int poll_delay)
{
- const int poll_delay = 20000; /* 20 ms */
double last_activity = 0.0;
double current_time;
@@ -232,17 +233,21 @@ int
main(int argc, char *argv[])
{
double idle_time = 2.0;
+ int poll_delay = 20000; /* 20 ms */
Display *display;
int c;
int shmid;
int ignore_modifier_keys = 0;
/* Parse command line parameters */
- while ((c = getopt(argc, argv, "i:dtp:kK?")) != EOF) {
+ while ((c = getopt(argc, argv, "i:m:dtp:kK?")) != EOF) {
switch(c) {
case 'i':
idle_time = atof(optarg);
break;
+ case 'm':
+ poll_delay = atoi(optarg) * 1000;
+ break;
case 'd':
background = 1;
break;
@@ -318,7 +323,7 @@ main(int argc, char *argv[])
setup_keyboard_mask(display, ignore_modifier_keys);
/* Run the main loop */
- main_loop(display, idle_time);
+ main_loop(display, idle_time, poll_delay);
return 0;
}