Package: lkl
Version: 0.1.1-1
Followup-For: Bug #460230

Hi,

I encountered the same problem.
It looks like lkl was polling every microsecond 
while every millisecond is largely enough.
So here is a patch, I also moved from usleep() to 
the more POSIX compliant nanosleep().
                                                                                
                         
-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-vserver-686 (SMP w/1 CPU core)
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages lkl depends on:
ii  libc6                         2.7-5      GNU C Library: Shared libraries

lkl recommends no packages.

-- no debconf information
--- lkl.c.orig	2008-02-08 18:16:34.000000000 +0100
+++ lkl.c	2008-02-08 18:38:07.000000000 +0100
@@ -33,6 +33,12 @@
 	int pressed_shift, pressed_alt, status;
 	unsigned char c, table[TABLE_SIZE];
   
+	struct timespec delay;
+	const struct timespec* req = &delay;
+	struct timespec* rem = NULL;
+	delay.tv_sec = 0;
+	delay.tv_nsec = MSEC * 1000 * 1000;
+	
 	c = status = pressed_shift = pressed_alt = 0;
 	bzero(table, TABLE_SIZE);
 
@@ -75,6 +81,6 @@
 			    lkl->pressed_shift = 0;
 		    }
 		}
-		usleep(MSEC); //Don't freeze your system, dude :
+		nanosleep(req, rem);
 	}
 }

Reply via email to