You are not logged in.

#1 2017-07-09 16:47:14

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

[SOLVED] Automute speakers on plugging in headphones?

Hi all, I have a relatively simple question. I have pulseaudio installed because of one feature it has, muting the speakers when plugging in headphones, and unmuting them when unplugging them.

Is it possible to get the same thing with Alsa alone? If there is I'm completely oblivious to it ... maybe writing Udev rules?

I wouldn't need pulseaudio if I could get this one feature in Alsa, and maybe (for all I know) it is now been implemented since the last time I tried an alsa only setup.

Any help is appreciated.

Last edited by felixculpa (2017-07-09 19:21:09)

Offline

#2 2017-07-09 16:54:00

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: [SOLVED] Automute speakers on plugging in headphones?

That's never a pulseaudio thing. It's a driver feature (that relies on the hardware jack-sensing feature). There's a mixer control called "Auto-Mute" or so determining whether the feature is enabled.

What pulseaudio does is merely mapping two "ports" to two pairs of mute/unmute state, but has nothing to do with the "auto" part.

P.S. Unless you mean USB headphones, which are technically also external sound card. For those it's gonna be tricky to implement the same thing with "ALSA" because to switch card you need to edit some conf like ~/.asoundrc.

Last edited by tom.ty89 (2017-07-09 17:00:45)

Offline

#3 2017-07-09 16:54:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,430

Re: [SOLVED] Automute speakers on plugging in headphones?

Does your card have an explicit control for that? Usually called auto-mute or similar, what's the output of

aplay -l
amixer -c$cardindex from aplay -l

If it doesn't jack events are usually not registered by udev, but rather trigger ACPI events, how you can react to those is described here: https://wiki.archlinux.org/index.php/Acpid

Offline

#4 2017-07-09 18:30:30

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

Re: [SOLVED] Automute speakers on plugging in headphones?

It looks like auto-mute capability is present.

aplay -l output:

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC272X Analog [ALC272X Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC272X Digital [ALC272X Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

amixer -c0 output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 58 [91%] [-6.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 0 [0%] [-64.00dB] [off]
  Front Right: Playback 0 [0%] [-64.00dB] [off]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 64 [100%] [0.00dB] [on]
  Front Right: Playback 64 [100%] [0.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 31
  Front Left: Capture 19 [61%] [12.00dB] [on]
  Front Right: Capture 19 [61%] [12.00dB] [on]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Enabled'
Simple mixer control 'Internal Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Loopback Mixing',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'

Last edited by felixculpa (2017-07-09 18:33:00)

Offline

#5 2017-07-09 18:42:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,430

Re: [SOLVED] Automute speakers on plugging in headphones?

Well yeah then it should simply work. Does it not?

Offline

#6 2017-07-09 19:20:31

felixculpa
Member
From: Alberta, Canada
Registered: 2012-06-12
Posts: 268

Re: [SOLVED] Automute speakers on plugging in headphones?

Yes! I guess it was always a driver issue with my other laptops. After uninstalling all pulseaudio packages it seems to still work exactly how I wanted, I can see it working through alsamixer by plugging and unplugging my headphones.

Offline

Board footer

Powered by FluxBB