Jump to content

Checking Sound Script


Owyn

Recommended Posts

The following script was abstracted from another (and at the time of writing, still active) thread.I expect to make changes to this over time, in particular, porting it to work on other distros.Any feedback on using this on other distros would be appreciated.Any changes to this script will be implemented in this post and announced by a new message.Latest update: Rev 1.04 2003-11-25.The initial revision of this script was based on the Mandrake 9.1 Sound Trouble Shooting Tips. This is a way to get all the sound info in one step. The latest revision has been tested on Mandrake 9.2, RedHat 9, Knoppix 3.3, and PCLos. It should also work on most other distributions. Known problems with missing tests on Suse.To implement the script:1)Select all the text in the code block at the end of this message. Copy the text.2)In a console type the command "vi soundchk.sh"3)In vi- Press "I" (without the quotes) to go to insert mode- Select Edit->Paste from the console menu- Press the escape key to leave insert mode- Press "ZZ" to save the new file4)In the console type the command "chmod +x soundchk.sh"5)Just su and then type "./soundchk.sh" to run the script. The results from the check can be selected and copied into a message quote or code block.The script:

#!/bin/sh# soundchk.sh# Rev 1.00 2003-10-13 Initial Release - Mandrake 9.1 specific# Rev 1.01 2003-10-13 Added Checking Devices#                     Added grep steps to restrict output. Really needed for Knoppix.#                     Add file exists tests to find correct tools#                     Completed port to Knoppix 3.3. Should also be much better for UNKNOWN.# Rev 1.02 2003-10-14 Added test -x for aumix#                     Fix bug in lspci greps# Rev 1.03 2003-11-24 Add additional tests from alsa aadebug script# Rev 1.04 2003-11-25 Fix typo in 1.03 lspci grep#                     Add check for artsd#                     Add check for using cdromecho "soundchk.sh v1.04 - Running Sound Configuration Checks"echoecho Identifying Systemuname -acat /proc/cpuinfo | grep -i "model name"cat /proc/cpuinfo | grep -i "cpu mhz"cat /proc/meminfo | grep -i memtotalcat /proc/meminfo | grep -i swaptotalechoecho Checking Devicesls -l /dev | egrep -i dsp\|soundechoecho Checking Driverif test -x /usr/bin/lspcidrake ; then        lspcidrake -v | egrep -i "(audio|multimedia|host bridge)"else        lspci -v | egrep -i "(audio|multimedia|host bridge)"fiechoecho Checking Actual Driver in Use "(/etc/modules.conf)"if test -f /etc/modules.conf; then        cat /etc/modules.conf | egrep -i snd\|soundelse        echo Test not available on this systemfiif test -d /proc/asound; then        echo        echo Checking alsa /proc/asound        cat /proc/asound/{version,cards,devices,hwdep,pcm}fiif test -d /dev/snd; then        echo        echo Checking alsa /dev/snd        ls --color=none /dev/sndfiechoecho Checking if Module Loaded/sbin/lsmod | egrep -i snd\|sound\|audio\|gameechoecho Checking if services configured to be run on initlevel 3if test -x /sbin/chkconfig; then        echo Checking if Sound services configured        /sbin/chkconfig --list sound        echo        echo Checking if Alsa service configured        /sbin/chkconfig --list alsaelse        echo Test not available on this systemfiechoecho Checking if Sound Volume mutedif test -x /usr/bin/aumix; then        aumix -qelse        echo Test not available on this systemfiechoecho Checking artsd setupps -A -f | grep -i artsd | grep -v grepechoecho Checking which program uses the sound card or cdromif test -x /sbin/fuser; then        /sbin/fuser -v /dev/dsp        /sbin/fuser -v /dev/cdromelse        /bin/fuser -v /dev/dsp        /bin/fuser -v /dev/cdromfiechoecho End of Checks

Edited by Owyn
Link to comment
Share on other sites

Owyn,Is this the last version ? Do you want me to run it on my second computer and in a few diferent disto´s ? Or is it work in progress and is it better to wait ?:rolleyes: Bruno

Link to comment
Share on other sites

The following script was abstracted from another (and at the time of writing, still active) thread.I expect to make changes to this over time, in  particular, porting it to work on other distros.Any feedback on using this on other distros would be appreciated.
Good idea, Owyn! :rolleyes: Should make it easier helping people using Mandrake this way. On using it with other distros, the 'lspcidrake' is probably specific to Mandrake so that would cause a problem right away.On my SuSE 8.2 system, it had problems on that line (no such command) and I pasted the output from the other areas below. Everything else worked fine. My sound is provided onboard (CrystalClear SoundFusion CS 4624 chipset) and works fine.
Checking if services configured to be run on initlevel 3Checking if Sound services configuredsound: unknown serviceChecking if Alsa service configuredalsa: unknown serviceChecking if Sound Volume muted./soundchk.sh: line 37: aumix: command not foundChecking which program uses the sound card./soundchk.sh: line 41: /sbin/fuser: No such file or directory
The last one is because fuser is /bin/fuser on SuSE 8.2.You definitely should write for the LSB if you decide to port it to other distros. I believe that Red Hat, SuSE, and Mandrake are LSB-certified, so writing for it will save you some work.
Link to comment
Share on other sites

Getting errors in SuSE, Slackware and RedHat too . . . RedHat:

./soundchk.sh: line 12: lspcidrake: command not founderror reading information on service sound: No such file or directoryerror reading information on service alsa: No such file or directory
SuSE:
./soundchk.sh: line 12: lspcidrake: command not foundsound: unknown servicealsa: unknown service./soundchk.sh: line 37: aumix: command not found./soundchk.sh: line 41: /sbin/fuser: No such file or directory
Skackware:
root@drake:/home/bruno# ./soundchk.sh >Sound_Slack91_Main.txt./soundchk.sh: line 12: lspcidrake: command not found./soundchk.sh: line 29: /sbin/chkconfig: No such file or directory./soundchk.sh: line 33: /sbin/chkconfig: No such file or directory./soundchk.sh: line 41: /sbin/fuser: No such file or directory
:rolleyes: Bruno
Link to comment
Share on other sites

Definitely a work in progress. Porting it to Knoppix 3.3 right now.Want to make it available as a test tool with Knoppix to find out how it configures cards.Watch the rev notes in the first post for changes and as promised I will also post an announcement of any changes.

Link to comment
Share on other sites

PS: I think most of the problems you noted have shown up during the Knoppix port.At the moment I am fighting some shell script [expr] problems. Getting close.

Link to comment
Share on other sites

Help. I give up. What am I doing wrong.

echoecho Identifying DistributionDISTRO="UNKNOWN"NODENAME=`uname -n`KERNEL=`uname -r`if test "$NODENAME"="Knoppix"; then        DISTRO="KNOPPIX"elif test -x /usr/bin/lspcidrake; then        DISTRO="MANDRAKE"fiecho Nodename=[$NODENAME] Kernel=[$KERNEL]echo Distribution is $DISTRO

gives me

Identifying DistributionNodename=[mdk91] Kernel=[2.4.21-0.13mdk]Distribution is KNOPPIX
Link to comment
Share on other sites

Worked around the problem by changing the "elif" to an "fi if".Not logically the same and I would like to know what I am doing wrong with the elif construct.

Link to comment
Share on other sites

Identifying DistributionNodename=[mdk91] Kernel=[2.4.21-0.13mdk]Distribution is KNOPPIX
LOL :thumbsup: This is fun Owyn ! Knoppix with a mandrake kernel !! :'( we won´t need any sound-propblems after that one, the box will explode . . . LOLB) Bruno
Link to comment
Share on other sites

I think you should skip that part . .it is making the script extra complicated and it is not really that important to see the name of the distro. The kernel version should be enough.Or let the usere type the distro ( or a number out of a list ) Mandrake = 1RedHat = 2Slackware = 3Debian/Knoppix = 4B) Bruno

Link to comment
Share on other sites

I am STUBBORN.I really want to be able to use everything that is available. I am doing something really stupid and it will bite my again later.As I said, this

echoecho Identifying DistributionDISTRO="UNKNOWN"NODENAME=`uname -n`KERNEL=`uname -r`if test "$NODENAME"="Knoppix"; then        DISTRO="KNOPPIX"fiif test -x /usr/bin/lspcidrake; then        DISTRO="MANDRAKE"fiecho Nodename=[$NODENAME] Kernel=[$KERNEL]echo Distribution is $DISTRO

works on Knoppix and Mandrake, but, it is NOT logically the same construct. You are dealing with a programmer now. Logic is important.

Link to comment
Share on other sites

Help. I give up. What am I doing wrong.
echoecho Identifying DistributionDISTRO="UNKNOWN"NODENAME=`uname -n`KERNEL=`uname -r`if test "$NODENAME"="Knoppix"; then        DISTRO="KNOPPIX"elif test -x /usr/bin/lspcidrake; then        DISTRO="MANDRAKE"fiecho Nodename=[$NODENAME] Kernel=[$KERNEL]echo Distribution is $DISTRO

If you have only two conditions, then you'd use just if and else; you'd only use elif if you had a third condition. I had to look this up in the manpage because I've forgotten where all the ;'s go since working in csh programming :P
if list; then list; [ elif list; then list; ] ... [ else list; ] fiThe if list is executed. If its exit status is zero, the then list isexecuted. Otherwise, each elif list is executed in turn, and if itsexit status is zero, the corresponding then list is executed and thecommand  completes. Otherwise, the else list is executed, if present.The exit status is the exit status of the last command executed, or zero if no condition tested true.
If you're going to do multiple distros, you probably want to use switch, but this is a good start :D
Link to comment
Share on other sites

No luck

echoecho Identifying DistributionNODENAME=`uname -n`KERNEL=`uname -r`if test "$NODENAME"="Knoppix"; then        DISTRO="KNOPPIX"elif test -x /usr/bin/lspcidrake; then        DISTRO="MANDRAKE"else        DISTRO="UNKNOWN"fiecho Nodename=[$NODENAME] Kernel=[$KERNEL]echo Distribution is $DISTRO

still gives me KNOPPIX on Mandrake

Link to comment
Share on other sites

Rev 1.01 posted. See initial post for details.Tested on Knoppix 3.3 and Mandrake 9.1.Added file exist tests and added/changed greps to control size of output. You do NOT want to look at modules.conf on Knoppix. :P Should work much better on other systems.PS: I pulled the idchk code out entirely from the script. Was able to get job done with "test -x".PPS: I have not given up on the puzzle of why those code fragments don't work.

Link to comment
Share on other sites

This seems to work on my system. Try it on yours. I think the problem was in the test condition which needs to be surrounded by brackets. At least that's what I think I did that fixed it. :P

echoecho Identifying DistributionDISTRO="UNKNOWN"NODENAME=`uname -n`KERNEL=`uname -r`if [ "$NODENAME" = "Knoppix" ]; then        DISTRO="KNOPPIX";elif test -x /usr/bin/lspcidrake; then        DISTRO="MANDRAKE"i;else DISTRO="UNKNOWN";fiecho Nodename=[$NODENAME] Kernel=[$KERNEL]echo Distribution is $DISTRO

Link to comment
Share on other sites

Nope. Tried [ <expr> ] and [ test <expr> ]. The second one throws an error (unary operator expected).I have started reading some of the scripting gotchas from google. Must be something related to string comparisons.The "if test -x ...." contstructs work perfectly.A previous error was using "eq" instead of "=". Numeric vs string operators.Will post results when I figure it out.

Link to comment
Share on other sites

Rev 1.01 posted. See initial post for details.
Tested on SuSE 8.2:
# ./soundchk.shsoundchk.sh - Running Sound Configuration ChecksIdentifying SystemLinux sheridan 2.4.20-4GB #1 Tue May 13 08:07:43 PDT 2003 i686 unknown unknown GNU/LinuxChecking Deviceslrwxrwxrwx    1 root  root            5 2003-08-31 20:36 adsp -> adsp0crw-------    1 jay      audio  14,  12 2003-03-14 08:07 adsp0crw-------    1 jay      audio  14,  28 2003-03-14 08:07 adsp1crw-------    1 jay      audio  14,  44 2003-03-14 08:07 adsp2crw-------    1 jay      audio  14,  60 2003-03-14 08:07 adsp3lrwxrwxrwx    1 root  root            4 2003-08-31 20:36 dsp -> dsp0crw-------    1 jay      audio  14, 3 2003-03-14 08:07 dsp0crw-------    1 jay      audio  14,  19 2003-03-14 08:07 dsp1crw-------    1 jay      audio  14,  35 2003-03-14 08:07 dsp2crw-------    1 jay      audio  14,  51 2003-03-14 08:07 dsp3crw-rw----    1 root  root      55, 0 2003-03-14 08:07 dsp56klrwxrwxrwx    1 root  root        16 2003-08-31 20:36 snd -> /proc/asound/devlrwxrwxrwx    1 root  root        24 2003-08-31 20:36 sndstat -> /proc/asound/oss/sndstatChecking DriverChecking Actual Driver in Use (/etc/modules.conf)# These aliases will be changed by YaST2 sound configurator.# take a look at the files on /usr/src/linux/Documentation/sound.alias sound off# Alsa sound support.# Warning: please don't modify comments over aliases 'snd-card-#'alias char-major-116 snd#alias sound-slot-1 nvaudiooptions snd-cs46xx snd_enable=1 snd_external_amp=0 snd_index=0 snd_mmap_valid=0 snd_thinkpad=0# YaST2: sound system dependent partalias sound-slot-0 snd-card-0alias sound-service-0-0 snd-mixer-ossalias sound-slot-1 offalias sound-service-1-0 offalias sound-slot-2 offalias sound-service-2-0 offalias sound-slot-3 offalias sound-service-3-0 offoptions snd snd_cards_limit=1 snd_major=116# gZD2.kEZ_kK3OAS1:CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator]alias snd-card-0 snd-cs46xxalias sound-service-0-1 snd-seq-ossalias sound-service-0-3 snd-pcm-ossalias sound-service-0-8 snd-seq-ossalias sound-service-0-11 snd-mixer-ossalias sound-service-0-12 snd-pcm-ossChecking if Module Loadedsnd-pcm-oss            45888 0  (autoclean)snd-mixer-oss          13560 1  (autoclean) [snd-pcm-oss]snd-seq-midi            4448 0  (unused)snd-seq-midi-event      2984 0  [snd-seq-midi]snd-seq                39184 0  [snd-seq-midi snd-seq-midi-event]snd-cs46xx          69864 1gameport                1404 0  [snd-cs46xx]snd-pcm                62912 0  [snd-pcm-oss snd-cs46xx]snd-timer              11904 0  [snd-seq snd-pcm]snd-ac97-codec      31152 0  [snd-cs46xx]snd-rawmidi            13824 0  [snd-seq-midi snd-cs46xx]snd-seq-device          4000 0  [snd-seq-midi snd-seq snd-rawmidi]snd                    35940 0  [snd-pcm-oss snd-mixer-oss snd-seq-midi snd-seq-midi-event snd-seq snd-cs46xx snd-pcm snd-timer snd-ac97-codec snd-rawmidi snd-seq-device]soundcore            3396 0  [snd]Checking if services configured to be run on initlevel 3Checking if Sound services configuredsound: unknown serviceChecking if Alsa service configuredalsa: unknown serviceChecking if Sound Volume muted./soundchk.sh: line 49: aumix: command not foundChecking which program uses the sound cardEnd of Checks
Link to comment
Share on other sites

Tx Jason:I would guess you are using a Turtle Beach Santa Cruz.Looks fairly good except for the errors near the end and the switch in the device.If you can tell me what the correct tests are on Suse I will modify the script accordingly.

Link to comment
Share on other sites

I made one other minor change to the script to include the rev code in the title.Just in case of future problems with using old scripts. I left the rev code at 1.01.

Link to comment
Share on other sites

I would guess you are using a Turtle Beach Santa Cruz.If you can tell me what the correct tests are on Suse I will modify the script accordingly.
No, what I'm using is onboard CrystalClear SoundFusion CS 4624.As for the second part, I don't really know what the correct tests are under SuSE. Everything was auto-detected for me, and it's been quite a while since I've upgraded (as you can probably tell by my computer specs). :)
Link to comment
Share on other sites

LOL. No wonder my Santa Cruz only functions as a basic card. Works just great in WXP but none of the advanced functions are available in Linux. It uses the same driver as you do.No big problem. Still waiting for other things to stabilize before I upgrade (Feb maybe). Lots of time to decide on a new sound card before that.Tx for the help.

Link to comment
Share on other sites

Nope. Tried [ <expr> ] and [ test <expr> ]. The second one throws an error (unary operator expected).
That's interesting. I wonder if it's because Mandrake actually uses the real sh whereas on SuSE, it's only a symbolic link to bash. I actually tested the script as I showed it and it works perfectly on my system - shows up as 'unknown distro'. I even changed the first condition so it would be true and it came up as Knoppix as expected.
Link to comment
Share on other sites

Interesting. I will try it as bin/bash. But not tonight. I had 4 hours sleep last night and have basically been punching away at computer screens all day.Time to take a break before I do. Nite.

Link to comment
Share on other sites

Interesting. I will try it as bin/bash. But not tonight. I had 4 hours sleep last night and have basically been punching away at computer screens all day.
Sleep and computers just don't mix, do they? :)
Link to comment
Share on other sites

Owyn,What OS do you want me to test it on ??;) Bruno
I would like to find out what the differences are for Suse. If you could trace down the equivalent devices/services/programs that would be a big help.Also working on Knoppix issues again. I happened to rerun the tests without Alsa and things are quite different.When I have the script stable for both those cases then it should be worthwhile to give it a retest.It would also be usefull to pre-test it on Mandrake 9.2 RC2 (if you have it available). It would be nice if it was stable before Mandrake 9.2 is generally available.
Link to comment
Share on other sites

Owyn,Your script on Mandrake 9.1 and 9.2RC2 ( on two different computers, 9.1 on Athlon, 9.2 on Duron ! )

soundchk.sh v1.02 - Running Sound Configuration ChecksIdentifying SystemLinux drake.lan 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686 unknown unknown GNU/LinuxChecking Deviceslr-xr-xr-x    1 root  root        11 Oct 14 19:00 audio -> sound/audiolr-xr-xr-x    1 root  root            9 Oct 14 19:00 dsp -> sound/dsplr-xr-xr-x    1 root  root        11 Oct 14 19:00 mixer -> sound/mixerlr-xr-xr-x    1 root  root        15 Oct 14 19:00 sequencer -> sound/sequencerlr-xr-xr-x    1 root  root        16 Oct 14 19:00 sequencer2 -> sound/sequencer2drwxr-xr-x    1 root  root            0 Jan  1  1970 soundChecking Driversnd-intel8x0    : Silicon Integrated Systems [siS]|SiS7012 PCI Audio Accelerator [MULTIMEDIA_AUDIO] (vendor:1039 device:7012 subv:1019 subd:0a14)Checking Actual Driver in Use (/etc/modules.conf)above snd-intel8x0 snd-pcm-ossalias sound-slot-0 snd-intel8x0Checking if Module Loadedsnd-seq-oss            31104 0 (unused)snd-seq-midi-event      5640 0 [snd-seq-oss]snd-seq                42608 2 [snd-seq-oss snd-seq-midi-event]snd-pcm-oss            43556 1snd-mixer-oss          14488 0 [snd-pcm-oss]snd-intel8x0        21988 5snd-ac97-codec      40160 0 [snd-intel8x0]snd-pcm                77536 0 [snd-pcm-oss snd-intel8x0]snd-timer              18376 0 [snd-seq snd-pcm]snd-mpu401-uart      4396 0 [snd-intel8x0]snd-rawmidi            17600 0 [snd-mpu401-uart]snd-seq-device          5832 0 [snd-seq-oss snd-seq snd-rawmidi]snd-page-alloc          7732 0 [snd-intel8x0 snd-pcm]snd                    40868 4 [snd-seq-oss snd-seq-midi-event snd-seq snd-pcm-oss snd-mixer-oss snd-intel8x0 snd-ac97-codec snd-pcm snd-timer snd-mpu401-uart snd-rawmidi snd-seq-device]soundcore            6276 0 [snd]Checking if services configured to be run on initlevel 3Checking if Sound services configuredsound        0:off 1:off 2:on 3:on 4:on 5:on 6:offChecking if Alsa service configuredalsa            0:off 1:off 2:on 3:on 4:on 5:on 6:offChecking if Sound Volume mutedvol 87, 87, Ppcm 39, 39speaker 73, 73line 61, 61, Pmic 0, 0, Rcd 71, 71, Pigain 0, 0line1 0, 0, Pphin 0, 0, Pvideo 74, 74, PChecking which program uses the sound card                  USER        PID ACCESS COMMAND/dev/dsp          bruno      2342 f....  artsdEnd of Checks
soundchk.sh v1.02 - Running Sound Configuration ChecksIdentifying SystemLinux dolphin.lan 2.4.22-1mdk #1 Mon Aug 25 11:19:10 EDT 2003 i686 unknown unknown GNU/LinuxChecking Deviceslr-xr-xr-x    1 root  root        10 Oct 14 20:12 adsp -> sound/adsplr-xr-xr-x    1 root  root        11 Oct 14 20:12 audio -> sound/audiolr-xr-xr-x    1 root  root            9 Oct 14 20:12 dsp -> sound/dsplr-xr-xr-x    1 root  root        11 Oct 14 20:12 mixer -> sound/mixerdrwxr-xr-x    1 root  root            0 Jan  1  1970 soundChecking Driversnd-via82xx  : VIA Technologies|VT8233 [AC97 Audio Controller] [MULTIMEDIA_AUDIO] (vendor:1106 device:3059 subv:1106 subd:4161)Checking Actual Driver in Use (/etc/modules.conf)alias sound-slot-0 snd-via82xxabove snd-via82xx snd-pcm-ossChecking if Module Loadedsnd-pcm-oss            43428 0snd-mixer-oss          14232 0 [snd-pcm-oss]snd-via82xx            14816 2snd-pcm                78692 0 [snd-pcm-oss snd-via82xx]snd-timer              18276 0 [snd-pcm]snd-ac97-codec      44824 0 [snd-via82xx]snd-mpu401-uart      4608 0 [snd-via82xx]snd-rawmidi            17664 0 [snd-mpu401-uart]snd-seq-device          5672 0 [snd-rawmidi]snd                    40836 2 [snd-pcm-oss snd-mixer-oss snd-via82xx snd-pcm snd-timer snd-ac97-codec snd-mpu401-uart snd-rawmidi snd-seq-device]soundcore            6308 0 [snd]snd-page-alloc          8948 0 [snd-via82xx snd-pcm]Checking if services configured to be run on initlevel 3Checking if Sound services configuredsound        0:off 1:off 2:on 3:on 4:on 5:on 6:offChecking if Alsa service configuredalsa            0:off 1:off 2:off 3:off 4:off 5:off 6:offChecking if Sound Volume mutedvol 84, 84, Ppcm 0, 0speaker 0, 0line 0, 0, Pmic 0, 0, Rcd 100, 100, Pigain 0, 0line1 0, 0, Pphin 0, 0, Pvideo 0, 0, PChecking which program uses the sound cardEnd of Checks
Funny the second one was playing a vivaldi CD . . . and still gives zero at "Checking which program uses the sound card";) Bruno
Link to comment
Share on other sites

Tx Bruno.Noticed a couple of things.

Mandrake 9.1Checking Actual Driver in Use (/etc/modules.conf)above snd-intel8x0 snd-pcm-ossalias sound-slot-0 snd-intel8x0
The "above" is before the "alias". I still don't really understand modules.conf. Back to RTM.
Mandrake 9.2Checking if Alsa service configuredalsa            0:off 1:off 2:off 3:off 4:off 5:off 6:off
You are using alsa but it does not seem to be configured to start at boot.Looks like basic compatability is there. Will do my own tests as soon as Mdk9.2 available from FTP.PS: Strange. When I initially quoted your post I got a lot of html in the quote. Trashed that and created a new reply and copied from the message history.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...