Re: capturing volume keys for 2 alsa devices

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

 



Louis-David Mitterrand wrote:
> These are keycodes 174 and 176, which are pretty standard volume_down 
> and volume_up codes.
>
> Now I also have a plantronics usb headset plugged into that box and its 
> little volume control unit emits the _same_ 174, 176 codes as the 
> keyboard knob. Ideally I'd like to intercept these keys and apply them 
> to "amixer -c1" (headset) instead of -c0 (sound card).
>
> Has anybody found a way to do that?
>   
I don't have an answer, but I have an idea.   If you run "fuser 
/dev/snd/*" or "lsof /dev/snd/*" you can find out which processes and 
which devices are open.   If you notice, for example, that 
/dev/snd/pcmC0D0p is open then you want to control the volume for card 
0.  If it's xmms that's got it open then perhaps you want to do the xmms 
thing to change the volume rather than tinkering with amixer.

If you've got music playing through the speakers with xmms and a skype 
conversation going through the headset then you'd probably wind up 
changing the volume for both.

On the other hand, I it's possible to capture the events from 
/dev/input/eventN so you can tell if they're coming from the keyboard 
(which you might want to control the speaker volume) or the headset 
(similarly).  If you google for "evtest" you'll find something that you 
might be able to use to get you started.  For me, /dev/input/event1 
appears to be the keyboard and /dev/input/event8 is the headset -- it'll 
be different for you (unless you happen to have the same number of mice 
and ancillary buttons) but evtest also prints out the device name.

Good luck.

jch



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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