[ltp] a few long questions with potentially short answers
Jens Rutschmann
linux-thinkpad@linux-thinkpad.org
Tue, 10 Mar 2009 14:57:49 +0100
Tino Keitel wrote on 10.03.2009 12:59:
> I'm open for suggestions how to achieve this in a better way.
I don't know if it is better, but I'm doing it using acpid.
Add the following to /etc/acpi/default.sh (or whatever the acpi event handler
script of your distribution is). This is working on my T61 using Gentoo.
Add the toggle() function at at the top of the file:
toggle() {
exec 3< $1
read <&3 oldValue
case "${oldValue}" in
0)
echo 1 > $1
;;
1)
echo 0 > $1
;;
esac
}
Then modify the large case statement to contain the following:
case "$group" in
ibm)
case "$action" in
hotkey)
case "$value" in
00001005)
toggle /sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi/bluetooth_enable
;;
You *may* need to restart acpid after that. There may be some optimizations for
the scripts, as I'm not really familiar with bash scripting.
Best regards,
Jens