Bug 81580 - Microphone port switch
Summary: Microphone port switch
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-21 00:16 UTC by Pali Rohár
Modified: 2018-07-30 09:37 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
output from alsa-info.sh (42.13 KB, text/plain)
2014-07-21 07:56 UTC, Pali Rohár
Details
alsa-info with unplugged jack (40.43 KB, text/plain)
2014-08-19 08:34 UTC, Pali Rohár
Details
alsa-info with nokia jack (40.41 KB, text/plain)
2014-08-19 08:34 UTC, Pali Rohár
Details
alsa-info.3.13.0-44-generic.combo (41.51 KB, text/plain)
2014-12-24 11:46 UTC, Pali Rohár
Details
alsa-info.3.13.0-44-generic.disconnected (41.52 KB, text/plain)
2014-12-24 11:47 UTC, Pali Rohár
Details
alsa-info.3.13.0-44-generic.headphones (41.51 KB, text/plain)
2014-12-24 11:47 UTC, Pali Rohár
Details
alsa-info.3.13.0-44-generic.microphone (41.51 KB, text/plain)
2014-12-24 11:47 UTC, Pali Rohár
Details
alsa-info.3.13.0-44-generic.nokia (41.51 KB, text/plain)
2014-12-24 11:47 UTC, Pali Rohár
Details
alsa-info.3.19.0-031900rc1-generic.combo (42.83 KB, text/plain)
2014-12-24 11:47 UTC, Pali Rohár
Details
alsa-info.3.19.0-031900rc1-generic.disconnected (42.84 KB, text/plain)
2014-12-24 11:48 UTC, Pali Rohár
Details
alsa-info.3.19.0-031900rc1-generic.headphones (42.83 KB, text/plain)
2014-12-24 11:48 UTC, Pali Rohár
Details
alsa-info.3.19.0-031900rc1-generic.microphone (42.83 KB, text/plain)
2014-12-24 11:48 UTC, Pali Rohár
Details
alsa-info.3.19.0-031900rc1-generic.nokia (42.83 KB, text/plain)
2014-12-24 11:48 UTC, Pali Rohár
Details

Description Pali Rohár 2014-07-21 00:16:11 UTC
I have laptop with 4 pins combo jack (mic input + headphones output) and when I plug (compatible) headphones then PA automatically switch output port from (internal) Speakers to Heaphones. But it does not switch input port from Internal Mic to (Jack) Mic automatically. If PA already switching audio output based on jack detection it should also automatically switch audio input when jack microphone is available. Reproducable with PA 3.0 and 5.0. With both versions only audio output is automatically switched bases on jack detection.
Comment 1 Raymond 2014-07-21 03:18:27 UTC
you have to post the output of alsa-info.sh

the auto mic selection is performed by the driver when the headset Mic use the Jack state of headphone 



https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/pci/hda?qt=grep&q=headset+mic
Comment 2 Pali Rohár 2014-07-21 07:56:01 UTC
Created attachment 103172 [details]
output from alsa-info.sh
Comment 3 Raymond 2014-07-21 12:01:14 UTC

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=73bdd597823e2231dc882577dbbaf8df92fe1775

do you mean the driver does auto swtich the input to headset Mic when heafeet is plugged

/sys/class/sound/hwC1D0/init_pin_configs:
0x12 0x90a60140
0x13 0x411111f0
0x14 0x90170110
0x15 0x0221401f
0x16 0x01014020
0x18 0x411111f0
0x19 0x01a19030
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x40700001
0x1e 0x411111f0

/sys/class/sound/hwC1D0/driver_pin_configs:
0x16 0x21014020
0x19 0x21a19030
0x1a 0x01a1913c



control.11 {
		iface MIXER
		name 'Capture Source'
		value 'Internal Mic'
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 'Dock Mic'
			item.1 'Headset Mic'
			item.2 'Internal Mic'
		}
	}
seem auto Mic selection is disabled when there is capture source control to select input source
Comment 4 Raymond 2014-07-21 15:12:46 UTC
this cannot be solved by pulseaudio in user space, 

there are some laptop (e.g. DELL alienware) which have headset, hp and Mic jacks 

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1302090

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1332900

only driver know which one is headphone or headset if you want to enable auto Mic with internal Mic, headset Mic, dock mic or dock headset mic
Comment 5 Pali Rohár 2014-07-21 15:17:03 UTC
So it is not pulseaudio who switching output port based on jack detection, but kernel driver?
Comment 6 Raymond 2014-07-21 15:47:57 UTC
when there are two detectable mic JacKS and internal Mic, 

there is no way to know the user want to use which input sources when both Mic jacks are plugged



if you really want auto Mic between headset Mic and internal mic if you notebook does not support conventional Mic jack

modify driver to create a headset Mic Jack which return the Jack state of headphones and don't create the headset Mic phantom jack


and use hda Jack retask to remove dock mic to enable auto mic




there are hda codec which only have one playback volume control but no headphone playback switch nor speaker playback switch

driver can perform auto mute by gpio or using pin ctl

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1334110
Comment 7 Pali Rohár 2014-07-21 16:03:00 UTC
What I want is to have some consistency. If I plug headphones (mic+output) into jack I want to set either both parts (mic+output) or none as default audio device.

Now when I plug headphones into jack, only audio output is switched for using from internal speakers into jack heaphones.

It is really stupid if I have active conference call (and using internal mic+internal speakers) and I plug headset (intput+output) into jack and only audio output is automatically switched from speakers to headphones... Mic should too.
Comment 9 Raymond 2014-07-22 02:38:26 UTC
+	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x16, 0x21014020 }, /* dock line out */
+			{ 0x19, 0x21a19030 }, /* dock mic */
+			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
+			{ }
+		},
+		.chained = true,
+		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
+	},
+	[ALC269_FIXUP_HEADSET_MODE] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc_fixup_headset_mode,
+	},
+	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc_fixup_headset_mode_no_hp_mic,
+	},
 


 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
+	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),


your laptop is using ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Comment 10 Raymond 2014-07-22 02:50:53 UTC
to enable auto Mic, the codec need to differentiate between  the headset and headphone

you have to provide out put of debugged version of alsa driver which show the headset is set to which modes : headphone, iPhone style headset, Nokia Style headset, Mic in
Comment 11 Raymond 2014-07-22 07:30:59 UTC
dirty workaound is to change to use headphone Jack to change the headset Mic if the notebook only support headset and don't support headphone


http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
Comment 12 Raymond 2014-07-22 15:11:33 UTC
static void alc_headset_mode_default(struct hda_codec *codec)
+{

+	}
+	snd_printdd("Headset jack set to headphone (default) mode.\n");
+}
+

seem driver initialized the Jack to headphone instead of headset by default
Comment 13 Pali Rohár 2014-07-22 15:14:13 UTC
what is difference between headset jack and headphone jack?
Comment 14 Raymond 2014-07-22 15:34:37 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=5780b627e24113323427c102175296ae43dfb9d7

those netbooks have one audio Jack which can be use as headphone or Mic , but they don't support headset

from user point of view, i will expect the driver initialize the Jack as Same as the icon next to the Jack
Comment 15 Raymond 2014-07-22 23:28:40 UTC
http://www.intel.com/support/motherboards/desktop/sb/CS-034198.htm

for desktop, those rear Mic and line in can be retasked as output to support surround5.1

for netbook, the headphone can be retasked as Mic.  

for those notebook with three/four jacks , those input jacks and headphone jacks can also be retasked as line out jacks to support surround 5.1/7.1
Comment 16 Raymond 2014-07-23 01:58:25 UTC
http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/pa-backend.c


Headphone Mic Jack - indicates headphone and mic-in mode share the same jack,
     i e, not two separate jacks. Hardware cannot distinguish between a
     headphone and a mic.
   Headset Mic Phantom Jack - indicates headset jack where hardware can not
     distinguish between headphones and headsets
   Headset Mic Jack - indicates headset jack where hardware can distinguish
     between headphones and headsets. There is no use popping up a dialog in
     this case, unless we already need to do this for the mic-in mode.

it seem that your notebbok cannot distinguish betweeen headphone and headset

do the user manual mention that it support headset only ?



control.20 {
		iface CARD
		name 'Headset Mic Phantom Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
Comment 17 Raymond 2014-07-23 02:25:35 UTC
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-July/079168.html

do module-switch-on-port-available work to those mini PC with one Jack but no internal speaker/Mic ?
Comment 18 Raymond 2014-07-23 11:52:40 UTC
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1169143


the patch is based on all those notebook support both headset and headphone but the implementation  does not setup those Jack for headset by default

you have to ask the author 

there may be some notebook using other codec which support headset only but not headphone
Comment 19 Raymond 2014-07-24 03:37:10 UTC
http://support.lenovo.com/en_IN/downloads/detail.page?DocID=PD025183

	To listen to the sound from your computer, connect a headphone or a headset that has a 3.5 mm 4-pole plug to the combo audio jack.

Note: 

The combo audio jack does not support a conventional microphone



seem some thinpad does not support conventional microphone but supplier both headphone and headset
Comment 20 Raymond 2014-07-24 09:05:10 UTC
http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/dialog-window.c

one of the reason may be
the program logic assume headphone mode always supported


d->hp_btn = create_icon_button(WDYPI_DIALOG_HEADPHONES, _("Headphones"), "audio-headphones");
    gtk_box_pack_start(GTK_BOX(d->icon_box), d->hp_btn, FALSE, TRUE, 0);
    if (show_headset) {
        d->hs_btn = create_icon_button(WDYPI_DIALOG_HEADSET, _("Headset"), "audio-headset");
        gtk_box_pack_start(GTK_BOX(d->icon_box), d->hs_btn, FALSE, TRUE, 0);
    }
    if (show_mic) {
        d->mic_btn = create_icon_button(WDYPI_DIALOG_MICROPHONE, _("Microphone"), "audio-input-microphone");
        gtk_box_pack_start(GTK_BOX(d->icon_box), d->mic_btn, FALSE, TRUE, 0);
    }
Comment 21 Raymond 2014-07-26 01:11:07 UTC
(In reply to comment #5)
> So it is not pulseaudio who switching output port based on jack detection,
> but kernel driver?

yes, it is the kerenl driver perform auto mute, pulseaudio just use the Jack detection control to find out which volume control of the selected audio path

in your case,  you may need to give up the support of headphone by using a new hint to force the driver to support headset only  when the codec cannot differentiate headset or headphone

the alternative way is to use what did you plugin to select the headset or headphone when ever you plugged
Comment 22 Pali Rohár 2014-08-15 06:48:59 UTC
So what to do? Do you need some other logs? Or cannot be auto mic switch implemented?
Comment 23 Raymond 2014-08-15 08:00:04 UTC
have you ask David who implement headset mic for dell notebook alsaid driver ?

https://bugzilla.kernel.org/show_bug.cgi?id=76611

it seem that  none of dell notebooks can dintinguish headset and notebook

but there are dell alienware notebook which have three jacks : headset, headphone and Mic jack

those alienware users are expect they don't need to use the pop up dialog
Comment 24 Raymond 2014-08-15 11:34:32 UTC
Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="PCM Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Dock Line Out Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001001c: OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x01014020: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Green
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x0c* 0x0d

Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Speaker Phantom Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x00010010: OUT EAPD
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x0c* 0x0d


does the playback work with dock line out, it seem that dock line out and internal speaker share dac and pcm playback volume
Comment 25 Pali Rohár 2014-08-15 11:54:42 UTC
I do not have dock/port replicator so I cannot test how it will work.
Comment 26 Raymond 2014-08-15 14:22:47 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio-Controls.txt

the driver should document if the capture source is really used for switch the function of combo jack
Comment 27 Raymond 2014-08-16 09:34:08 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=2041d56464a067461d7cc21734a0f024587ed2ff

this is the only headset Mic with sequence number 0x0c support Jack detect but does it really imply that it is capable of distinguish headset and headphone
Comment 28 David Henningsson 2014-08-19 07:24:42 UTC
(In reply to comment #7)
> What I want is to have some consistency. If I plug headphones (mic+output)
> into jack I want to set either both parts (mic+output) or none as default
> audio device.
> 
> Now when I plug headphones into jack, only audio output is switched for
> using from internal speakers into jack heaphones.
> 
> It is really stupid if I have active conference call (and using internal
> mic+internal speakers) and I plug headset (intput+output) into jack and only
> audio output is automatically switched from speakers to headphones... Mic
> should too.

Have you read the link Raymond pointed to:

http://voices.canonical.com/david.henningsson/2014/03/07/headset-jacks-on-newer-laptops/

We don't know if you plugged in a headphone or a headset, so the best we can do is to pop up a dialog asking you what you plugged in, so you can select "headphone" or "headset" by a simple click of a button. Which is what we do in Ubuntu 14.04.

(I was investigating whether to do some of this GUI related stuff in PulseAudio instead so it could help users of other distros as well, but Tanu was hesitant to adding GUI related stuff in PulseAudio.)
Comment 29 Pali Rohár 2014-08-19 07:40:51 UTC
If I understand correctly, you wrote that it is not possible to autodetect if device is headphone (line out) or headset (line out + line in), right?

But when I plug my old Nokia headset which has 4 pin jack (last pin is ground and it has both mic input and speakers output), kernel autodetect that something was inserted and automatically switch input from internal mic to jack mic.

So somemthing now detected that headphones with microphone was inserted... So why cannot be that autodetection used also for switching audio output from internal laptop speakers to headset jack?

Also I tried normal headphones (without mic, 3 pin jack) and nothing switched microphone input. So really HW/kernel/PA can somehow distinguish between headset and heaphones -- because I see in PA port config that input is automatically changed when I plug/unplug Nokia headset.

Or I missed something?
Comment 30 David Henningsson 2014-08-19 08:12:13 UTC
(In reply to comment #29)
> If I understand correctly, you wrote that it is not possible to autodetect
> if device is headphone (line out) or headset (line out + line in), right?
> 
> But when I plug my old Nokia headset which has 4 pin jack (last pin is
> ground and it has both mic input and speakers output), kernel autodetect
> that something was inserted and automatically switch input from internal mic
> to jack mic.
> 
> So somemthing now detected that headphones with microphone was inserted...
> So why cannot be that autodetection used also for switching audio output
> from internal laptop speakers to headset jack?
> 
> Also I tried normal headphones (without mic, 3 pin jack) and nothing
> switched microphone input. So really HW/kernel/PA can somehow distinguish
> between headset and heaphones -- because I see in PA port config that input
> is automatically changed when I plug/unplug Nokia headset.
> 
> Or I missed something?

Ok, this is confusing. Could you post alsa-info for both scenarios
1) with headset plugged in
2) with headphones plugged in?

...and we could compare them for differences?
Comment 31 Pali Rohár 2014-08-19 08:34:10 UTC
Created attachment 104872 [details]
alsa-info with unplugged jack
Comment 32 Pali Rohár 2014-08-19 08:34:45 UTC
Created attachment 104873 [details]
alsa-info with nokia jack
Comment 33 Pali Rohár 2014-08-19 08:38:57 UTC
This is interesting. Now I used older kernel version, but from ubuntu repository (3.13.0-32-generic #57~precise1-Ubuntu) and when I plugged nokia headset now it automatically siwtched both output and input to jack.

I'm sure that before only mic output was automatically switched and from first attachment I see that it was on upstream kernel 3.16.

So ubuntu kernel in precise has some patches which are not in upstream 3.16 which enable autoswitch also for output (not only mic input) -- or that autoswitch for output is broken in new kernels.

Now I do not have any classic 3 pin jack headpnes (without mic) to test, so if you need output from alsa-info please wait some time...
Comment 34 David Henningsson 2014-08-19 09:23:01 UTC
To double check, could you compare headphone and headset plugged in, on the same kernel version? To see that something actually reacts differently?
Comment 35 Raymond 2014-08-19 11:40:50 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=ab16c6dd79389761eca1366d809a002b44b7f960

auto selection of dock Mic, ext Mic and int mic was supported
Comment 36 Raymond 2014-08-19 11:59:48 UTC
(In reply to comment #29)
> If I understand correctly, you wrote that it is not possible to autodetect
> if device is headphone (line out) or headset (line out + line in), right?
> 

to switch between headphone and line out, the driver  need to change EAPD and pin ctl from OUT HP to OUT 

so change the capture source is not suitable for changing the role of the combo Jack:


so far it seem  none of those 4 pin combo Jack support to use as line in


but three pin Mic Jack can be switch to line in using the Mic Jack mode control by adding hint add_jack_mode
Comment 37 Raymond 2014-08-20 09:16:26 UTC
i think Palo expect his headset mic can work like those iPhone headset connected to macbook air , those Jack is dedicated to headset and does support headphone nor microphone
Comment 38 Raymond 2014-08-21 23:35:40 UTC
how about hacking headset-mic.conf use headphone jack 

but this mean you cannot use normal headphone or mic


http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf



[Jack Headset Mic]
required-any = any

[Jack Headset Mic Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Headphone]
-state.plugged = unknown
+required-any=any
Comment 39 Pali Rohár 2014-09-25 00:44:27 UTC
what I expect is that if I connect headset (input+output) to jack then pulseaudio automatically switch input+output from internal mic+speakers to headset connected to jack.

Now I tested 3.17-rc6 kernel and it switch only speakers output to headset. Microphone input was not switched. But it worked with ubuntu kernel (3.13.0-32-generic #57~precise1-Ubuntu).

So ubuntu has some special patch for it which is not in upstream kernel, or there is regression, it worked with older kernel but not with new.
Comment 40 Pali Rohár 2014-12-24 11:46:47 UTC
Created attachment 111277 [details]
alsa-info.3.13.0-44-generic.combo
Comment 41 Pali Rohár 2014-12-24 11:47:05 UTC
Created attachment 111278 [details]
alsa-info.3.13.0-44-generic.disconnected
Comment 42 Pali Rohár 2014-12-24 11:47:17 UTC
Created attachment 111279 [details]
alsa-info.3.13.0-44-generic.headphones
Comment 43 Pali Rohár 2014-12-24 11:47:27 UTC
Created attachment 111280 [details]
alsa-info.3.13.0-44-generic.microphone
Comment 44 Pali Rohár 2014-12-24 11:47:41 UTC
Created attachment 111282 [details]
alsa-info.3.13.0-44-generic.nokia
Comment 45 Pali Rohár 2014-12-24 11:47:53 UTC
Created attachment 111283 [details]
alsa-info.3.19.0-031900rc1-generic.combo
Comment 46 Pali Rohár 2014-12-24 11:48:04 UTC
Created attachment 111284 [details]
alsa-info.3.19.0-031900rc1-generic.disconnected
Comment 47 Pali Rohár 2014-12-24 11:48:18 UTC
Created attachment 111285 [details]
alsa-info.3.19.0-031900rc1-generic.headphones
Comment 48 Pali Rohár 2014-12-24 11:48:29 UTC
Created attachment 111286 [details]
alsa-info.3.19.0-031900rc1-generic.microphone
Comment 49 Pali Rohár 2014-12-24 11:48:41 UTC
Created attachment 111287 [details]
alsa-info.3.19.0-031900rc1-generic.nokia
Comment 50 Pali Rohár 2014-12-24 11:55:27 UTC
I uploaded new outputs from alsa-info.sh script. I tested it on Ubuntu 12.04 Precise release with lastest precise kernel 3.13.0-44-generic and also with new upstream kernel 3.19-rc1. Each test file has suffix:

* combo: connected both microphone (3 pins) and headphones (3 pins) via special reduction (4 pins) to jack port
* disconnected: nothing was connected to jack port
* headphones: standard headphones (3 pins) was connected to jack port
* microphone: only (stereo) microphone (3 pins) was connected to jack port
* nokia: Nokia Headset (headphones + microphone) (4 pins) was connected to jack port

Are these logs enough for analyze? Do you need something more?
Comment 51 David Henningsson 2015-01-05 10:22:00 UTC
So, if I understand you correctly, with the alsa-info.3.13.0-44-generic kernel, the system reacts differently depending on whether you plug in headphones or headset combo.

So I did a "diff -u alsa-info.3.13.0-44-generic.headphones alsa-info.3.13.0-44-generic.combo", but I couldn't see any differences that could result in PulseAudio reacting differently w r t jack detection.
Comment 52 Pali Rohár 2015-01-05 10:41:09 UTC
In both cases (headphones and combo) under 3.13.0-44-generic pulseaudio changes audio output when jack is inserted. But do not change audio input when combo is plugged. So I think that system reacts in same way.

But "diff -u alsa-info.3.13.0-44-generic.headphones alsa-info.3.13.0-44-generic.combo" contains some differences in "Converter:" lines.
Comment 53 David Henningsson 2015-01-05 10:48:57 UTC
(In reply to Pali Rohár from comment #52)
> In both cases (headphones and combo) under 3.13.0-44-generic pulseaudio
> changes audio output when jack is inserted. But do not change audio input
> when combo is plugged. So I think that system reacts in same way.

But in comment #29 you say that the system reacts in a different way depending on whether you plug in headphones or headsets. And that is what we are trying to verify here. But now you say they are reacting the same?

> But "diff -u alsa-info.3.13.0-44-generic.headphones
> alsa-info.3.13.0-44-generic.combo" contains some differences in "Converter:"
> lines.

The converter numbers are initialized on first playback/record. If they are zero, it probably means you have not had a stream running to/from the codec since the sound driver was last initialized (which usually happens on boot only, I think). They are unrelated to jack detection.
Comment 54 Pali Rohár 2015-01-05 11:45:20 UTC
I said that:

(In reply to Pali Rohár from comment #29)
> But when I plug my old Nokia headset which has 4 pin jack (last pin is
> ground and it has both mic input and speakers output), kernel autodetect
> that something was inserted and automatically switch input from internal mic
> to jack mic.

And I remember that pulseaudio really switched input to jack mic.

But now with same Nokia headset and with pulseaudio 5.0 and kernel 3.13.0-44-generic input is not switched.

So something must have been changed in kernel or pulseaudio since I did that tests. Otherwise I cannot explain different behaviour in past and now.
Comment 55 David Henningsson 2015-01-05 13:24:22 UTC
(In reply to Pali Rohár from comment #54)
> I said that:
> 
> (In reply to Pali Rohár from comment #29)
> > But when I plug my old Nokia headset which has 4 pin jack (last pin is
> > ground and it has both mic input and speakers output), kernel autodetect
> > that something was inserted and automatically switch input from internal mic
> > to jack mic.
> 
> And I remember that pulseaudio really switched input to jack mic.
> 
> But now with same Nokia headset and with pulseaudio 5.0 and kernel
> 3.13.0-44-generic input is not switched.
> 
> So something must have been changed in kernel or pulseaudio since I did that
> tests. Otherwise I cannot explain different behaviour in past and now.

Ok. If you can find a configuration (PA, kernel, etc) where the system acts differently between headphones and headsets, please submit alsa-info for those two scenarios.

If you can't find it, I think we should close this bug.
Comment 56 Raymond 2016-07-12 02:37:47 UTC
as the combo jack cannot differentiate headphone, headset , headset mic phantom jack is  created

you have to give up the support of headphone in order to allow headset mic can be auto selected 

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/sound/jack.h




enum snd_jack_types {
	SND_JACK_HEADPHONE	= 0x0001,
	SND_JACK_MICROPHONE	= 0x0002,
	SND_JACK_HEADSET	= SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,


use jack sense of headphone pin to represent both headphone and mic . need to modify dfriver to create headset jack instead of headphone jack and headset mic phantom jack
Comment 57 Leho Kraav (:macmaN :lkraav) 2016-07-12 05:03:29 UTC
I'm not sure I get understand the NEEDINFO state of this bug. What information is still missing? Currently on my Gnome 3.20 desktop, I'm also confused by needing to manually switch Input Device to Headset microphone for business calls, running pulseaudio-8.0 (has been the same for many previous versions, if not always). 

Why wouldn't pulseaudio automatically do this for me? Windows drivers seem to have no problems.
Comment 58 GitLab Migration User 2018-07-30 09:37:05 UTC
-- 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/50.


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.