Package: hotkey-setup
Version: 0.1-17
Severity: wishlist

Hi,

thinkpad-keys is waking up many times per secound to poll the thinkpad keys..
i've written a small patch to make this more efficient, please apply.

--- thinkpad-keys.c     2006-03-25 21:06:18.000000000 +0100
+++ ../../th/hotkey-setup-0.1/thinkpad-keys.c   2007-06-21 22:46:01.720680536 
+0200
@@ -37,7 +37,9 @@
 
 #define UINPUT_DEVICE "/dev/input/uinput"
 #define NVRAM_DEVICE "/dev/nvram"
-#define POLL_DELAY 50 /* milliseconds */
+#define WAIT_DELAY 700 /* milliseconds */
+#define POLL_DELAY 20 /* milliseconds */
+#define KEY_BURST 100 /* 100 * POLL_DELAY for keypresses in a row */
 
 static int init_nvram(void)
 {
@@ -239,6 +241,7 @@
   int nvram, uinput;
   struct record state[2];
   int buttons, counter = 1;
+  int key_burst = 0;
 
 #if 1
   /* Software volume control */
@@ -273,13 +276,21 @@
 
   grok_nvram(nvram, state);
 
-  for(;; counter ^= 1)
+       for(;; counter ^= 1)
     {
       grok_nvram(nvram, state + counter);
       compare_nvram(&buttons, state + (counter^1), state + counter);
-      if(buttons &= mask)
-       punt_keycodes(uinput, buttons, codes);
-      usleep(POLL_DELAY*1000);
+      if(buttons &= mask) {
+                               punt_keycodes(uinput, buttons, codes);
+                               key_burst = KEY_BURST;
+                       }
+
+                       if (key_burst>0) {
+                               key_burst--;
+                               usleep(POLL_DELAY*1000);
+                       }
+                       else
+             usleep(WAIT_DELAY*1000);
     }
 
   cleanup_uinput(SIGTERM);



-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-vserver-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to