[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.25-4-gc70082e
Julien BLACHE
jb at jblache.org
Tue Feb 3 12:50:29 UTC 2009
The following commit has been merged in the master branch:
commit c70082ef4876a788ab39eb51db7b10ef9c35e215
Author: Julien BLACHE <jb at jblache.org>
Date: Tue Feb 3 13:48:29 2009 +0100
Reset the keyboard idle timer only for events on the built-in keyboard
The idle timer is used to switch off the keyboard backlight; events on
event sources other than the built-in keyboard, like external keyboards,
should not reset the timer.
diff --git a/ChangeLog b/ChangeLog
index 2da13ff..ddb42b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@ ChangeLog for pommed
--------------------
version 1.26:
+ - pommed: only keystrokes on the built-in keyboard should reset
+ the keyboard idle timer.
version 1.25:
- pommed: check current hardware backlight level before setting AC
diff --git a/pommed/evdev.c b/pommed/evdev.c
index 828961f..a8ca30c 100644
--- a/pommed/evdev.c
+++ b/pommed/evdev.c
@@ -69,6 +69,8 @@ static int
evdev_try_add(int fd);
+static int internal_kbd_fd;
+
void
evdev_process_events(int fd, uint32_t events)
{
@@ -85,6 +87,9 @@ evdev_process_events(int fd, uint32_t events)
if (ret < 0)
logmsg(LOG_ERR, "Could not remove device from event loop");
+ if (fd == internal_kbd_fd)
+ internal_kbd_fd = -1;
+
close(fd);
return;
@@ -102,8 +107,11 @@ evdev_process_events(int fd, uint32_t events)
return;
/* Reset keyboard backlight idle timer */
- kbd_bck_info.idle = 0;
- kbd_backlight_inhibit_clear(KBD_INHIBIT_IDLE);
+ if (fd == internal_kbd_fd)
+ {
+ kbd_bck_info.idle = 0;
+ kbd_backlight_inhibit_clear(KBD_INHIBIT_IDLE);
+ }
switch (ev.code)
{
@@ -822,11 +830,27 @@ evdev_try_add(int fd)
return -1;
}
+ /* There are 2 keyboards, but one of them only has the eject key;
+ the real keyboard has all the keys and the LEDs. Checking for
+ the LEDs is a quick way of identifying the keyboard we want.
+ */
+ if (test_bit(EV_LED, bit[0]) && evdev_is_internal(id))
+ {
+ logdebug(" -> Internal keyboard\n");
+
+ internal_kbd_fd = fd;
+ }
+
ret = evloop_add(fd, EPOLLIN, evdev_process_events);
if (ret < 0)
{
logmsg(LOG_ERR, "Could not add device to event loop");
+ if (fd == internal_kbd_fd)
+ internal_kbd_fd = -1;
+
+ close(fd);
+
return -1;
}
@@ -884,6 +908,8 @@ evdev_init(void)
int ndevs;
int fd;
+ internal_kbd_fd = -1;
+
ndevs = 0;
for (i = 0; i < EVDEV_MAX; i++)
{
--
pommed - hotkeys handler for Apple laptops
More information about the Pommed-commits
mailing list