diff -Nru /tmp/UtunBcBCmr/hotkey-setup-0.1/debian/changelog /tmp/IipO96uaJ2/hotkey-setup-0.1/debian/changelog --- /tmp/UtunBcBCmr/hotkey-setup-0.1/debian/changelog 2007-09-16 02:52:46.000000000 +0300 +++ /tmp/IipO96uaJ2/hotkey-setup-0.1/debian/changelog 2007-09-18 19:41:44.000000000 +0300 @@ -1,3 +1,18 @@ +hotkey-setup (0.1-17ubuntu18sladen1) unstable; urgency=low + + * Fix number of '.' in 'grep' mask string + * Set the top 8-bits of the mask and see if the they stick + * Add back in 'thinkpad-keys' lockfile logic + * 'thinkpad-keys': Move open("fifo") into loop to reduce + code duplication. + * Roll 'thinkpad-keys-update' into "thinkpad-keys --update"; + remove second binary and duplicated FIFO location. + * Change 'init.d' shebang from 'bash' to 'sh' + * Add alias '--no-brightness' for 'LENOVO'; move policy + decision from 'thinkpad-keys' to the 'init.d' + + -- Paul Sladen Tue, 18 Sep 2007 19:41:36 +0300 + hotkey-setup (0.1-17ubuntu18) gutsy; urgency=low * Fix build breakage diff -Nru /tmp/UtunBcBCmr/hotkey-setup-0.1/debian/init.d /tmp/IipO96uaJ2/hotkey-setup-0.1/debian/init.d --- /tmp/UtunBcBCmr/hotkey-setup-0.1/debian/init.d 2007-09-16 00:03:10.000000000 +0300 +++ /tmp/IipO96uaJ2/hotkey-setup-0.1/debian/init.d 2007-09-18 19:39:36.000000000 +0300 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh manufacturer=`dmidecode --string system-manufacturer` name=`dmidecode --string system-product-name` @@ -7,17 +7,24 @@ SAVED_STATE=/var/run/hotkey-setup THINKPAD_LOCKFILE=$SAVED_STATE.thinkpad-keys THINKPAD_PROC_HOTKEY=/proc/acpi/ibm/hotkey +THINKPAD_KEYS=/usr/sbin/thinkpad-keys # This is here because it needs to be executed both if we have a # Lenovo that also IDs as a ThinkPad, or if we have a real IBM one. do_thinkpad () { . /usr/share/hotkey-setup/ibm.hk - modprobe thinkpad-acpi - grep -q '0xff......' /proc/acpi/ibm/hotkey - if [ $? != 0 ]; then - modprobe uinput - modprobe nvram - thinkpad-keys $1 + modprobe thinkpad-acpi + # Try to enable the top 8-bits of the mask + sed -e '/mask:/s/.*\(....\)$/0xff\1/p;d' $THINKPAD_PROC_HOTKEY > $THINKPAD_PROC_HOTKEY + # If the top bit (ThinkPad key) sticks, skip the polling-daemon + if ! grep -q '0x[8-9a-f].....$' $THINKPAD_PROC_HOTKEY && test -x $THINKPAD_KEYS; then + if [ ! -c /dev/input/uinput ]; then + modprobe uinput + fi + if [ ! -c /dev/nvram ]; then + modprobe nvram + fi + $THINKPAD_KEYS $1 && touch $THINKPAD_LOCKFILE fi } @@ -79,7 +86,7 @@ LENOVO*) case "$version" in *ThinkPad*) - do_thinkpad LENOVO + do_thinkpad --no-brightness ;; *) . /usr/share/hotkey-setup/lenovo.hk diff -Nru /tmp/UtunBcBCmr/hotkey-setup-0.1/thinkpad-keys.c /tmp/IipO96uaJ2/hotkey-setup-0.1/thinkpad-keys.c --- /tmp/UtunBcBCmr/hotkey-setup-0.1/thinkpad-keys.c 2007-09-15 23:33:47.000000000 +0300 +++ /tmp/IipO96uaJ2/hotkey-setup-0.1/thinkpad-keys.c 2007-09-18 19:34:48.000000000 +0300 @@ -39,6 +39,7 @@ #define UINPUT_DEVICE "/dev/input/uinput" #define NVRAM_DEVICE "/dev/nvram" #define POLL_DELAY 50 /* milliseconds */ +#define UPDATE_FIFO "/var/run/thinkpadkeys.fifo" static int init_nvram(void) { @@ -244,11 +245,18 @@ int mask; char command; - if (argc > 1) { - if (strcmp (argv[1], "LENOVO") == 0) { + if (argc > 1) + if (!strcmp(argv[1], "--update") || !strcmp(argv[1], "-u")) + { + if((fifo = open (UPDATE_FIFO, O_WRONLY | O_NONBLOCK)) != -1) + { + write (fifo_fd, "1", sizeof(char)); + close(fifo_fd); + } + return EXIT_SUCCESS; + } + else if (!strcmp(argv[1], "--no-brightness") || !strcmp (argv[1], "LENOVO")) lenovo = 1; - } - } #if 1 /* Software volume control */ @@ -286,16 +294,14 @@ grok_nvram(nvram, state); - if (mkfifo ("/var/run/thinkpadkeys.fifo", 0600) < 0) { + if (mkfifo (UPDATE_FIFO, 0600) < 0) { if (errno != EEXIST) { - perror ("Creating fifo"); + perror ("Error creating fifo " UPDATE_FIFO); return 1; } } - fifo = open ("/var/run/thinkpadkeys.fifo", O_RDONLY); - - while (1) { + while ((fifo = open (UPDATE_FIFO, O_RDONLY)) != -1) { read (fifo, &command, sizeof(char)); grok_nvram(nvram, state + counter); compare_nvram(&buttons, state + (counter^1), state + counter); @@ -303,9 +309,8 @@ punt_keycodes(uinput, buttons, codes); counter^=1; close (fifo); - fifo = open ("/var/run/thinkpadkeys.fifo", O_RDONLY); } - + cleanup_uinput(SIGTERM); } diff -Nru /tmp/UtunBcBCmr/hotkey-setup-0.1/thinkpad-keys-update.c /tmp/IipO96uaJ2/hotkey-setup-0.1/thinkpad-keys-update.c --- /tmp/UtunBcBCmr/hotkey-setup-0.1/thinkpad-keys-update.c 2007-09-16 00:33:19.000000000 +0300 +++ /tmp/IipO96uaJ2/hotkey-setup-0.1/thinkpad-keys-update.c 1970-01-01 02:00:00.000000000 +0200 @@ -1,12 +0,0 @@ -#include -#include -#include -#include - -int main (int argc, char *argv[]) -{ - int fifo_fd = open ("/var/run/thinkpadkeys.fifo", O_WRONLY | O_NONBLOCK); - char command = '1'; - write (fifo_fd, &command, sizeof(char)); - return 0; -}