Fixing Sony SZ volume and brightness buttons - ACPI
For a couple of years, my Sony SZ hasn't had working volume or brightness buttons under Ubuntu. If I remember correctly, they worked fine on Ubuntu 6.10, but since then they haven't worked right.
The volume buttons issue double events, so it's impossible to fine-tune volume. The mute button mutes and then instantly unmutes.
Since I've upgraded to 64-bit Ubuntu, the screen brightness buttons haven't worked, either.
Introduction
ACPI (a power-management system about which I know little) issues interrupts in response to events like pressing a hardware button (for example "S1" on the Sony SZ), or a key combination (Fn-F3 is supposed to reduce volume), or power events, among other things.You can watch the incoming ACPI event stream with the acpi_listen command. An event like pressing Fn-F3 prints out:
sony/hotkey SPIC 00000001 0000000e
sony/hotkey SPIC 00000001 0000003b
(0e is when F3 is pressed down, 3b is when it's released.) The Linux acpid daemon reads event descriptions from /etc/acpi/events/, then executes the "action" attribute for files that match an incoming event. For example, here's the contents of /etc/acpi/events/sony-volume-down:
# /etc/acpi/events/sony-volume-down
event=sony/hotkey SPIC 00000001 0000000e
action=/etc/acpi/voldownbtn.sh
So when "SPIC 00000001 0000000e" comes across the wire, acpid runs /etc/acpi/voldownbtn.sh. Here's the *unpatched* contents of /etc/acpi/voldownbtn.sh:
Put sony-brightness-up and sony-brightness-down in /etc/acpi/events. These two are from my previous 32-bit installation.
Put sonybright.sh in /etc/acpi. This one is from my 32-bit installation but I edited it to make it work better with a package called smartdimmer.
#!/bin/sh
test -f /usr/share/acpi-support/key-constants || exit 0
. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_VOLUMEDOWN
Fixing the audio buttons Fn-F2, Fn-F3, Fn-F4
I don't know why, but the volume down event is issued once by something in the system, then issued again by acpi_fakekey. For some reason the volume controls lower or raise the volume, then issue the Sony volume control, which issues an ACPI event, which lowers or raises them again. I commented out the call to acpi_fakekey in /etc/acpi/voldownbtn.sh, /etc/acpi/volupbtn.sh, and /etc/acpi/mutebtn.sh and now they correctly only increase or decrease one notch, including the on-screen display.Fixing the brightness buttons, Fn-F5, Fn-F6
For whatever reason, the 64-bit installation of Ubuntu 9.04 does not have support for the Sony brightness buttons.Put sony-brightness-up and sony-brightness-down in /etc/acpi/events. These two are from my previous 32-bit installation.
Put sonybright.sh in /etc/acpi. This one is from my 32-bit installation but I edited it to make it work better with a package called smartdimmer.
sudo apt-get install smartdimmerFinally, in order to reload the event descriptions from /etc/acpi/events:
sudo killall -HUP acpid
No comments:
Post a Comment