Bug#1021179: pipewire-pulse: KDE Plasma+ALC4080 onboard card: unable to select working profile

2022-10-29 Thread Maurizio Avogadro

tags 1021179 + patch
thanks

Hi Dylan

Jaroslav Kysela prepared a MR [1] that solves the issue. The patch is attached 
here unchanged: it applies cleanly to the source tree of pipewire v0.3.59-1, I 
could simply add it to the series and rebuild the binaries.


Thanks

[1] https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1429From a2278a5f70fcc03ee72173c44896928d4c6b88d5 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela 
Date: Sat, 29 Oct 2022 20:22:06 +0200
Subject: [PATCH] spa: support the speakers (output) only case in
 report_jack_state()

The Realtek ALC4080 USB audio device (integrated in the
motherboards) can detect the presence on all I/O jacks.

If user connects only speakers, it's a valid case.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744
---
 spa/plugins/alsa/acp/acp.c | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c
index f23232ed3..c49c9e088 100644
--- a/spa/plugins/alsa/acp/acp.c
+++ b/spa/plugins/alsa/acp/acp.c
@@ -624,7 +624,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
 	pa_card *impl = snd_mixer_elem_get_callback_private(melem);
 	snd_hctl_elem_t *elem = snd_mixer_elem_get_private(melem);
 	snd_ctl_elem_value_t *elem_value;
-	bool plugged_in;
+	bool plugged_in, any_input_port_available;
 	void *state;
 	pa_alsa_jack *jack;
 	struct temp_port_avail *tp, *tports;
@@ -735,6 +735,31 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
 	if (impl->card.active_profile_index != ACP_INVALID_INDEX)
 		active_available = impl->card.profiles[impl->card.active_profile_index]->available;
 
+	/* First round - detect, if we have any input port available.
+	   If the hardware can report the state for all I/O jacks, only speakers
+	   may be plugged in. */
+	any_input_port_available = false;
+	PA_HASHMAP_FOREACH(profile, impl->profiles, state) {
+		pa_device_port *port;
+		void *state2;
+
+		if (profile->profile.flags & ACP_PROFILE_OFF)
+			continue;
+
+		PA_HASHMAP_FOREACH(port, impl->ports, state2) {
+			if (!pa_hashmap_get(port->profiles, profile->profile.name))
+continue;
+
+			if (port->port.direction == ACP_DIRECTION_CAPTURE &&
+			port->port.available != ACP_AVAILABLE_NO) {
+any_input_port_available = true;
+goto input_port_found;
+			}
+		}
+	}
+input_port_found:
+
+	/* Second round */
 	PA_HASHMAP_FOREACH(profile, impl->profiles, state) {
 		pa_device_port *port;
 		void *state2;
@@ -768,7 +793,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
 
 		if (has_input_port && !has_output_port && found_available_input_port)
 			available = ACP_AVAILABLE_YES;
-		if (has_output_port && !has_input_port && found_available_output_port)
+		if (has_output_port && (!has_input_port || !any_input_port_available) && found_available_output_port)
 			available = ACP_AVAILABLE_YES;
 		if (has_output_port && has_input_port && found_available_output_port && found_available_input_port)
 			available = ACP_AVAILABLE_YES;
-- 
GitLab



Bug#1021179: pipewire-pulse: KDE Plasma+ALC4080 onboard card: unable to select working profile

2022-10-05 Thread Maurizio Avogadro

tags 1021179 + upstream
thanks

https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744



Bug#1021179: pipewire-pulse: KDE Plasma+ALC4080 onboard card: unable to select working profile

2022-10-05 Thread Dylan Aïssi
Hi Maurizio,

Le lun. 3 oct. 2022 à 13:48, Maurizio Avogadro  a écrit :
>
> while within Gnome I can make the audio subsystem work by manually selecting
> the "Play HiFi quality Music" profile (defined in ALSA UCM) of my onboard
> Realtek ALC4080 USB audio card, in KDE Plasma its only available profile is
> "off", which means no sound output is possible. This started to be a problem
> since pipewire-pulse became a dependency of gnome-core.
>
> For the HDMI audio device, which I don't use and I keep on its default "off"
> profile, a working profile can instead be selected in both Gnome and KDE
> Plasma: this makes me suspect I'm facing an issue that is specific to my sound
> card, possibly having something to do with its UCM configuration.
>

Thanks for opening this bug report.

This seems an upstream bug which is related to your devices,
so can you report this issue on the upstream bug tracker?

https://gitlab.freedesktop.org/pipewire/pipewire/-/issues

You can also find assistance on the upstream IRC channel #pipewire

Best,
Dylan



Bug#1021179: pipewire-pulse: KDE Plasma+ALC4080 onboard card: unable to select working profile

2022-10-04 Thread Maurizio Avogadro
Interesting enough, there is an interesting difference between Pulseaudio and 
Pipewire in the output of


$ pactl list cards | grep -E '(Profile|available:)'

With Pulseaudio:
Profiles:
HiFi: Play HiFi quality Music (sinks: 3, sources: 2, priority:
8000, available: yes)
off: Spento (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: HiFi

With Pipewire:
Profiles:
off: Spento (sinks: 0, sources: 0, priority: 0, available: yes)
HiFi: Play HiFi quality Music (sinks: 3, sources: 2, priority:
8000, available: no)
Active Profile: off

The "HiFi" profile is not available with Pipewire; the profile can still be 
selected manually with the command


$ pacmd set-card-profile alsa_card.usb-Generic_USB_Audio-00 HiFi

which makes the card work perfectly.

As I described in my first message, in Gnome the working profile is not 
automatically selected (but can be selected manually: Gnome allows the 
selection of "not available" profiles), while in KDE Plasma only available 
profiles can be selected.




Bug#1021179: pipewire-pulse: KDE Plasma+ALC4080 onboard card: unable to select working profile

2022-10-03 Thread Maurizio Avogadro

Package: pipewire-pulse
Version: 0.3.59-1
Severity: important

Dear Maintainer,

while within Gnome I can make the audio subsystem work by manually selecting
the "Play HiFi quality Music" profile (defined in ALSA UCM) of my onboard
Realtek ALC4080 USB audio card, in KDE Plasma its only available profile is
"off", which means no sound output is possible. This started to be a problem
since pipewire-pulse became a dependency of gnome-core.

For the HDMI audio device, which I don't use and I keep on its default "off"
profile, a working profile can instead be selected in both Gnome and KDE
Plasma: this makes me suspect I'm facing an issue that is specific to my sound
card, possibly having something to do with its UCM configuration.

Disabling and masking the pipewire user units and enabling back pulseaudio
solves the issue; the pipewire-pulse daemon aims to be a drop-in replacement
for pulseaudio.

The involved hardware is a MSI MAG X570S TORPEDO MAX mainboard with a Realtek
ALC4080 USB audio card onboard.

Thanks!


-- System Information:
Debian Release: bookworm/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable-security'), (500, 
'proposed-updates'), (500, 'oldstable-proposed-updates'), (500, 'unstable'), 
(500, 'stable'), (500, 'oldstable'), (1, 'experimental')

Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.19.12-xanmod1-x64v2+amdnative (SMP w/16 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pipewire-pulse depends on:
ii init-system-helpers 1.65.2
ii pipewire 0.3.59-1

pipewire-pulse recommends no packages.

Versions of packages pipewire-pulse suggests:
ii libspa-0.2-bluetooth 0.3.59-1
ii pulseaudio-utils 16.1+dfsg1-2

-- debconf-show failed