Switch between speakers and headphones with PulseAudio (was Re: HDA jack retasking)

Ahmad Samir ahmadsamir3891 at gmail.com
Tue Oct 1 05:08:17 UTC 2013


On 20 August 2013 00:27, Raman Gupta <rocketraman at gmail.com> wrote:

> On 08/19/2013 01:10 AM, Raman Gupta wrote:
> > Next problem: getting PulseAudio to recognize that I have both
> > headphones plugged in (to the retasked jack) as well as regular
> > speakers, and switch between them at command.
> >
> > PulseAudio shows two output Ports: "Analog Output" as well as
> > "Headphones", but both ports output to my headphones. Without the
> > retasking, both ports output to my speakers. Frustrating.
>
> Just to follow up on this, as per the nice folks on #pulseaudio, it
> doesn't seem pulseaudio is capable of this yet, so I created:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=68286
>
> It can be worked around by using amixer to modify the hardware
> controls directly. For my card (HDA Intel PCH with Realtek ALC898
> chipset), here are the scripts I use:
>
> 1) enable speakers:
>
> #!/bin/sh
> amixer -c 0 sset "Auto-Mute Mode" Disabled
> amixer -c 0 sset "Headphone,1" mute
>
> 2) enable headphones:
>
> #!/bin/sh
> amixer -c 0 sset "Auto-Mute Mode" Enabled
> amixer -c 0 sset "Headphone,1" unmute
>
> Regards,
> Raman
>

I know this was from over than a month ago, but anyway.... you can use
something like this in a single script to toggle auto-mute:

#!/bin/sh
# check auto-mute state
amixer sget 'Auto-Mute Mode' | grep Item0 | grep -q Disabled
# $? is 0 if auto-mute is disabled
# $? is 1 if auto-mute is enabled
if [ "$?" -eq "0" ]; then
# unmute the headphones and mute the speakers
    amixer -c 0 sset "Auto-Mute Mode" Enabled
    amixer -c 0 sset "Headphone,1" unmute
else
# mute the headphones and umunte the spearkers
    amixer -c 0 sset "Auto-Mute Mode" Disabled
    amixer -c 0 sset "Headphone,1" mute
fi





> --

users mailing list
> users at lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
> Have a question? Ask away: http://ask.fedoraproject.org
>



-- 
Ahmad Samir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20131001/eda35b78/attachment.html>


More information about the users mailing list