dotfiles/.bin/setaudio

26 lines
591 B
Plaintext
Raw Normal View History

2023-04-10 13:00:38 +02:00
#!/bin/ksh
2023-04-09 20:37:05 +02:00
2023-04-10 13:00:38 +02:00
[ ! -z $1 ] && sndioctl -q server.device=$1
2023-04-09 20:37:05 +02:00
2023-04-10 13:00:38 +02:00
DUMP=$(dmesg)
_cur=$(sndioctl -n server.device)
2023-04-09 20:37:05 +02:00
2023-04-10 13:00:38 +02:00
examine() {
_type=$(echo "$1" | cut -d" " -f3)
_number=$(echo "$1" | cut -d" " -f1 | sed 's/[a-z]//g')
_desc=$(echo "$DUMP" | grep -E "^$_type at.*" | tail -1 | cut -d'"' -f2)
[ -z $_number ] && return
if [ $_cur -eq $_number ]
then
[ ! -z $_number ] && echo "> $_number: $_desc"
else
[ ! -z $_number ] && echo " $_number: $_desc"
fi
}
for i in 0 1 2 3 4 5 6
do
examine "$(echo "$DUMP" | grep -E "^audio$i\ at.*" | tail -1)"
done