Skip to content

Commit 98a82fd

Browse files
authored
Merge pull request #3792 from cmitu/audiosettings-another-pi-ditto
audiosettings: fix Pi5 detection
2 parents b25450b + 6e74abe commit 98a82fd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scriptmodules/supplementary/audiosettings.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function depends_audiosettings() {
2222

2323
function gui_audiosettings() {
2424
# Check if the internal audio is enabled
25-
if [[ `aplay -ql | grep bcm2835 | wc -l` < 1 ]]; then
25+
if [[ `aplay -ql | grep -e bcm2835 -e vc4hdmi | wc -l` < 1 ]]; then
2626
printMsgs "dialog" "On-board audio disabled or not present"
2727
return
2828
fi
@@ -31,7 +31,7 @@ function gui_audiosettings() {
3131
# * enable_compat_alsa: true - single soundcard, output is routed based on the `numid` control
3232
# * enable_compat_alsa: false - one soundcard per output type (HDMI/Headphones)
3333
# When PulseAudio/PipeWire is enabled, try to configure it and leave ALSA alone
34-
if _pa_cmd_audiosettings systemctl -q --user is-enabled {pulseaudio,pipewire-pulse}.socket; then
34+
if _pa_cmd_audiosettings systemctl -q --user is-enabled {pulseaudio,pipewire-pulse}.service; then
3535
_pulseaudio_audiosettings
3636
elif aplay -l | grep -q "bcm2835 ALSA"; then
3737
_bcm2835_alsa_compat_audiosettings
@@ -255,10 +255,13 @@ function _pulseaudio_audiosettings() {
255255
options+=("$sink_index" "$sink_label")
256256
done < <(_pa_cmd_audiosettings pactl list sinks | \
257257
awk -F [:=] 'BEGIN {idx=0}; /Name:/ {
258-
do {getline} while($0 !~ "alsa.name");
259-
gsub(/"|bcm2835[^a-zA-Z]+/, "", $2);
260-
print idx,$2;
261-
idx++}'
258+
do {getline} while($0 !~ "alsa.name" && $0 !~ "Formats");
259+
if ( $2 != "" ) {
260+
gsub(/"|bcm2835[^a-zA-Z]+/, "", $2);
261+
print idx,$2;
262+
idx++
263+
}
264+
}'
262265
)
263266
_pa_cmd_audiosettings pactl info | grep -i pipewire >/dev/null && sound_server="PipeWire"
264267
local cmd=(dialog --backtitle "$__backtitle" --menu "Set audio output ($sound_server)" 22 86 16)

0 commit comments

Comments
 (0)