Created attachment 132700 [details] pactl list outputs Having module-switch-on-port-available loaded and plugging in a headphone, pulseaudio correctly switches the active output port from analog-output-speaker to analog-output-headphones. It does not change the input ports, even though a headset microphone becomes available > diff pactl_list_noheadset pactl_list_headset > < analog-input-headphone-mic: Microphone (priority: 8700, not available) > < analog-input-headset-mic: Headset Microphone (priority: 8700, not available) > --- > > analog-input-headphone-mic: Microphone (priority: 8700) > > analog-input-headset-mic: Headset Microphone (priority: 8700) I.e.the expected behaviour would be that also the input port is switched: > diff pactl_list_headset pactl_list_headset_expected > < Active Port: analog-input-internal-mic > --- > > Active Port: analog-input-headset-mic The ports are detected by default as follows > analog-input-internal-mic: Internal Microphone (priority: 8900, latency offset: 0 usec) > Properties: > device.icon_name = "audio-input-microphone" > analog-input-headphone-mic: Microphone (priority: 8700, latency offset: 0 usec, not available) > Properties: > device.icon_name = "audio-input-microphone" > analog-input-headset-mic: Headset Microphone (priority: 8700, latency offset: 0 usec, not available) > Properties: > device.icon_name = "audio-input-microphone" Note that both input-headset-mic and input-headphone-mic have the same priority. On my system only input-headset-works correctly and I would expect it to be the preferred port. (But maybe this depends on the type of headset being plugged in, in which case the default might be sensible?) However, even changing the priorities to prefer input-headset-mic over input-headphone-mic does not fix the bug (i.e. when plugging in the headset, the active port stays input-internal-mic). > analog-input-internal-mic: Internal Microphone (priority: 8900, latency offset: 0 usec) > Properties: > device.icon_name = "audio-input-microphone" > analog-input-headphone-mic: Microphone (priority: 8700, latency offset: 0 usec, not available) > Properties: > device.icon_name = "audio-input-microphone" > analog-input-headset-mic: Headset Microphone (priority: 8500, latency offset: 0 usec, not available) > Properties: > device.icon_name = "audio-input-microphone" I am attaching the complete pactl list outputs. Pulseaudio is built on Gentoo with the following useflags: ➜ ~ equery uses pulseaudio [ Legend : U - final flag setting for installation] [ : I - package is installed with flag ] [ Colors : set, unset ] * Found these USE flags for media-sound/pulseaudio-10.0: U I + + X : Build the X11 publish module to export PulseAudio information through X11 protocol for clients to make use. Don't enable this flag if you want to use a system wide instance. If unsure, enable this flag. + + abi_x86_32 : 32-bit (x86) libraries + + alsa : Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture) + + alsa-plugin : Request installing media-plugins/alsa-plugins with PulseAudio plugin enabled. This ensures that clients supporting ALSA only will use PulseAudio. + + asyncns : Use libasyncns for asynchronous name resolution. + + bluetooth : Enable Bluetooth Support + + caps : Use Linux capabilities library to control privilege + + dbus : Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc) - - doc : Build the doxygen-described API documentation. - - equalizer : Enable the equalizer module (requires sci-libs/fftw). + + gdbm : Use sys-libs/gdbm to store PulseAudio databases. Recommended for desktop usage. This flag causes the whole package to be licensed under GPL-2 or later. + + glib : Add support to dev-libs/glib-based mainloop for the libpulse client library, to allow using libpulse on glib-based programs. + + gnome : Use GConf to store user preferences on streams and so on. Don't enable this flag if you want to use a system wide instance. If unsure, enable this flag. + + gtk : Add support for x11-libs/gtk+ (The GIMP Toolkit) + + ipv6 : Add support for IP version 6 - - jack : Add support for the JACK Audio Connection Kit - - libressl : Use dev-libs/libressl as SSL provider (might need ssl USE flag), packages should not depend on this USE flag - - libsamplerate : Build with support for converting sample rates using libsamplerate - - lirc : Add support for lirc (Linux's Infra-Red Remote Control) - - native-headset : Build with native HSP backend for bluez 5. - - ofono-headset : Build with oFono HFP backend for bluez 5, requires net-misc/ofono. + + orc : Use dev-lang/orc for just-in-time optimization of array operations + + qt4 : Add support for the Qt GUI/Application Toolkit version 4.x - - realtime : (Restricted to >=media-sound/pulseaudio-0.9.21.2-r1) Makes PulseAudio use RealtimeKit (sys-auth/rtkit) to get real-time priority while running. - - sox : Add support for Sound eXchange (SoX) + + ssl : Use dev-libs/openssl to provide support for RAOP (AirPort) streaming. + + systemd : Build with sys-apps/systemd support to replace standalone ConsoleKit. + + tcpd : Add support for TCP wrappers - - test : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore + + udev : Enable virtual/udev integration (device discovery, power and storage device support, etc) + + webrtc-aec : Uses the webrtc.org AudioProcessing library for enhancing VoIP calls greatly in applications that support it by performing acoustic echo cancellation, analog gain control, noise suppression and other processing. + + zeroconf : Support for DNS Service Discovery (DNS-SD)
I believe this is already fixed: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=e3b64d8fd394fdd0b70dfd14a4a9b90c27369a99
Thanks for checking this. Indeed the commit does fix the priorities :). Unfortunately it does not fix the main problem of this bug report, which is not the wrong priorities, but that the input port is not automatically switched from analog-input-internal-mic to analog-input-headset-mic as soon as the latter becomes available. I compiled the current master version of pulseaudio and can confirm that this behaviour is still present.
Sorry for not paying attention! The internal mic has higher priority than the headset mic, which explains why the port doesn't get changed. The internal speakers also have higher priority than headphones, but when headphones are plugged in, we mark the internal speakers as unavailable. We use the same trick with some external mic ports, but not with headset-mic or headphone-mic. I believe the reason is that with headset-mic/headphone-mic, the jack information that we get from alsa doesn't include exact information about what was plugged in. We only know that either headphones, a headset or a microphone was plugged in. Marking the internal mic as unavailable would break the common case where headphones without a mic were plugged in. Ubuntu solves this by popping up a GUI that asks what you plugged in. Pulseaudio just doesn't have enough information to automatically always select the right port. Defaulting to the internal mic is safer than the headset mic. I'll mark this as NOTABUG, but if you think there is a solution, feel free to reopen.
Thanks for the elaboration! What you say does make sense. I would argue though that there should be an option for .config/pulse/default.pa so that the "marking the internal mic as unavailable as soon as an external input is plugged in" workaround is applied. Or is this already possible with the current config syntax?
A configuration option is a reasonable request, thanks for the idea. You can add the following to /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf: [Jack Headphone Mic] state.plugged = no state.unplugged = unknown [Jack Headset Mic] state.plugged = no state.unplugged = unknown That should make the internal mic become unavailable when something is plugged in. This change will be overwritten whenever pulseaudio is updated, though. It's not currently possible to configure this in the home directory.
Thanks Tanu, that works great. I look forward to the inclusion of a home directory configuration option.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/194.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.