Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sof-hda-dsp: Reverse order and priority of headset and headphone mic #21

Closed
wants to merge 1 commit into from

Conversation

juimonen
Copy link
Contributor

Headset mic is the analog input source in 99% of the cases compared to
headphone mic, so change it's priority higher.

Jaska Uimonen jaska.uimonen@linux.intel.com

Headset mic is the analog input source in 99% of the cases compared to
headphone mic, so change it's priority higher.

Jaska Uimonen <jaska.uimonen@linux.intel.com>
@juimonen
Copy link
Contributor Author

@perexg I don't see effect in ubuntu UI with just changing the CapturePriorities, the UI is taking the 1st on the list (I assume). That's why I also flipped around the two mic definitions... The headset mic is much much more common than stereo analog mic.

@perexg
Copy link
Member

perexg commented Apr 17, 2020

If it's gnome, you're probably hit this:

https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/10

I don't want to modify the configuration just because a tool in the chain is not ready.

Headset has already higher priority than Mic2, thus it should be preferred.

@juimonen
Copy link
Contributor Author

@perexg so in pulseaudio smaller value means higher prio or vice versa? And agree that priority should be obeyed...

@perexg
Copy link
Member

perexg commented Apr 17, 2020

Higher value means higher priority. In UCM the Headset device has priority 300, Mic2 has priority 200, thus Headset should be selected when something is inserted to "Headphone Mic Jack" .

You can verify priorities using pactl list cards command.

Another point is that the "Headphone Mic Jack" is shared with both Headset and Mic2 devices, thus the auto-detection is impossible. In this case, GUI should ask, what was inserted to the jack (the gnome / and the following PA bug). The gnome code is full of thinkos and assumptions. We need to find an abstract way to handle this.

@juimonen
Copy link
Contributor Author

@perexg ok. Yes this was my thinking also.

I'm not sure how the selection is done now, but with Dell devices without the pop-up, the default selection is "headphone mic" and it will mute the headset -> really bad user experience.

So obviously the priorities in this PR are wrong (they are correct in original), but I would still swap the mic device definitions around. I know it is a "hack", but it would save us from lot of bugs/trouble with this kind of devices without the pop-up. So if there's some stupid UI selecting the first item in the list, it would still give decent experience for most.

But if you disagree, still fine. Then we'll close this and give the issue to gnome folks.

@perexg
Copy link
Member

perexg commented Apr 17, 2020

I think that gnome should activate the device/port by priority when the available state is unknown from the pulseaudio. The unknown state means that something was inserted, but PA cannot determine the purpose. I don't see PA_PORT_AVAILABLE_UNKNOWN handling in gvc-mixer-control.c (gnome). All tests are only against PA_PORT_AVAILABLE_NO.

Edit: It seems that the uknown state is not correct for this case. The active ports by the should be marked as PA_AVAILABLE_YES (https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/4dc73f5167f7d4c2cf1d3e9c8bb7c796f3a35a4e/src/modules/alsa/alsa-ucm.c#L2192). I took this info from https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/10#note_758897 , but it is probably not correct.

@jason77-wang
Copy link
Contributor

Will this PR be merged? I tested this PR on the ubuntu-20.04, it could fix the headphone problem on the Dell machines. (Dell machines have multi-functional audio jack).

@perexg
Copy link
Member

perexg commented Apr 30, 2020

It's not related to UCM config. Ask gnome guys to fix the input selection in https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/10 or propose the gnome fix which will use the new pulseaudio interface for the port / jack availability description: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/283 . I did the PA part but I don't have time (and to tell you truth, I don't want to bother with GUI either).

In other words: Gnome should invoke a pop-up dialog with the question, what was connected to the shared jack in this case.

@jason77-wang
Copy link
Contributor

ubuntu 20.04 uses gnome, but there are many variants like Lbuntu and Kbuntu, they don't uses gnome at all, even the gnome has the pop-up dialogue, but those variants could not share the fix with the gnome.

@perexg
Copy link
Member

perexg commented Apr 30, 2020

Yes, but if those window managers also manage the sound settings, the PA card ports should be selected by the priority (automatic way) or manually (user dialog) not using the creation order. If we don't fix this now, the problem will raise anyway.

Ohh, you're the author of the mentioned gnome merge request. If you can fix gnome, it would be nice.

@juimonen
Copy link
Contributor Author

juimonen commented May 6, 2020

@perexg So should Pulseaudio use currently the priority? or is that broken? If the priority selection would work, we would not have this issue.... or is the idea that UI manager knows the priority?

@jason77-wang
Copy link
Contributor

jason77-wang commented May 8, 2020

@perexg and @juimonen

I will try to change the MR for libgvc based on the available_group and type members.
But for those don't use gnome, I send a PR to pulseaudio to let pulseaudio handle them with priority considered. Hope this could be accepted.
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/294

@perexg
Copy link
Member

perexg commented Jun 23, 2020

The pulseaudio MR was accepted (although I don't agree with this). It seems that PA implementation of some things is really weak. Closing for now.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/294

@perexg perexg closed this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants