Commit a3d49306 authored by Florian Schäfer's avatar Florian Schäfer Committed by Christoph Brill
Browse files

Add synaptics-0.14.6-poll-delay.patch from SuSE

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
(, 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
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)
parent 6269fdaf
......@@ -47,9 +47,11 @@ static unsigned char keyboard_mask[KEYMAP_SIZE];
static void
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);
case 'm':
poll_delay = atoi(optarg) * 1000;
case 'd':
background = 1;
......@@ -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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment