tags:

views:

515

answers:

3

In bash, how do I determine what sound card is installed? I'm trying to create a plugin for Rhythmbox, and I'd like to test for this in a configuration script.

Edit: On my machine, I needed to use sudo to be able to use lspci and lsmod. @Quassnoi's answer using cat worked without extra privileges.

+3  A: 
lspci | grep -i audio
Sean Bright
What if it's an USB card?
Quassnoi
You upvote another answer if you like it and downvote if you don't, explaining why. That's an etiquette.
Quassnoi
Don't be offended, really. You answer misses some important point, I pointed that out. I'll remove the downvote if it is so important to you.
Quassnoi
+3  A: 
cat /proc/asound/cards
Quassnoi
What if ALSA isn't installed?
Mr. Muskrat
Then it won't work. But GStreamer (which Rhythmbox relies upon) is hardly usable without ALSA anyway, and ALSA is default since 2.6
Quassnoi
+2  A: 

I image you have a list of known sounds you'll be checking for in your configure script. So you can use grep and lsmod to check which one is loaded.

# lsmod | grep -q snd_hda_intel

# echo $?

0

# lsmod | grep -q snd_foo

# echo $?

1

eduffy