The volume buttons on Lenovo Thinkpad X61S (was: Re: [Alsa-user] Console beep on Lenovo Thinkpad X61S)
Quoted 3 lines · Lars Bjørndal
The volume buttons up, down and mute, doesn't work from within the console. How could that be fixed? Please note that I use Fedora 12, and I don't use X.
It's a bit different thing. The ACPI events are translated as key-press events to the /dev/input/event* interface. So you need an application (daemon) watching for these key-press events and modifying the volume using the ALSA mixer interface. The GUI programs do this.
Here is a short program in python reading input events and translating them to amixer calls:
=========== cut here ===================
#!/usr/bin/python
import struct
import os
# use 'evtest' program to determine right /dev/input device and code
acpievents = "/dev/input/event1"
fmt = 'iihhi'
fd = open(acpievents, "rb")
event = fd.read(16)
while event:
(time1, time2, type, code, value) = struct.unpack(fmt, event)
if type == 1:
if code == 115: # keypress VOLUMEUP
os.system("amixer -q -c 0 set PCM 10%+")
elif code == 114: # keypress VOLUMEDOWN
os.system("amixer -q -c 0 set PCM 10%-")
event = fd.read(16)
fd.close()
================ cut here =============Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel