]> git.alsa-project.org Git - alsa-utils.git/commitdiff
[alsaconf] fix probing, option clean up.
authorTakashi Iwai <tiwai@suse.de>
Tue, 31 Aug 2004 16:27:25 +0000 (16:27 +0000)
committerTakashi Iwai <tiwai@suse.de>
Tue, 31 Aug 2004 16:27:25 +0000 (16:27 +0000)
- Fixed the probing brokenness by my last change.
- Fixed long options.
- Now -L option requires the logfile argument.
- Corrected manpage.

alsaconf/alsaconf.8
alsaconf/alsaconf.in

index 31fdbc585b4a98bb19122773bd07505217b099e5..651fcee90d5d33b32f9133e3c873f96736941750 100644 (file)
@@ -24,41 +24,55 @@ on your system and writes a suitable configuration file for ALSA. It will try
 to guess what GNU/Linux distribution you're running, and will act accordingly
 to the standards of that distribution, if specific support is available.
 .PP
-Alsaconf will write a modutils snippet which can be then used by modutils
+Alsaconf will write a module-init-tools (or modutils) snippet which can be then used by module-init-tools (or modutils)
 to load the correct parameters for your sound card.
 
 .SH OPTIONS
 Alsaconf accepts the following options:
 .TP
 .B \-l, \-\-legacy
-Check only for legacy non-isapnp cards
+Check only for legacy non-isapnp cards.
 .TP
 .B \-m, \-\-modinfo
 Read module descriptions instead of reading a card database.
 .TP
 .B \-s, \-\-sound\-wav\-file
-Use the specified wav file as a test sound
+Use the specified wav file as a test sound.
 .TP
 .B \-u, \-\-uid uid
-Set the uid for the ALSA devices (default = 0)
+Set the uid for the ALSA devices (default = 0).
+This option is obsolete in the recent ALSA version.
 .TP
 .B \-g, \-\-gid gid
-Set the gid for the ALSA devices (default = 0)
+Set the gid for the ALSA devices (default = 0).
+This option is obsolete in the recent ALSA version.
 .TP
 .B \-d, \-\-devmode mode
-Set the device mode for the ALSA devices (default = 0666)
+Set the device mode for the ALSA devices (default = 0666).
+This option is obsolete in the recent ALSA version.
 .TP
 .B \-r, \-\-strict
-Set strict device mode (equiv. with -g 17 -d 0660)
+Set strict device mode (equiv. with -g 17 -d 0660).
+This option is obsolete in the recent ALSA version.
 .TP
-.B \-L, \-\-log
-Logging on /tmp/alsaconf.log
+.B \-L, \-\-log file
+Logging on the given file.  The log is appended to the file.
+This option is for debugging purpose only.
 .TP
 .B \-p, \-\-probe card-name
-Probe a legacy non-isapnp card and print module options
+Probe a legacy non-isapnp card and print module options.
+.TP
+.B \-P, \-\-listprobe
+List the supported legacy card modules.
+.TP
+.B \-c, \-\-config file
+Specify the module config file.
+As default,
+.B alsaconf
+probes the available config file automatically.
 .TP
 .B \-h, \-\-help
-Displays this help text
+Displays this help text.
 
 .SH DEBIAN SPECIFIC
 In Debian, the default gid of the device files is 29 (corresponding to the
index a7ce4ad08473641bb38e89ae13fb12fcf2ff855a..c3c52a7969e6ecf670b3ebd141e5882b2586fc62 100644 (file)
@@ -59,26 +59,26 @@ usage() {
     echo "  -d|--devmode mode"
     echo "                 set the permission for ALSA devices (default = 0666) [obs.]"
     echo "  -r|--strict    set strict device mode (equiv. with -g 17 -d 0660) [obsoleted]"
-    echo "  -L|--log       logging on $LOGFILE"
+    echo "  -L|--log file  logging on the specified file (for debugging purpose only)"
     echo "  -p|--probe card-name"
     echo "                 probe a legacy non-isapnp card and print module options"
     echo "  -P|--listprobe list the supported legacy card modules"
-    echo "  -c|--config    specify the module config file"
+    echo "  -c|--config file"
+    echo "                 specify the module config file"
     echo "  -h|--help      what you're reading"
     exit 1
 }
 
-OPTS=`getopt -o lmLhp:Pu:g:d:rs:c: --long legacy,modinfo,log,help,probe,listprobe,uid,gid,devmode,strict,sound,config -n alsaconf -- "$@"` || exit 1
+OPTS=`getopt -o lmL:hp:Pu:g:d:rs:c: --long legacy,modinfo,log:,help,probe:,listprobe,uid:,gid:,devmode:,strict,sound:,config: -n alsaconf -- "$@"` || exit 1
 eval set -- "$OPTS"
 
 do_legacy_only=0
 use_modinfo_db=0
-do_logging=0
 alsa_uid=0
 alsa_gid=0
 alsa_mode=0666
 legacy_probe_card=""
-LOGFILE="/tmp/alsaconf.log"
+LOGFILE=""
 TESTSOUND="@TESTSOUND@"
 try_all_combination=0
 
@@ -96,7 +96,7 @@ while true ; do
     -h|--help)
        usage; exit 1 ;;
     -L|--log)
-       do_logging=1; rm -f $LOGFILE; shift;;
+       LOGFILE="$2"; shift 2;;
     -p|--probe)
        legacy_probe_card="$2"; shift 2;;
     -P|--listprobe)
@@ -511,7 +511,7 @@ BEGIN {
 /^[<literal space><literal tab>]*PCI: /{
        gsub(/0x/, "");
        gsub(/=/, ":");
-       x = sprintf ("'$lspci' -n 2>/dev/null| grep '"'Class 040?'"' | grep %s", $2);
+       x = sprintf ("'$lspci' -n 2>/dev/null| grep '"'Class 040.'"' | grep %s", $2);
        if (system (x) == 0)
                printf "%s %s\n", $2, driver >>"'"$FOUND"'"
 }
@@ -738,7 +738,7 @@ check_irq_avail () {
 # check playback
 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
 ac_try_load () {
-    test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
+    test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"
     /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1
     if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
        : ;
@@ -764,11 +764,11 @@ ac_try_load () {
     /sbin/modprobe -r snd-$1 >/dev/null 2>&1
     if [ $st = 0 ]; then
        # irq problem?
-       test $do_logging = 1 && echo "no playback return" >> $LOGFILE
+       test -n "$LOGFILE" && echo "no playback return" >> "$LOGFILE"
        return 2
     else
        # seems ok!
-       test $do_logging = 1 && echo "playback OK" >> $LOGFILE
+       test -n "$LOGFILE" && echo "playback OK" >> "$LOGFILE"
        return 0
     fi
 }
@@ -777,7 +777,7 @@ ac_try_load () {
 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
 # ac_try_capture card duplex opts
 ac_try_capture () {
-    test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
+    test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"
     /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1
     if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
        : ;
@@ -809,10 +809,10 @@ ac_try_capture () {
     test $play_pid != 0 && kill -9 $play_pid
     /sbin/modprobe -r snd-$1 >/dev/null 2>&1
     if [ $st = 0 ]; then
-       test $do_logging = 1 && echo "capture no return" >> $LOGFILE
+       test -n "$LOGFILE" && echo "capture no return" >> "$LOGFILE"
        return 2
     else
-       test $do_logging = 1 && echo "capture OK" >> $LOGFILE
+       test -n "$LOGFILE" && echo "capture OK" >> "$LOGFILE"
        return 0
     fi
 }
@@ -882,7 +882,7 @@ ac_try_dmas () {
                        return 1
                    fi
                elif [ $result = 0 ]; then
-                   test $do_logging = 1 && echo "Now checking capture..." >> $LOGFILE
+                   test -n "$LOGFILE" && echo "Now checking capture..." >> "$LOGFILE"
                    ac_opts="$opts"
                    ac_try_capture $1 yes $opts >/dev/null 2>&1 && return 0
                    for d in yes no; do
@@ -1096,6 +1096,12 @@ ac_config_legacy () {
 # main part continued..
 #
 
+if test -n "$LOGFILE" ; then
+    touch "$LOGFILE"
+    echo -n "Starting alsaconf: " >> "$LOGFILE"
+    date >> "$LOGFILE"
+fi
+
 if [ x"$legacy_probe_card" != x ]; then
     ac_opts=""
     if eval ac_try_card_$legacy_probe_card >/dev/null 2>&1; then