[ltp] Mute button toggle

André Wyrwa linux-thinkpad@linux-thinkpad.org
Wed, 24 Aug 2005 22:50:55 +0200


--=-e+6vgR2Xj0xr9Rouhrj8
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Hi,

> Yes, that's the way it works, it can be seen in the OSD in windows or wit=
h =20
> tpb. I agree nothing is lost in this way and it's probably the most =20
> sensible setup, but I still wonder if it's possible to change this =20
> behaviour, at least at software level.

Not really, but in a way, yes.

You can trigger mute button presses with tpb. And you can make tpb
launch a command on each press. Furthermore, you can control volume
through ibm-acpi using the following commands.

echo up   >/proc/acpi/ibm/volume
echo down >/proc/acpi/ibm/volume
echo mute >/proc/acpi/ibm/volume
echo 'level <level>' >/proc/acpi/ibm/volume

But...the problem is that in any case the mute button will always do a
mute. That means the only way to make it toggle mute state is to let it
mute and immediately afterwards use ibm-acpi to unmute it every second
time. Here's the trouble. Any script you could write can't really figure
if it should leave sound muted or unmute it, because the moment you
press the mute key the state in /proc/acpi/ibm/volume will be set to
mute and your script will always get a hold of that afterwards. So it
can't know if your sound was muted or unmuted before. The only thing you
could do is assume that on system startup your sound is always unmuted
or you could even forcibly onmute it using ibm-acpi. Then you could have
a file created, i.e. /var/state/mute that would always contain the
current mute state. Hence you cold make your script change that value on
every run and act accordingly. But this is pretty ugly if you ask me.

And after all, what's the point about it?

Andr=E9.


--=-e+6vgR2Xj0xr9Rouhrj8
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQBDDN2vEOp8fsnyxsQRAsxuAJ46B64oXC2aH3SQ7pWGRwBstblhKgCgmfT5
gV1RCJ+rmxqjmypEyuS1EhQ=
=LJL+
-----END PGP SIGNATURE-----

--=-e+6vgR2Xj0xr9Rouhrj8--