Re: The volume buttons on Lenovo Thinkpad X61S (was: Re: Console beep on Lenovo Thinkpad X61S)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 26 Mar 2010, Lars Bjørndal wrote:

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 <perex@xxxxxxxx>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux