Red Hat Linux 9 Professional Secrets [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Red Hat Linux 9 Professional Secrets [Electronic resources] - نسخه متنی

Naba Barkakati

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Configuring the Sound Card


Linux needs a driver to control the sound card. The initial Linux kernel (after you install Linux from the companion CD-ROMs) does not load the sound driver. The sound drivers are provided as loadable modules you can load after booting Linux. You will find the sound drivers in the

/lib/modules/2.4.*/kernel/drivers/sound directory, where VERSION is the kernel version number. If you look at the names of the module files, you see that each filename ends with the extension

.o.gz (the

.o extension identifies an object file—a file containing binary instructions that implements the driver and

.gz means that the files are compressed).








Secret


Whenever you boot Red Hat Linux, the kernel runs kudzu, a tool that detects new hardware. Whenever kudzu runs, it detects the current hardware and checks it against a list stored in a text file,

/etc/sysconfig/hwconf . It then determines if any hardware has been added or removed. Kudzu gives the user an opportunity to configure new hardware or remove the support for hardware no longer installed on the system. Configuring new hardware includes adding appropriate lines to the

/etc/modules.conf file so that the proper driver modules will be loaded when needed. Typically, a sound card should be detected by kudzu and configured during the boot sequence, but sometimes kudzu seems to load the incorrect driver for a card.

As Linux boots and kudzu detects hardware, it displays messages about the detected hardware. The boot messages scroll by too fast to read, but you can look at them with the

dmesg command. Type dmesg | more and then look for one or more lines that mention your sound card’s name or model number. You can also look at the

/etc/sysconfig/hwconf file where kudzu stores information about hardware it detects.

If you have older ISA bus plug-and-play (PnP) sound cards, look for any occurrence of lines containing the word

isapnp in the boot messages—these lines show the result of kudzu detecting the PnP devices. On one of my PCs, for example, I have a Yamaha OPL3-SA3 PnP sound card. In this case, when I type

dmesg | more , I see the following messages:

kernel: isapnp: Scanning for PnP cards...
kernel: isapnp: Card 'OPL3-SA3 Snd System'
kernel: isapnp: 1 Plug & Play card detected total

For this sound card, the

/etc/modules.conf file should have the following lines:

alias sound-slot-0 opl3sa2

Unfortunately, instead of

opl3sa2 , kudzu specifies the

ad1848 driver that is not appropriate (as you can tell by consulting Table 5-1).

Red Hat provides a sound card configuration tool (redhat-config-soundcard), but that tool does not work with ISA PnP cards. It can detect only PCI sound cards. Select Main Menu>System Settings>Soundcard Detection. If the tool detects your sound card, it displays the information in a small window, as shown in Figure 5-1.


Figure 5-1: Sound Card Detected by redhat-config-soundcard Tool.

You can play a test sound with the sound card configuration tool, but the tool does not provide for any way to configure the sound card (for example, to load a different driver module). The bottom line is that newer PCI sound cards should work without much trouble in Linux, but for older ISA PnP sound cards you have to do some work to get sound going.











If you know your sound card type, one way to configure it is to manually load the driver and to set up information in the

/etc/modules.conf file so that the correct driver is loaded.

The next few sections describe how to maually configure sound on Red Hat Linux.


Checking Information about a Sound Card


Typically, you can find out information about your PC’s sound card from what kudzu finds as it probes the hardware. Kudzu stores the information about all detected hardware in the following file:

/etc/sysconfig/hwconf

You can open that file in a text editor and look for a line that looks like this:

class: AUDIO

The information about the sound card is in the lines that follow, up to the next line that has a lone hyphen. For example, here is the information for an ISA bus Yamaha OPL3SA2 sound card:

class: AUDIO
bus: ISAPNP
detached: 0
driver: ad1848
desc: "OPL3-SA3 Snd System:Unknown"
deviceId: YMH0021
pdeviceId: YMH0030
native: 1
active: 0
cardnum: 0
logdev: 0
dma: 0,0

The

desc line tells you the name of the sound card. As you can see from the

driver line, kudzu specifies

ad1848 as the driver for this sound card. Unfortunately, the correct driver is

opl3sa2 . To correct the problem, you have to do some work yourself.


Manually Configuring the Sound Card


When you know the sound card type and the driver that you must load, it’s a simple procedure to load the driver manually. All you have to do is log in as

root and use the

modprobe command with the following syntax:

modprobe drivername

where

drivername is the name of the driver module to load. Thus, you can load the

opl3sa2 driver by typing:

modprobe opl3sa2

That’s all you need to do. After loading the driver, you can verify that it’s loaded by typing the

lsmod command. For example, here are a few lines of output from the

lsmod command on a PC after loading the

opl3sa2 driver:

Module                  Size  Used by    Not tainted
opl3sa2 10256 0 (unused)
mpu401 24068 0 [opl3sa2]
ad1848 28556 0 [opl3sa2]
sound 74164 0 [opl3sa2 mpu401 ad1848]
soundcore 6404 6 [sound]
... rest of the lines deleted...

I want to point to the fact that loading the

opl3sa2 driver with the

modprobe command causes the loading of the other modules—

mpu401 ,

ad1848 ,

sound , and

soundcore —that

opl3sa2 needs. As you can see,

opl3sa2 needs

ad1848 , but

ad1848 is not enough for the Yamaha OL3SA2 sound card.

After you load the driver manually with the modprobe command, the sound card should work. You can test it by playing an audio CD-ROM, as explained in the “Testing the Sound Card” section.








Secret


To test a sound driver, you can load it manually with the

modprobe command, but for automatic loading you should also edit the

/etc/modules.conf file and add the following line:

alias sound-slot-0 drivername

where

drivername is the sound driver you want to load. That way, when the kernel needs to load the sound driver (perhaps because you have started playing an audio CD-ROM with the CD Player application), the correct driver will be loaded.

Typically, the sound driver can probe any PnP sound card to determine its hardware parameters such as the I/O port addresses, the interrupt request numbers (IRQs), and the direct memory access (DMAs) channel. If you do not have a PnP sound card, you have to specify the I/O address, the IRQ, and the DMA channel number of the sound card. You can specify these parameters by adding options lines in the

/etc/modules.conf file. For example, the following lines in

/etc/modules.conf specify the parameters for a Creative Labs SoundBlaster sound card:

alias sound-slot-0 sb
options sb io=0x220 irq=5 dma=1

For a PnP or PCI sound card, all you have to do is have an alias line for

sound-slot-0 with the correct driver name. For example, here is the line for a laptop with the Intel i810 Integrated AC97 Audio:

alias sound-slot-0 i810_audio












/ 341