• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# This file is part of PulseAudio.
4#
5# Copyright 2019 Russell Treleaven <rtreleaven@bunnykick.ca>
6#
7# PulseAudio is free software; you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# PulseAudio is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
19
20export LC_ALL=C
21header='________________'
22function cards_get {
23	local line
24	local re='/proc/asound/card([0-9])'
25	local cards=()
26	while read -r line; do
27		[[ $line =~ $re ]] && cards+="${BASH_REMATCH[1]} "
28	done <<< "$(ls --directory /proc/asound/card[0-9])"
29	echo $cards
30}
31function jacks_do {
32	local cards=($(cards_get))
33	for card in "${cards[@]}" ; do
34		echo "card=$card"
35		while read -r line; do
36			[[ $line != "" ]] && amixer -c$card cget "$line";
37		done <<< "$(amixer -c$card controls | grep Jack)"
38	done
39}
40function alsa_info_do {
41	alsa_info=$(which alsa-info.sh)
42	[ $alsa_info ] || alsa_info=$(which alsa-info)
43	[ $alsa_info ] || alsa_info='/usr/share/alsa-base/alsa-info.sh'
44	[ -f $alsa_info ] && {
45		$alsa_info --stdout
46		return
47	}
48	echo "neither alsa-info.sh or alsa-info were found"
49}
50function pulseaudio_ps_do {
51	ps aux | grep pulseaudio
52}
53function cmd_do {
54	echo "$header"
55	echo "> $1"
56	$1
57}
58cmds=(
59	'pulseaudio_ps_do'
60	'which pulseaudio'
61	'pidof pulseaudio'
62	'pulseaudio --version'
63	'pactl info'
64	'pactl list'
65	'cat /etc/pulse/daemon.conf'
66	'cat /etc/pulse/client.conf'
67	'cat /etc/pulse/default.pa'
68	'cat /etc/pulse/system.pa'
69	'ls -alt /dev/snd/*'
70	'lsof /dev/snd/*'
71	'jacks_do'
72	'aplay -L'
73	'arecord -L'
74	'alsa_info_do'
75)
76for cmd in "${cmds[@]}" ; do
77	cmd_do "$cmd"
78done
79