2009-07-16

Freebsd - How to install or add sound card driver module

FreeBSD is getting more and more attention due to its stability and (well done) documentation. Geeks and nerds are getting their hands into installing FreeBSD onto their Desktop or Laptop.  Some might ask "Eh ??? Why ain't ya mentioning the servers? Is BSD.". Sound card, sound card belongs to multimedia. It's mostly meant for entertainment so it's gonna stay on the "personal" thing. e.g. Personal Computer, laptop, notebook, rig, moo or whatever you called it. :p

Back to the topic. This post will try to demo on how to install sound card driver onto FreeBSD.

Some commands or file to take note of :
kldunload     <-- unload a driver module
kldstat     <-- list module driver loaded onto the memory
/boot/defaults/loader.conf     <-- default config files which list all supported drivers
lspci     <-- similar to pciconf but it will need to be install from the ports /usr/ports/sysutils/pciutils

The common steps


1. Check the present/existence of the hardware. Sound cards fall under the "multimedia" "class".
pciconf -lv

e.g.
hdac0@pci0:0:27:0:      card=0x02731028 chip=0x284b8086 rev=0x03 hdr=0x00
vendor     = 'Intel Corporation'
device     = '82801H &SUBSYS_81EC1043&REV_02\3&11583659&0&D8'
class = multimedia
subclass   = HDA

2. We will need to load all the common drivers into the memory so that when it matches, we will know what is the sound card driver name.
kldload sound
kldload snd_driver

3. Check whether is the sound card drivers loaded in step 2, matches any.
cat /dev/sndstat

4. If it any of the drivers manages to match the hardware, the sound card driver will bind on it. Note down the driver name shown in step 3.

e.g.
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0:  at cad 0 nid 1 on hdac0 kld snd_hda [MPSAFE] (1p:1v/1r:1v channels duplex default)

Where "snd_hda" is the driver name.

5. To load the driver every time (or permanently) FreeBSD boots, edit the file /boot/loader.conf with such pattern:
<driver name noted from Step 4>_load="YES"

e.g.
snd_hda_load="YES"

Alternative


1. Some of the sound cards driver module are not available in the kernel, it will need to use the OSS (Open Sound System driver) ports in /usr/ports/audio/oss. Install it by :
cd /usr/ports/audio/oss
make install clean

2. Insert the line :
"oss_enable="YES"
into /etc/rc.conf

3. Start the OSS service by :
/usr/local/etc/rc.d/oss start

4. To check whether the device driver for the sound card works or not, use
cat /dev/sndstat

5. Cross your finger and hope that the sound card driver module from OSS works. :p

Adios !!!

No comments: