BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / linux / #310同步于 2004/12/4
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Linux机器人发帖

Troubleshooting Sound Cards under GNU/Linux: Version 1.0

wisewill
2004/12/4镜像同步0 回复
以前装debian,声卡识别不了,比较头疼, 今天找了篇不错的文章,给声卡总是不出声的兄弟看看 It happens to everyone eventually. You walk into the office, turn on the desktop PC and you're greeted with ugly beeping and no video. The slightly acrid tang of electrical smoke reaches your nostrils and you know that before you've even begun your day, it's already over. You say a small prayer to the computing gods that it's not the hard drive that's fried and you turn everything off before you begin unplugging peripherals. "Where did I put the receipt?" you wonder as you do a little quick math in your head to make sure you're still under warranty. Time to call tech support. Get in the queue. Hurry up and wait. Indeed. PCs are born to die like the rest of us and my brand new (well, 6 months old is pretty new) desktop PC kicked the bucket the last week of January 2002. 1.33 GHz Athlon T-birds run hot, and mine ran a little too hot. Bye-bye motherboard, bye-bye processor, we hardly knew ye. A week or so later when my local PC vendor finally got the replacement processor in from AMD, I was given a choice. The motherboard (made by Gigabyte) was going to have to be replaced with a newer board, or I was going to have to wait another two weeks while the older broken one was sent off for repairs. I opted for the new motherboard (also from Gigabyte) because I wanted my computer back. My substitute for the week had been a K6III 400 MHz machine that worked just fine, but was frustratingly slow. Speed might kill, but once you work on a fast PC, going back to a slower one is like getting your teeth drilled without the novocaine. Not much fun. Once the PC was returned to me with a new motherboard and new processor, everything seemed to be working just fine. The hard drive rebooted Red Hat 7.2, and all my data was still there (lucky for me I HAD done a back-up so I wasn't worried about it). Curiously though, my sound wasn't working. Little did I know that getting it working again would be more of chore than I expected. Know your hardware Like many Linux users, I've never had to worry about sound on my desktop systems. Every installation of Linux I've done, no matter which distribution, had sound working perfectly without any input from me. I credit this to two things: 1, Linux has matured nicely over the past few years and 2, the fact that I've always purchased Creative Sound Blaster audio cards for my PCs, which are about as "industry standard" as you can get. The PC I purchased back in July had a motherboard with a built in sound board. I had asked if it was Sound Blaster compatible and was told yes. When the motherboard was replaced, I had assumed that because it was the same manufacturer, I would get the same built in sound card. And you know what you get when you assume things. Needless to say, it wasn't long before I was paging through the new motherboard manual to see what type of card was built in to explain the complete silence of my machine. How to find the problem Upon discovering the make and model of my new motherboard's audio (Via SouthBridge using the AC97 Codec), it was time to start looking into why it wasn't working. The first step to take when you have faulty peripherals is to find out what your GNU/Linux system can tell you about the problem. This means checking your system boot logs in /var/logs/messages. You can do this several ways. One of the easiest is to simply open a terminal session and enter the command $>dmesg This will print out the log of your last boot. For many users, the output returned from this command will appear to be gibberish. But if you look closely, you'll learn quite a bit about how things work under GNU/Linux. The main thing to look for when something isn't working is negative language in the log. "Can't find...", "Unknown...", or "Error loading..." are all things to look for in the log when tracking down problems. Usually, the log will point out exactly why something like audio isn't working. In my case, the line that told me my problem was: VP_IDE: Unknown VIA SouthBridge, contact Vojtech Pavlik <vojtech@suse.cz> I knew that my audio was a Via SouthBridge, and there it was in the log. So what does this tell me? Well, the next step is to find out why this particular card is "unknown". And that requires some searching on the Net. GNU/Linux sound drivers The Linux kernel includes a set of sound drivers that cover many industry standard PC audio devices. These drivers are maintained with the Linux kernel. The only problem with this set of drivers is that information about them, which you'll find in various places online, is a bit out-dated. The best place to look for compatibility issues with this set of drivers is the Linux Sound HOWTO at linuxdoc.org (http://www.linuxdoc.org/HOWTO/Sound-HOWTO/). Here you'll find a list of sound cards that are supported by the Linux kernel (http://www.linuxdoc.org/HOWTO/Sound-HOWTO/x96.html#AEN109). Looking through this list, I found that there is a Via driver in the standard Linux kernel sound driver set. Unfortunately, my Via audio device isn't the one included in the list. If this happens to you, you'll need to look for alternative drivers. But what if your card is supported, yet it still doesn't work? Well, some basic GNU/Linux rules-of-thumb will help you find the problem and correct it. Kernel source files: a good thing As the Linux kernel has matured, it has taken advantage of modular support for many hardware and software devices. This has been a major boon for all Linux users, since using modules means that you don't have to recompile the kernel every time you add or replace hardware. Most major Linux distributions install with modules enabled, but it's always good to make sure. Kernel support for modules is determined when configuring the source files prior to compiling them into a working kernel. The problem is that some major Linux distributions don't install the Linux kernel source files by default. As a general rule, kernel sources will be installed in your /usr/src directory. They'll usually be in a directory signifying the kernel version in the name like this: linux-2.4.7-10 If you plan to install a Linux distribution, take the time to select the kernel sources package if your distro supports it. This will save you a few headaches down the road. You might not ever need them, but that one time you do, you'll get to pat yourself on the back for being so smart. Once you've determined that your system has the kernel source files, you'll need to find out if your kernel supports kernel modules. Most will, but it's good to know for sure. As the superuser root, you can change directories to your /usr/src/linux-2.x.x directory and run "make menuconfig" or "make xconfig". In the menu that pops up as a result, check the menu item titled "Loadable module support". This is where module support is enabled for your Linux kernel. If modules support is enabled, then you can move on to looking at your modules configuration file. (Editor's note: You may need to recompile your kernel to install kernel modules. We will cover more steps to make certain you have kernel module support enabled in your installed kernel.) Modules configuration When modules are enabled, there are two places to look for their storage and configuration. When created, the modules themselves are stored in the /lib/modules/2.X.X depending on your kernel version. The configuration file for modules on the other hand is in your /etc directory. The file modules.conf (conf.modules on some older versions of GNU/Linux) contains the directions for loading the various kernel modules for your system. Take a look at your /etc/modules.conf file and then compare the modules you see loaded there to your system logs (using the dmesg command). This should make things a little clearer as to how modules are loaded by your system. In the case of sound modules, you should look for the ones installed on your system. For example, if a sound module is configured in /etc/modules.conf, yet your sound isn't working, you should first make sure the module is in the correct place. The default Linux kernel sound modules should be found in /lib/modules/2.x.x/kernel/drivers/sound/. If the module file configured in modules.conf isn't located here, then you have a good reason for your sound not to work. The other possibility is that the incorrect sound module is attempting to load. You can correct this by manually editing your /etc/modules.conf file with the correct driver or you can try using insmod to install a module in the running kernel. This will only load a module temporarily until your next reboot, but it will let you experiment with finding the appropriate module. You can learn more about the insmod command in your system man pages. To find the correct Linux kernel sound module for your audio device, look at the compatibility list in the Linux Sound HOWTO mentioned earlier in this article. If you don't find your audio device listed in the Linux Sound HOWTO, you may need to try alternative sound drivers. The ALSA sound drivers (Advanced Linux Sound Architecture) are probably your best bet. (There is also a commercial version of the Linux OSS kernel sound drivers by 4Front Technologies. A demo version is available along with some handy configuration utilities. For these sound drivers to work permanently, you must purchase them. You can find these drivers at: http://www.opensound.com/. The main advantage is that you get tech support for a year for the driver you purchase.) ALSA Drivers installation and configuration If you're not familiar with the ALSA project, you soon will be. Recently, the latest Linux kernel pre-patch (2.5.5-pre1) merged the ALSA project sound drivers in the Linux kernel. What this means for the end user is that the ALSA sound drivers will become the default for future Linux kernels. For now, they remain "alternative" drivers for most users since all current Linux distributions rely on a different set of sound drivers (the free version of the OSS drivers.) If you've determined your current Linux sound drivers aren't working, you can download the ALSA drivers from the ALSA home page at: http://www.alsa-project.org/. You should also take a look at the ALSA sound card matrix for resolving compatibility issues with your brand of sound card. The sound card matrix can be found at: http://www.alsa-project.org/~goemon/. To install the ALSA sound drivers, you should download the Drivers, Library and Utilities packages from the ALSA home page. The most recent stable versions of these packages are: Drivers: 0.5.12a Library: 0.5.10b Utilities: 0.5.10 Once you've downloaded them, you should unpack them and run the normal "./configure" "make" "make install" procedure for configuring and compiling the drivers. Do yourself a favor before you compile these drivers and read the ALSA Mini-HOWTO on the ALSA documentation page. It explains most of what you'll need to know for installing the drivers. You might also need to manually edit your modules.conf file to get the drivers working properly. Read the INSTALL file included in the driver package, since this gives you good specific information for manual configuration of sound cards and their corresponding modules.. Once the drivers were loaded on my system, I read the INSTALL file and added the following to my /etc/modules.conf file. alias char-major-116 snd options snd snd_major=116 snd_cards_limit=1 alias snd-card-0 snd-card-via8233 options snd-card-interwave snd_index=0 alias char-major-14 soundcore alias sound-slot-0 snd-card-0 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss This successfully configured my sound card after a reboot, but strangely, my speakers were still silent. XMMS would load, and the graphic equalizer would show music playing, but I wasn't even getting static from my speakers. As I contemplated living without sound, I continued searching a little more. That's when I stumbled on the various mixers for desktop environments. Mixers and tools No matter what drivers you have installed for your GNU/Linux system, if sound isn't working properly, check the various sound mixer settings for your desktop to make sure sound is turned on. By default, some desktop environments (GNOME and KDE) default their sound mixers (gmix and kmix respectively) to MUTE!. It might be a simple case of these mixers not being set properly if sound isn't working. If you use the ALSA sound drivers, you should also set the mixer settings for these drivers using the command line tool amixer. In my case (I use GNOME and KDE) the KDE mixer defaults for muting the sound card caused my silence. Once I made changes to kmix and save them to the new default, XMMS played my MP3 files without a problem. Some GNU/Linux distributions have excellent sound configuration tools particular to their distro. Mandrake, Red hat and others have specific tools for this purpose. Some of them are X-based, others are for use on the command line. Be sure to check your distribution's web site for information on any sound configuration tools they provide. These should be used prior to delving into the specific sound driver kernel module configuration. Here's a quick list of distro-specific sound configuration tools. Red Hat: sndconfig Mandrake: HardDrake SuSE: YaST2 Conclusion Sound configuration has become much easier over the years as GNU/Linux distributions have matured. Your experience my vary from the simple to the very difficult, but once you know where to look for trouble with your sound card, getting it working again is just a matter of a little time and effort.
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。