synaptics syndaemon 20ms polling loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://www.bughost.org/pipermail/power/2008-January/001234.html
notes that syndaemon wakes up every 20ms (50 times a second!) to see
if it's idle timer (nominally 2.0 seconds) has expired yet.  That's a
little much.

I'd like to apply the patch noted in the URL above (which opensuse is
carrying), plus a patch to make it poll every 200ms, dropping the
wakeups to 5/sec.

Objections?  Patches inline below.

Thanks,
Matt

-- 
Matt Domsch
Linux Technology Strategist, Dell Office of the CTO
linux.dell.com & www.dell.com/linux

--- ./syndaemon.c	2006-04-16 21:31:43.000000000 +0200
+++ ./syndaemon.c	2007-10-16 13:40:02.000000000 +0200
@@ -43,9 +43,11 @@
 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");
@@ -159,9 +161,8 @@
 }
 
 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;
 
@@ -228,17 +229,21 @@
 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;
@@ -314,7 +319,7 @@
     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;
 }


--- synaptics-0.14.6/syndaemon.c.orig	2008-03-17 20:20:14.000000000 -0500
+++ synaptics-0.14.6/syndaemon.c	2008-03-17 20:30:35.000000000 -0500
@@ -47,7 +47,7 @@ usage()
     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, "     (default is 200ms)\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");
@@ -229,7 +229,7 @@ int
 main(int argc, char *argv[])
 {
     double idle_time = 2.0;
-	int poll_delay = 20000;	    /* 20 ms */
+    int poll_delay = 200000;	    /* 200 ms */
     Display *display;
     int c;
     int shmid;

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux