Saturday, January 26, 2008

ubuntu disable hardware

I had a second sound card that kept getting picked up by apps under ubuntu as my primary audio device. In windows I sometimes use the game port on this pci sound card, but in general I don't even care if Linux detects it.

In ubuntu gnome, under System->Preferences->Sound
I had something like this:


In an unrelated effort, I had only recently discovered an important linux command - lsmod

The command list modules will display information about all loaded kernel modules. Kernel modules are dynamically loaded kernel functions, such as a device driver.

When I looked through the list of loaded kernel modules on my system:
lsmod | less
I found this:

snd_ens1370 21536 0
gameport 16776 1 snd_ens1370
snd_ak4531_codec 9856 1 snd_ens1370
snd_pcm 80388 5 snd_ens1370,snd_intel8x0,snd_ac97_codec

There was no doubt in my mind - I needed to stop the kernel from loading the module snd_ens1370.

I had considered just deleting it all together:

$ locate 1370
/lib/modules/2.6.22-14-generic/kernel/sound/pci/snd-ens1370.ko
/usr/src/linux-headers-2.6.22-14-generic/include/config/snd/ens1370.h
/usr/share/alsa/cards/ENS1370.conf


But it turns out there is a more elegant way.

To disable hardware in ubuntu - blacklist the module.

Take a look at, /etc/modprobe.d/blacklist

To disable my Ensoniq sound card in ubuntu - I added the following lines:
# disable my PCI ensoniq sound card
blacklist snd_ens1370

then just reboot...



7 comments:

Steve said...

Many thanks for posting this. I had exactly the same problem!

Anonymous said...

This is exactly what I needed! There are countless reports out there about this issue and they inevitably recommend using the command, "alsactl store X" (where X is the number of your sound card). After trying that 9 or 10 thousand times I gave up and had the same idea you did - disable the offending device so ASLA only has one choice.

Thanks so much for the tip on blacklisting; worked perfectly the first time.

Paulo [Gepetto] Bittencourt said...

Perfect! This is - was - exactly my problem. Thank you very much for this helpful post. Stumbled!

jaywink said...

Thanks for the tip! It's really bad that Ubuntu doesn't have a proper GUI tool for device management yet bundled with the system. Hopefully there will be in the future.

Unknown said...

Thanks a million for the tip. It got me to disable my mousepad which was acting up. It's really appreciated

Anonymous said...

thanks brother

Anonymous said...

In order to use USB Audio un ubuntu/kubuntu as primary device do this:

To blackilist HDA Intel High Definition Audio add this to /etc/modprobe.d/blacklist

blacklist snd_hda_intel

Save the file, restart the ubuntu/kubuntu and then go to preferences/audio or similar, and it may ask you to forget that device and answer yes.