This commit is contained in:
parent
9accc44676
commit
31b2e8ec53
229
alsa-info.sh
229
alsa-info.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_VERSION=0.4.56
|
SCRIPT_VERSION=0.4.57
|
||||||
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
|
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
@ -36,10 +36,12 @@ PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
|
|||||||
#Define some simple functions
|
#Define some simple functions
|
||||||
|
|
||||||
pbcheck(){
|
pbcheck(){
|
||||||
|
[[ $UPLOAD = "no" ]] && return
|
||||||
|
|
||||||
if [[ -z $PASTEBIN ]]; then
|
if [[ -z $PASTEBIN ]]; then
|
||||||
[[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" NOUPLOAD="yes" PBERROR="yes"
|
[[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
|
||||||
else
|
else
|
||||||
[[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" NOUPLOAD="yes" PBERROR="yes"
|
[[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +74,7 @@ update() {
|
|||||||
echo "Please re-run the script"
|
echo "Please re-run the script"
|
||||||
rm $SHFILE 2>/dev/null
|
rm $SHFILE 2>/dev/null
|
||||||
else
|
else
|
||||||
mv $SHFILE /tmp/alsa-info.sh || exit 1
|
mv -f $SHFILE /tmp/alsa-info.sh || exit 1
|
||||||
echo "ALSA-Info script has been downloaded as /tmp/alsa-info.sh."
|
echo "ALSA-Info script has been downloaded as /tmp/alsa-info.sh."
|
||||||
echo "Please re-run the script from new location."
|
echo "Please re-run the script from new location."
|
||||||
fi
|
fi
|
||||||
@ -90,7 +92,7 @@ update() {
|
|||||||
echo "ALSA-Info script has been updated. Please re-run it."
|
echo "ALSA-Info script has been updated. Please re-run it."
|
||||||
rm $SHFILE 2>/dev/null
|
rm $SHFILE 2>/dev/null
|
||||||
else
|
else
|
||||||
mv $SHFILE /tmp/alsa-info.sh || exit 1
|
mv -f $SHFILE /tmp/alsa-info.sh || exit 1
|
||||||
echo "ALSA-Info script has been downloaded as /tmp/alsa-info.sh."
|
echo "ALSA-Info script has been downloaded as /tmp/alsa-info.sh."
|
||||||
echo "Please, re-run it from new location."
|
echo "Please, re-run it from new location."
|
||||||
fi
|
fi
|
||||||
@ -241,6 +243,26 @@ withsysfs() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
withdmesg() {
|
||||||
|
echo "!!ALSA/HDA dmesg" >> $FILE
|
||||||
|
echo "!!------------------" >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
|
dmesg | grep -C1 -E 'ALSA|HDA|HDMI|sound|hda.codec|hda.intel' >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
withall() {
|
||||||
|
withdevices
|
||||||
|
withconfigs
|
||||||
|
withaplay
|
||||||
|
withamixer
|
||||||
|
withalsactl
|
||||||
|
withlsmod
|
||||||
|
withsysfs
|
||||||
|
withdmesg
|
||||||
|
}
|
||||||
|
|
||||||
get_alsa_library_version() {
|
get_alsa_library_version() {
|
||||||
ALSA_LIB_VERSION=`grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null|awk {'print $3'}|sed 's/"//g'`
|
ALSA_LIB_VERSION=`grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null|awk {'print $3'}|sed 's/"//g'`
|
||||||
|
|
||||||
@ -289,18 +311,24 @@ SNDOPTIONS=$(modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p')
|
|||||||
|
|
||||||
PASTEBIN=""
|
PASTEBIN=""
|
||||||
WWWSERVICE="www.alsa-project.org"
|
WWWSERVICE="www.alsa-project.org"
|
||||||
QUESTION="yes"
|
WELCOME="yes"
|
||||||
PROCEED="yes"
|
PROCEED="yes"
|
||||||
|
UPLOAD="ask"
|
||||||
REPEAT=""
|
REPEAT=""
|
||||||
while [ -z "$REPEAT" ]; do
|
while [ -z "$REPEAT" ]; do
|
||||||
REPEAT="no"
|
REPEAT="no"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--update|--help|--about)
|
--update|--help|--about)
|
||||||
QUESTION="no"
|
WELCOME="no"
|
||||||
PROCEED="no"
|
PROCEED="no"
|
||||||
;;
|
;;
|
||||||
|
--upload)
|
||||||
|
UPLOAD="yes"
|
||||||
|
WELCOME="no"
|
||||||
|
;;
|
||||||
--no-upload)
|
--no-upload)
|
||||||
NOUPLOAD="yes"
|
UPLOAD="no"
|
||||||
|
WELCOME="no"
|
||||||
;;
|
;;
|
||||||
--pastebin)
|
--pastebin)
|
||||||
PASTEBIN="yes"
|
PASTEBIN="yes"
|
||||||
@ -313,8 +341,8 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
--stdout)
|
--stdout)
|
||||||
DIALOG=""
|
DIALOG=""
|
||||||
NOUPLOAD="yes"
|
UPLOAD="no"
|
||||||
QUESTION="no"
|
WELCOME="no"
|
||||||
TOSTDOUT="yes"
|
TOSTDOUT="yes"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -322,47 +350,34 @@ done
|
|||||||
|
|
||||||
|
|
||||||
#Script header output.
|
#Script header output.
|
||||||
if [ "$QUESTION" = "yes" ]; then
|
if [ "$WELCOME" = "yes" ]; then
|
||||||
if [[ -n "$DIALOG" ]]
|
greeting_message="\
|
||||||
then
|
|
||||||
if [ -z "$NOUPLOAD" ]; then
|
|
||||||
dialog --backtitle "$BGTITLE" --title "ALSA-Info script v $SCRIPT_VERSION" --yesno "\nThis script will collect information about your ALSA installation and sound related hardware, to help diagnose your problem\n\nBy default, this script will AUTOMATICALLY UPLOAD your information to a $WWWSERVICE site.\n\nSee $0 --help for options\n\nDo you want to run this script?" 0 0
|
|
||||||
else
|
|
||||||
dialog --backtitle "$BGTITLE" --title "ALSA-Info script v $SCRIPT_VERSION" --yesno "\nThis script will collect information about your ALSA installation and sound related hardware, to help diagnose your problem\n\nSee $0 --help for options\n\nDo you want to run this script?" 0 0
|
|
||||||
fi
|
|
||||||
DIALOG_EXIT_CODE=$?
|
|
||||||
if [ $DIALOG_EXIT_CODE != 0 ]; then
|
|
||||||
echo "Thank you for using the ALSA-Info Script"
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
|
This script visits the following commands/files to collect diagnostic
|
||||||
|
information about your ALSA installation and sound related hardware.
|
||||||
|
|
||||||
|
dmesg
|
||||||
|
lspci
|
||||||
|
lsmod
|
||||||
|
aplay
|
||||||
|
amixer
|
||||||
|
alsactl
|
||||||
|
/proc/asound/
|
||||||
|
/sys/class/sound/
|
||||||
|
~/.asoundrc (etc.)
|
||||||
|
|
||||||
|
See '$0 --help' for command line options.
|
||||||
|
"
|
||||||
|
if [[ -n "$DIALOG" ]]; then
|
||||||
|
dialog --backtitle "$BGTITLE" \
|
||||||
|
--title "ALSA-Info script v $SCRIPT_VERSION" \
|
||||||
|
--msgbox "$greeting_message" 20 80
|
||||||
|
else
|
||||||
echo "ALSA Information Script v $SCRIPT_VERSION"
|
echo "ALSA Information Script v $SCRIPT_VERSION"
|
||||||
echo "--------------------------------"
|
echo "--------------------------------"
|
||||||
echo ""
|
echo "$greeting_message"
|
||||||
echo "This script will collect information about your ALSA installation and sound related hardware, to help diagnose your problem."
|
fi # dialog
|
||||||
echo ""
|
fi # WELCOME
|
||||||
if [ -z "$NOUPLOAD" ]; then
|
|
||||||
if [[ -n "$TPUT" ]]; then
|
|
||||||
tput bold
|
|
||||||
echo "By default, the collected information will be AUTOMATICALLY uploaded to a $WWWSERVICE site."
|
|
||||||
echo "If you do not wish for this to occur, run the script with the --no-upload argument"
|
|
||||||
tput sgr0
|
|
||||||
else
|
|
||||||
echo "By default, the collected information will be AUTOMATICALLY uploaded to a $WWWSERVICE site."
|
|
||||||
echo "If you do not wish for this to occur, run the script with the --no-upload argument"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
fi # NOUPLOAD
|
|
||||||
echo -n "Do you want to run this script? [y/n] : "
|
|
||||||
read -e CONFIRM
|
|
||||||
if [ "$CONFIRM" != "y" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "Thank you for using the ALSA-Info Script"
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi # question
|
|
||||||
|
|
||||||
#Set the output file
|
#Set the output file
|
||||||
TEMPDIR=`mktemp -p /tmp -d alsa-info.XXXXXXXXXX`
|
TEMPDIR=`mktemp -p /tmp -d alsa-info.XXXXXXXXXX`
|
||||||
@ -400,6 +415,12 @@ ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
|||||||
PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
||||||
ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
||||||
JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
||||||
|
DMIDECODE=$(which dmidecode 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -x $DMIDECODE ]; then
|
||||||
|
DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
|
||||||
|
DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
|
cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
|
||||||
cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
|
cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
|
||||||
@ -431,6 +452,13 @@ echo "" >> $FILE
|
|||||||
echo $DISTRO >> $FILE
|
echo $DISTRO >> $FILE
|
||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
|
echo "!!DMI Information" >> $FILE
|
||||||
|
echo "!!---------------" >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
|
echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE
|
||||||
|
echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
|
echo "" >> $FILE
|
||||||
echo "!!Kernel Information" >> $FILE
|
echo "!!Kernel Information" >> $FILE
|
||||||
echo "!!------------------" >> $FILE
|
echo "!!------------------" >> $FILE
|
||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
@ -527,7 +555,10 @@ echo "!!--------------------------" >> $FILE
|
|||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
for mod in `cat /proc/asound/modules|awk {'print $2'}`;do
|
for mod in `cat /proc/asound/modules|awk {'print $2'}`;do
|
||||||
echo "!!Module: $mod" >> $FILE
|
echo "!!Module: $mod" >> $FILE
|
||||||
for params in `ls $SYSFS/module/$mod/parameters/*`; do /bin/echo -ne "\t";/bin/echo "$params : `cat $params`"|sed 's:.*/::' >> $FILE;done
|
for params in `echo $SYSFS/module/$mod/parameters/*`; do
|
||||||
|
echo -ne "\t";
|
||||||
|
echo "$params : `cat $params`" | sed 's:.*/::';
|
||||||
|
done >> $FILE
|
||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
done
|
done
|
||||||
echo "" >> $FILE
|
echo "" >> $FILE
|
||||||
@ -564,12 +595,7 @@ fi
|
|||||||
if [[ -z "$1" ]]
|
if [[ -z "$1" ]]
|
||||||
then
|
then
|
||||||
update
|
update
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
pbcheck
|
pbcheck
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -583,49 +609,29 @@ then
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
--pastebin)
|
--pastebin)
|
||||||
update
|
update
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
withsysfs
|
|
||||||
pbcheck
|
pbcheck
|
||||||
;;
|
;;
|
||||||
--update)
|
--update)
|
||||||
update
|
update
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
--upload)
|
||||||
|
UPLOAD="yes"
|
||||||
|
withall
|
||||||
|
;;
|
||||||
--no-upload)
|
--no-upload)
|
||||||
NOUPLOAD="yes"
|
UPLOAD="no"
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
withsysfs
|
|
||||||
;;
|
;;
|
||||||
--debug)
|
--debug)
|
||||||
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
|
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
|
||||||
KEEP_FILES="yes"
|
KEEP_FILES="yes"
|
||||||
echo ""
|
echo ""
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
withsysfs
|
|
||||||
;;
|
;;
|
||||||
--with-all)
|
--with-all)
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
withsysfs
|
|
||||||
;;
|
;;
|
||||||
--with-aplay)
|
--with-aplay)
|
||||||
withaplay
|
withaplay
|
||||||
@ -639,6 +645,9 @@ then
|
|||||||
--with-devices)
|
--with-devices)
|
||||||
withdevices
|
withdevices
|
||||||
;;
|
;;
|
||||||
|
--with-dmesg)
|
||||||
|
withdmesg
|
||||||
|
;;
|
||||||
--with-configs)
|
--with-configs)
|
||||||
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
|
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
|
||||||
then
|
then
|
||||||
@ -668,13 +677,8 @@ then
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--stdout)
|
--stdout)
|
||||||
NOUPLOAD="yes"
|
UPLOAD="no"
|
||||||
withdevices
|
withall
|
||||||
withconfigs
|
|
||||||
withaplay
|
|
||||||
withamixer
|
|
||||||
withalsactl
|
|
||||||
withlsmod
|
|
||||||
cat $FILE
|
cat $FILE
|
||||||
rm $FILE
|
rm $FILE
|
||||||
;;
|
;;
|
||||||
@ -699,8 +703,10 @@ then
|
|||||||
echo " --with-configs (includes the output of ~/.asoundrc and"
|
echo " --with-configs (includes the output of ~/.asoundrc and"
|
||||||
echo " /etc/asound.conf if they exist)"
|
echo " /etc/asound.conf if they exist)"
|
||||||
echo " --with-devices (shows the device nodes in /dev/snd/)"
|
echo " --with-devices (shows the device nodes in /dev/snd/)"
|
||||||
|
echo " --with-dmesg (shows the ALSA/HDA kernel messages)"
|
||||||
echo ""
|
echo ""
|
||||||
echo " --update (check server for script updates)"
|
echo " --update (check server for script updates)"
|
||||||
|
echo " --upload (upload contents to remote server)"
|
||||||
echo " --no-upload (do not upload contents to remote server)"
|
echo " --no-upload (do not upload contents to remote server)"
|
||||||
echo " --pastebin (use http://pastebin.ca) as remote server"
|
echo " --pastebin (use http://pastebin.ca) as remote server"
|
||||||
echo " instead www.alsa-project.org"
|
echo " instead www.alsa-project.org"
|
||||||
@ -720,32 +726,53 @@ if [ "$PROCEED" = "no" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$NOUPLOAD" ]; then
|
if [ "$UPLOAD" = "ask" ]; then
|
||||||
|
if [[ -n "$DIALOG" ]]; then
|
||||||
|
dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80
|
||||||
|
DIALOG_EXIT_CODE=$?
|
||||||
|
if [ $DIALOG_EXIT_CODE != 0 ]; then
|
||||||
|
UPLOAD="no"
|
||||||
|
else
|
||||||
|
UPLOAD="yes"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : "
|
||||||
|
read -e CONFIRM
|
||||||
|
if [ "$CONFIRM" != "y" ]; then
|
||||||
|
UPLOAD="no"
|
||||||
|
else
|
||||||
|
UPLOAD="yes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$UPLOAD" = "no" ]; then
|
||||||
|
|
||||||
if [ -z "$TOSTDOUT" ]; then
|
if [ -z "$TOSTDOUT" ]; then
|
||||||
mv $FILE $NFILE || exit 1
|
mv -f $FILE $NFILE || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $DIALOG ]]
|
if [[ -n $DIALOG ]]
|
||||||
then
|
then
|
||||||
if [[ -n $PBERROR ]]; then
|
if [[ -n $PBERROR ]]; then
|
||||||
dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE. Your information was NOT automatically uploaded.\n\nYour ALSA information can be seen by looking in $NFILE" 10 100
|
dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100
|
||||||
else
|
else
|
||||||
dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "You requested that your information was NOT automatically uploaded to the $WWWSERVICE\n\nYour ALSA information can be seen by looking in $NFILE" 10 100
|
dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [[ -n $PBERROR ]]; then
|
if [[ -n $PBERROR ]]; then
|
||||||
echo "An error occurred while contacting the $WWWSERVICE. Your information was NOT automatically uploaded."
|
echo "An error occurred while contacting the $WWWSERVICE."
|
||||||
|
echo "Your information was NOT automatically uploaded."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Your ALSA information can be seen by looking in $NFILE"
|
echo "Your ALSA information is in $NFILE"
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
if [ -z "$TOSTDOUT" ]; then
|
if [ -z "$TOSTDOUT" ]; then
|
||||||
echo "You requested that your information was NOT automatically uploaded to the $WWWSERVICE"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Your ALSA information can be seen by looking in $NFILE"
|
echo "Your ALSA information is in $NFILE"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -753,7 +780,7 @@ if [ -n "$NOUPLOAD" ]; then
|
|||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
fi # noupload
|
fi # UPLOAD
|
||||||
|
|
||||||
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
|
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
|
||||||
if
|
if
|
||||||
@ -836,7 +863,7 @@ echo ""
|
|||||||
|
|
||||||
#We couldnt find a suitable wget, so tell the user to upload manually.
|
#We couldnt find a suitable wget, so tell the user to upload manually.
|
||||||
else
|
else
|
||||||
mv $FILE $NFILE || exit 1
|
mv -f $FILE $NFILE || exit 1
|
||||||
if [[ -z $DIALOG ]]
|
if [[ -z $DIALOG ]]
|
||||||
then
|
then
|
||||||
if [[ -z $PASTEBIN ]]; then
|
if [[ -z $PASTEBIN ]]; then
|
||||||
|
@ -92,6 +92,551 @@ index d211e09..4d70df2 100644
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
diff --git a/src/conf.c b/src/conf.c
|
||||||
|
index c86f819..75bb5ac 100644
|
||||||
|
--- a/src/conf.c
|
||||||
|
+++ b/src/conf.c
|
||||||
|
@@ -440,7 +440,7 @@ struct _snd_config {
|
||||||
|
} compound;
|
||||||
|
} u;
|
||||||
|
struct list_head list;
|
||||||
|
- snd_config_t *father;
|
||||||
|
+ snd_config_t *parent;
|
||||||
|
int hop;
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -879,16 +879,16 @@ static int _snd_config_make(snd_config_t **config, char **id, snd_config_type_t
|
||||||
|
|
||||||
|
|
||||||
|
static int _snd_config_make_add(snd_config_t **config, char **id,
|
||||||
|
- snd_config_type_t type, snd_config_t *father)
|
||||||
|
+ snd_config_type_t type, snd_config_t *parent)
|
||||||
|
{
|
||||||
|
snd_config_t *n;
|
||||||
|
int err;
|
||||||
|
- assert(father->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
+ assert(parent->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
err = _snd_config_make(&n, id, type);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
- n->father = father;
|
||||||
|
- list_add_tail(&n->list, &father->u.compound.fields);
|
||||||
|
+ n->parent = parent;
|
||||||
|
+ list_add_tail(&n->list, &parent->u.compound.fields);
|
||||||
|
*config = n;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -912,7 +912,7 @@ static int _snd_config_search(snd_config_t *config,
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input, char **id, int skip)
|
||||||
|
+static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input, char **id, int skip)
|
||||||
|
{
|
||||||
|
snd_config_t *n = *_n;
|
||||||
|
char *s;
|
||||||
|
@@ -940,7 +940,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input,
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_REAL, father);
|
||||||
|
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_REAL, parent);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -957,9 +957,9 @@ static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (i <= INT_MAX)
|
||||||
|
- err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, father);
|
||||||
|
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, parent);
|
||||||
|
else
|
||||||
|
- err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, father);
|
||||||
|
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, parent);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -978,7 +978,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input,
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_STRING, father);
|
||||||
|
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_STRING, parent);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -988,10 +988,10 @@ static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int parse_defs(snd_config_t *father, input_t *input, int skip, int override);
|
||||||
|
+static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override);
|
||||||
|
static int parse_array_defs(snd_config_t *farther, input_t *input, int skip, int override);
|
||||||
|
|
||||||
|
-static int parse_array_def(snd_config_t *father, input_t *input, int idx, int skip, int override)
|
||||||
|
+static int parse_array_def(snd_config_t *parent, input_t *input, int idx, int skip, int override)
|
||||||
|
{
|
||||||
|
char *id = NULL;
|
||||||
|
int c;
|
||||||
|
@@ -1023,7 +1023,7 @@ static int parse_array_def(snd_config_t *father, input_t *input, int idx, int sk
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
|
||||||
|
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, parent);
|
||||||
|
if (err < 0)
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
|
@@ -1050,7 +1050,7 @@ static int parse_array_def(snd_config_t *father, input_t *input, int idx, int sk
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
unget_char(c, input);
|
||||||
|
- err = parse_value(&n, father, input, &id, skip);
|
||||||
|
+ err = parse_value(&n, parent, input, &id, skip);
|
||||||
|
if (err < 0)
|
||||||
|
goto __end;
|
||||||
|
break;
|
||||||
|
@@ -1061,7 +1061,7 @@ static int parse_array_def(snd_config_t *father, input_t *input, int idx, int sk
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int parse_array_defs(snd_config_t *father, input_t *input, int skip, int override)
|
||||||
|
+static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
while (1) {
|
||||||
|
@@ -1071,14 +1071,14 @@ static int parse_array_defs(snd_config_t *father, input_t *input, int skip, int
|
||||||
|
unget_char(c, input);
|
||||||
|
if (c == ']')
|
||||||
|
return 0;
|
||||||
|
- err = parse_array_def(father, input, idx++, skip, override);
|
||||||
|
+ err = parse_array_def(parent, input, idx++, skip, override);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int parse_def(snd_config_t *father, input_t *input, int skip, int override)
|
||||||
|
+static int parse_def(snd_config_t *parent, input_t *input, int skip, int override)
|
||||||
|
{
|
||||||
|
char *id = NULL;
|
||||||
|
int c;
|
||||||
|
@@ -1116,7 +1116,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
free(id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- if (_snd_config_search(father, id, -1, &n) == 0) {
|
||||||
|
+ if (_snd_config_search(parent, id, -1, &n) == 0) {
|
||||||
|
if (mode == DONT_OVERRIDE) {
|
||||||
|
skip = 1;
|
||||||
|
free(id);
|
||||||
|
@@ -1128,7 +1128,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
n->u.compound.join = 1;
|
||||||
|
- father = n;
|
||||||
|
+ parent = n;
|
||||||
|
free(id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -1139,11 +1139,11 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
err = -ENOENT;
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
|
- err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
|
||||||
|
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, parent);
|
||||||
|
if (err < 0)
|
||||||
|
goto __end;
|
||||||
|
n->u.compound.join = 1;
|
||||||
|
- father = n;
|
||||||
|
+ parent = n;
|
||||||
|
}
|
||||||
|
if (c == '=') {
|
||||||
|
c = get_nonwhite(input);
|
||||||
|
@@ -1151,7 +1151,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
if (!skip) {
|
||||||
|
- if (_snd_config_search(father, id, -1, &n) == 0) {
|
||||||
|
+ if (_snd_config_search(parent, id, -1, &n) == 0) {
|
||||||
|
if (mode == DONT_OVERRIDE) {
|
||||||
|
skip = 1;
|
||||||
|
n = NULL;
|
||||||
|
@@ -1181,7 +1181,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
|
||||||
|
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, parent);
|
||||||
|
if (err < 0)
|
||||||
|
goto __end;
|
||||||
|
}
|
||||||
|
@@ -1204,7 +1204,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
unget_char(c, input);
|
||||||
|
- err = parse_value(&n, father, input, &id, skip);
|
||||||
|
+ err = parse_value(&n, parent, input, &id, skip);
|
||||||
|
if (err < 0)
|
||||||
|
goto __end;
|
||||||
|
break;
|
||||||
|
@@ -1222,7 +1222,7 @@ static int parse_def(snd_config_t *father, input_t *input, int skip, int overrid
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int parse_defs(snd_config_t *father, input_t *input, int skip, int override)
|
||||||
|
+static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override)
|
||||||
|
{
|
||||||
|
int c, err;
|
||||||
|
while (1) {
|
||||||
|
@@ -1232,7 +1232,7 @@ static int parse_defs(snd_config_t *father, input_t *input, int skip, int overri
|
||||||
|
unget_char(c, input);
|
||||||
|
if (c == '}')
|
||||||
|
return 0;
|
||||||
|
- err = parse_def(father, input, skip, override);
|
||||||
|
+ err = parse_def(parent, input, skip, override);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -1242,20 +1242,17 @@ static int parse_defs(snd_config_t *father, input_t *input, int skip, int overri
|
||||||
|
static void string_print(char *str, int id, snd_output_t *out)
|
||||||
|
{
|
||||||
|
unsigned char *p = (unsigned char *)str;
|
||||||
|
+ if (!p || !*p) {
|
||||||
|
+ snd_output_puts(out, "''");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
if (!id) {
|
||||||
|
switch (*p) {
|
||||||
|
- case 0:
|
||||||
|
- assert(0);
|
||||||
|
- break;
|
||||||
|
case '0' ... '9':
|
||||||
|
case '-':
|
||||||
|
goto quoted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (!*p) {
|
||||||
|
- snd_output_puts(out, "''");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
loop:
|
||||||
|
switch (*p) {
|
||||||
|
case 0:
|
||||||
|
@@ -1327,10 +1324,11 @@ static void string_print(char *str, int id, snd_output_t *out)
|
||||||
|
snd_output_putc(out, '\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsigned int level, unsigned int joins);
|
||||||
|
+static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
|
||||||
|
+ unsigned int level, unsigned int joins);
|
||||||
|
|
||||||
|
-static int _snd_config_save_leaf(snd_config_t *n, snd_output_t *out,
|
||||||
|
- unsigned int level)
|
||||||
|
+static int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
|
||||||
|
+ unsigned int level)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
unsigned int k;
|
||||||
|
@@ -1353,7 +1351,7 @@ static int _snd_config_save_leaf(snd_config_t *n, snd_output_t *out,
|
||||||
|
case SND_CONFIG_TYPE_COMPOUND:
|
||||||
|
snd_output_putc(out, '{');
|
||||||
|
snd_output_putc(out, '\n');
|
||||||
|
- err = _snd_config_save_leaves(n, out, level + 1, 0);
|
||||||
|
+ err = _snd_config_save_children(n, out, level + 1, 0);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
for (k = 0; k < level; ++k) {
|
||||||
|
@@ -1368,14 +1366,15 @@ static int _snd_config_save_leaf(snd_config_t *n, snd_output_t *out,
|
||||||
|
static void id_print(snd_config_t *n, snd_output_t *out, unsigned int joins)
|
||||||
|
{
|
||||||
|
if (joins > 0) {
|
||||||
|
- assert(n->father);
|
||||||
|
- id_print(n->father, out, joins - 1);
|
||||||
|
+ assert(n->parent);
|
||||||
|
+ id_print(n->parent, out, joins - 1);
|
||||||
|
snd_output_putc(out, '.');
|
||||||
|
}
|
||||||
|
string_print(n->id, 1, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsigned int level, unsigned int joins)
|
||||||
|
+static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
|
||||||
|
+ unsigned int level, unsigned int joins)
|
||||||
|
{
|
||||||
|
unsigned int k;
|
||||||
|
int err;
|
||||||
|
@@ -1385,7 +1384,7 @@ static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsi
|
||||||
|
snd_config_t *n = snd_config_iterator_entry(i);
|
||||||
|
if (n->type == SND_CONFIG_TYPE_COMPOUND &&
|
||||||
|
n->u.compound.join) {
|
||||||
|
- err = _snd_config_save_leaves(n, out, level, joins + 1);
|
||||||
|
+ err = _snd_config_save_children(n, out, level, joins + 1);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
continue;
|
||||||
|
@@ -1399,7 +1398,7 @@ static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsi
|
||||||
|
snd_output_putc(out, '=');
|
||||||
|
#endif
|
||||||
|
snd_output_putc(out, ' ');
|
||||||
|
- err = _snd_config_save_leaf(n, out, level);
|
||||||
|
+ err = _snd_config_save_node_value(n, out, level);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
#if 0
|
||||||
|
@@ -1435,7 +1434,7 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
|
||||||
|
snd_config_iterator_t i, next;
|
||||||
|
snd_config_for_each(i, next, src) {
|
||||||
|
snd_config_t *n = snd_config_iterator_entry(i);
|
||||||
|
- n->father = dst;
|
||||||
|
+ n->parent = dst;
|
||||||
|
}
|
||||||
|
src->u.compound.fields.next->prev = &dst->u.compound.fields;
|
||||||
|
src->u.compound.fields.prev->next = &dst->u.compound.fields;
|
||||||
|
@@ -1521,11 +1520,25 @@ int snd_config_get_id(const snd_config_t *config, const char **id)
|
||||||
|
*/
|
||||||
|
int snd_config_set_id(snd_config_t *config, const char *id)
|
||||||
|
{
|
||||||
|
+ snd_config_iterator_t i, next;
|
||||||
|
char *new_id;
|
||||||
|
- assert(config && id);
|
||||||
|
- new_id = strdup(id);
|
||||||
|
- if (!new_id)
|
||||||
|
- return -ENOMEM;
|
||||||
|
+ assert(config);
|
||||||
|
+ if (id) {
|
||||||
|
+ if (config->parent) {
|
||||||
|
+ snd_config_for_each(i, next, config->parent) {
|
||||||
|
+ snd_config_t *n = snd_config_iterator_entry(i);
|
||||||
|
+ if (n != config && strcmp(id, n->id) == 0)
|
||||||
|
+ return -EEXIST;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ new_id = strdup(id);
|
||||||
|
+ if (!new_id)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ } else {
|
||||||
|
+ if (config->parent)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ new_id = NULL;
|
||||||
|
+ }
|
||||||
|
free(config->id);
|
||||||
|
config->id = new_id;
|
||||||
|
return 0;
|
||||||
|
@@ -1630,21 +1643,23 @@ int snd_config_load_override(snd_config_t *config, snd_input_t *in)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Adds a child to a compound configuration node.
|
||||||
|
- * \param father Handle to the compound configuration node.
|
||||||
|
- * \param leaf Handle to the configuration node to be added to \p father.
|
||||||
|
+ * \param parent Handle to the compound configuration node.
|
||||||
|
+ * \param child Handle to the configuration node to be added to \p parent.
|
||||||
|
* \return Zero if successful, otherwise a negative error code.
|
||||||
|
*/
|
||||||
|
-int snd_config_add(snd_config_t *father, snd_config_t *leaf)
|
||||||
|
+int snd_config_add(snd_config_t *parent, snd_config_t *child)
|
||||||
|
{
|
||||||
|
snd_config_iterator_t i, next;
|
||||||
|
- assert(father && leaf);
|
||||||
|
- snd_config_for_each(i, next, father) {
|
||||||
|
+ assert(parent && child);
|
||||||
|
+ if (!child->id || child->parent)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ snd_config_for_each(i, next, parent) {
|
||||||
|
snd_config_t *n = snd_config_iterator_entry(i);
|
||||||
|
- if (strcmp(leaf->id, n->id) == 0)
|
||||||
|
+ if (strcmp(child->id, n->id) == 0)
|
||||||
|
return -EEXIST;
|
||||||
|
}
|
||||||
|
- leaf->father = father;
|
||||||
|
- list_add_tail(&leaf->list, &father->u.compound.fields);
|
||||||
|
+ child->parent = parent;
|
||||||
|
+ list_add_tail(&child->list, &parent->u.compound.fields);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1658,9 +1673,9 @@ int snd_config_add(snd_config_t *father, snd_config_t *leaf)
|
||||||
|
int snd_config_remove(snd_config_t *config)
|
||||||
|
{
|
||||||
|
assert(config);
|
||||||
|
- if (config->father)
|
||||||
|
+ if (config->parent)
|
||||||
|
list_del(&config->list);
|
||||||
|
- config->father = NULL;
|
||||||
|
+ config->parent = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1684,8 +1699,8 @@ int snd_config_delete(snd_config_t *config)
|
||||||
|
i = config->u.compound.fields.next;
|
||||||
|
while (i != &config->u.compound.fields) {
|
||||||
|
struct list_head *nexti = i->next;
|
||||||
|
- snd_config_t *leaf = snd_config_iterator_entry(i);
|
||||||
|
- err = snd_config_delete(leaf);
|
||||||
|
+ snd_config_t *child = snd_config_iterator_entry(i);
|
||||||
|
+ err = snd_config_delete(child);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
i = nexti;
|
||||||
|
@@ -1698,7 +1713,7 @@ int snd_config_delete(snd_config_t *config)
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- if (config->father)
|
||||||
|
+ if (config->parent)
|
||||||
|
list_del(&config->list);
|
||||||
|
free(config->id);
|
||||||
|
free(config);
|
||||||
|
@@ -1723,8 +1738,8 @@ int snd_config_delete_compound_members(const snd_config_t *config)
|
||||||
|
i = config->u.compound.fields.next;
|
||||||
|
while (i != &config->u.compound.fields) {
|
||||||
|
struct list_head *nexti = i->next;
|
||||||
|
- snd_config_t *leaf = snd_config_iterator_entry(i);
|
||||||
|
- err = snd_config_delete(leaf);
|
||||||
|
+ snd_config_t *child = snd_config_iterator_entry(i);
|
||||||
|
+ err = snd_config_delete(child);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
i = nexti;
|
||||||
|
@@ -2286,7 +2301,10 @@ int snd_config_get_ascii(const snd_config_t *config, char **ascii)
|
||||||
|
int snd_config_test_id(const snd_config_t *config, const char *id)
|
||||||
|
{
|
||||||
|
assert(config && id);
|
||||||
|
- return strcmp(config->id, id);
|
||||||
|
+ if (config->id)
|
||||||
|
+ return strcmp(config->id, id);
|
||||||
|
+ else
|
||||||
|
+ return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -2299,9 +2317,9 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
|
||||||
|
{
|
||||||
|
assert(config && out);
|
||||||
|
if (config->type == SND_CONFIG_TYPE_COMPOUND)
|
||||||
|
- return _snd_config_save_leaves(config, out, 0, 0);
|
||||||
|
+ return _snd_config_save_children(config, out, 0, 0);
|
||||||
|
else
|
||||||
|
- return _snd_config_save_leaf(config, out, 0);
|
||||||
|
+ return _snd_config_save_node_value(config, out, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -2426,6 +2444,7 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
|
||||||
|
} \
|
||||||
|
if (snd_config_get_string(res, &key) < 0) \
|
||||||
|
break; \
|
||||||
|
+ assert(key); \
|
||||||
|
if (!first && (strcmp(key, old_key) == 0 || maxloop <= 0)) { \
|
||||||
|
if (maxloop == 0) \
|
||||||
|
SNDERR("maximum loop count reached (circular configuration?)"); \
|
||||||
|
@@ -2651,6 +2670,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
||||||
|
SNDERR("Invalid type for field func");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
+ assert(str);
|
||||||
|
err = snd_config_search_definition(root, "hook_func", str, &func_conf);
|
||||||
|
if (err >= 0) {
|
||||||
|
snd_config_iterator_t i, next;
|
||||||
|
@@ -2899,6 +2919,7 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
|
||||||
|
if (snd_config_search(root, fdriver, &n) >= 0) {
|
||||||
|
if (snd_config_get_string(n, &driver) < 0)
|
||||||
|
goto __err;
|
||||||
|
+ assert(driver);
|
||||||
|
while (1) {
|
||||||
|
char *s = strchr(driver, '.');
|
||||||
|
if (s == NULL)
|
||||||
|
@@ -3158,13 +3179,13 @@ int snd_config_update_free_global(void)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns an iterator pointing to the first child of a compound configuration node.
|
||||||
|
- * \param node Handle to the compound configuration node.
|
||||||
|
+ * \param config Handle to the compound configuration node.
|
||||||
|
* \return An iterator pointing to the first child.
|
||||||
|
*/
|
||||||
|
-snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node)
|
||||||
|
+snd_config_iterator_t snd_config_iterator_first(const snd_config_t *config)
|
||||||
|
{
|
||||||
|
- assert(node->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
- return node->u.compound.fields.next;
|
||||||
|
+ assert(config->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
+ return config->u.compound.fields.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -3172,7 +3193,7 @@ snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node)
|
||||||
|
* \param iterator An iterator pointing to a child configuration node.
|
||||||
|
* \return An iterator pointing to the next sibling of \p iterator.
|
||||||
|
* If \p iterator is the last sibling, the returned value is the same
|
||||||
|
- * as the result of calling #snd_config_iterator_end on the father
|
||||||
|
+ * as the result of calling #snd_config_iterator_end on the parent
|
||||||
|
* of the nodes.
|
||||||
|
*/
|
||||||
|
snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator)
|
||||||
|
@@ -3182,13 +3203,13 @@ snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t itera
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns an iterator pointing past the last child of a compound configuration node.
|
||||||
|
- * \param node Handle to the compound configuration node.
|
||||||
|
- * \return An iterator pointing past the last child of \p node.
|
||||||
|
+ * \param config Handle to the compound configuration node.
|
||||||
|
+ * \return An iterator pointing past the last child of \p config.
|
||||||
|
*/
|
||||||
|
-snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node)
|
||||||
|
+snd_config_iterator_t snd_config_iterator_end(const snd_config_t *config)
|
||||||
|
{
|
||||||
|
- assert(node->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
- return (const snd_config_iterator_t)&node->u.compound.fields;
|
||||||
|
+ assert(config->type == SND_CONFIG_TYPE_COMPOUND);
|
||||||
|
+ return (const snd_config_iterator_t)&config->u.compound.fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -3209,7 +3230,7 @@ typedef enum _snd_config_walk_pass {
|
||||||
|
} snd_config_walk_pass_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-/* Return 1 if node needs to be attached to father */
|
||||||
|
+/* Return 1 if node needs to be attached to parent */
|
||||||
|
/* Return 2 if compound is replaced with standard node */
|
||||||
|
#ifndef DOC_HIDDEN
|
||||||
|
typedef int (*snd_config_walk_callback_t)(snd_config_t *src,
|
||||||
|
@@ -3350,7 +3371,7 @@ static int _snd_config_expand(snd_config_t *src,
|
||||||
|
switch (pass) {
|
||||||
|
case SND_CONFIG_WALK_PASS_PRE:
|
||||||
|
{
|
||||||
|
- if (strcmp(id, "@args") == 0)
|
||||||
|
+ if (id && strcmp(id, "@args") == 0)
|
||||||
|
return 0;
|
||||||
|
err = snd_config_make_compound(dst, id, src->u.compound.join);
|
||||||
|
if (err < 0)
|
||||||
|
@@ -3395,7 +3416,7 @@ static int _snd_config_expand(snd_config_t *src,
|
||||||
|
snd_config_t *val;
|
||||||
|
snd_config_t *vars = private_data;
|
||||||
|
snd_config_get_string(src, &s);
|
||||||
|
- if (*s == '$') {
|
||||||
|
+ if (s && *s == '$') {
|
||||||
|
s++;
|
||||||
|
if (snd_config_search(vars, s, &val) < 0)
|
||||||
|
return 0;
|
||||||
|
@@ -3447,6 +3468,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
||||||
|
SNDERR("Invalid type for @func");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
+ assert(str);
|
||||||
|
err = snd_config_search_definition(root, "func", str, &func_conf);
|
||||||
|
if (err >= 0) {
|
||||||
|
snd_config_iterator_t i, next;
|
||||||
|
@@ -3859,7 +3881,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
err = snd_config_get_string(typ, &tmp);
|
||||||
|
- if (err < 0)
|
||||||
|
+ if (err < 0 || !tmp)
|
||||||
|
goto _invalid_type;
|
||||||
|
if (strcmp(tmp, "integer") == 0) {
|
||||||
|
long v;
|
||||||
diff --git a/src/conf/cards/Makefile.am b/src/conf/cards/Makefile.am
|
diff --git a/src/conf/cards/Makefile.am b/src/conf/cards/Makefile.am
|
||||||
index f4d6c17..9da78f0 100644
|
index f4d6c17..9da78f0 100644
|
||||||
--- a/src/conf/cards/Makefile.am
|
--- a/src/conf/cards/Makefile.am
|
||||||
@ -218,6 +763,64 @@ index 0000000..38d0027
|
|||||||
+ }
|
+ }
|
||||||
+ hint.device 4
|
+ hint.device 4
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
|
||||||
|
index d6fbec5..5849e3f 100644
|
||||||
|
--- a/src/conf/cards/USB-Audio.conf
|
||||||
|
+++ b/src/conf/cards/USB-Audio.conf
|
||||||
|
@@ -40,11 +40,48 @@ USB-Audio.pcm.iec958_device {
|
||||||
|
# If a device requires non-standard definitions for front, surround40,
|
||||||
|
# surround51, surround71 or iec958, they can be defined here.
|
||||||
|
|
||||||
|
-# USB-Audio."NoiseBlaster 3000".pcm.surround51 {
|
||||||
|
-# @args [ CARD ]
|
||||||
|
-# @args.CARD { type string }
|
||||||
|
-# ...
|
||||||
|
-# }
|
||||||
|
+# M-Audio AudioPhile USB:
|
||||||
|
+# device 0: analog output, digital input
|
||||||
|
+# device 1: digital output, analog input
|
||||||
|
+USB-Audio."AudioPhile".pcm.default {
|
||||||
|
+ @args [ CARD ]
|
||||||
|
+ @args.CARD { type string }
|
||||||
|
+ type asym
|
||||||
|
+ playback.pcm {
|
||||||
|
+ type plug
|
||||||
|
+ slave.pcm {
|
||||||
|
+ type hw
|
||||||
|
+ card $CARD
|
||||||
|
+ device 0
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ capture.pcm {
|
||||||
|
+ type plug
|
||||||
|
+ slave.pcm {
|
||||||
|
+ @func concat
|
||||||
|
+ strings [ "dsnoop:DEVICE=1,CARD=" $CARD ]
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+USB-Audio."AudioPhile".pcm.iec958 {
|
||||||
|
+ @args [ CARD AES0 AES1 AES2 AES3 ]
|
||||||
|
+ @args.CARD { type string }
|
||||||
|
+ @args.AES0 { type integer }
|
||||||
|
+ @args.AES1 { type integer }
|
||||||
|
+ @args.AES2 { type integer }
|
||||||
|
+ @args.AES3 { type integer }
|
||||||
|
+ type asym
|
||||||
|
+ playback.pcm {
|
||||||
|
+ type hw
|
||||||
|
+ card $CARD
|
||||||
|
+ device 1
|
||||||
|
+ }
|
||||||
|
+ capture.pcm {
|
||||||
|
+ type hw
|
||||||
|
+ card $CARD
|
||||||
|
+ device 0
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
diff --git a/src/control/cards.c b/src/control/cards.c
|
diff --git a/src/control/cards.c b/src/control/cards.c
|
||||||
index 4d2c739..0bb8f86 100644
|
index 4d2c739..0bb8f86 100644
|
||||||
--- a/src/control/cards.c
|
--- a/src/control/cards.c
|
||||||
@ -651,6 +1254,19 @@ index 20e119b..8b2d2d0 100644
|
|||||||
rate = calloc(1, sizeof(*rate));
|
rate = calloc(1, sizeof(*rate));
|
||||||
if (! rate)
|
if (! rate)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c
|
||||||
|
index f50cc05..226e65c 100644
|
||||||
|
--- a/src/rawmidi/rawmidi.c
|
||||||
|
+++ b/src/rawmidi/rawmidi.c
|
||||||
|
@@ -153,7 +153,7 @@ static int snd_rawmidi_params_default(snd_rawmidi_t *rawmidi, snd_rawmidi_params
|
||||||
|
assert(params);
|
||||||
|
params->buffer_size = page_size();
|
||||||
|
params->avail_min = 1;
|
||||||
|
- params->no_active_sensing = 0;
|
||||||
|
+ params->no_active_sensing = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/seq/seq_midi_event.c b/src/seq/seq_midi_event.c
|
diff --git a/src/seq/seq_midi_event.c b/src/seq/seq_midi_event.c
|
||||||
index b5caa1b..ddaac5a 100644
|
index b5caa1b..ddaac5a 100644
|
||||||
--- a/src/seq/seq_midi_event.c
|
--- a/src/seq/seq_midi_event.c
|
||||||
@ -1028,10 +1644,10 @@ index 0000000..8d2c1bd
|
|||||||
+LDADD = ../../src/libasound.la
|
+LDADD = ../../src/libasound.la
|
||||||
diff --git a/test/lsb/midi_event.c b/test/lsb/midi_event.c
|
diff --git a/test/lsb/midi_event.c b/test/lsb/midi_event.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..3a4d7fa
|
index 0000000..2ae90a7
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/test/lsb/midi_event.c
|
+++ b/test/lsb/midi_event.c
|
||||||
@@ -0,0 +1,362 @@
|
@@ -0,0 +1,371 @@
|
||||||
+#include <stdlib.h>
|
+#include <stdlib.h>
|
||||||
+#include <string.h>
|
+#include <string.h>
|
||||||
+#include <errno.h>
|
+#include <errno.h>
|
||||||
@ -1072,7 +1688,8 @@ index 0000000..3a4d7fa
|
|||||||
+ unsigned char buf[50];
|
+ unsigned char buf[50];
|
||||||
+ int count;
|
+ int count;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+#define DECODE() snd_midi_event_decode(midi_event, buf, sizeof(buf), &ev)
|
+#define DECODE() snd_midi_event_decode(midi_event, buf, sizeof(buf), &ev)
|
||||||
+#define BUF_MATCHES(str) midi_matches_regex(buf, count, str)
|
+#define BUF_MATCHES(str) midi_matches_regex(buf, count, str)
|
||||||
@ -1178,6 +1795,9 @@ index 0000000..3a4d7fa
|
|||||||
+ TEST_CHECK(DECODES_TO("f111"));
|
+ TEST_CHECK(DECODES_TO("f111"));
|
||||||
+ TEST_CHECK(DECODES_TO("f111"));
|
+ TEST_CHECK(DECODES_TO("f111"));
|
||||||
+
|
+
|
||||||
|
+ /* buffer overflow */
|
||||||
|
+ TEST_CHECK(snd_midi_event_decode(midi_event, buf, 1, &ev) == -ENOMEM);
|
||||||
|
+
|
||||||
+ snd_midi_event_free(midi_event);
|
+ snd_midi_event_free(midi_event);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@ -1188,7 +1808,8 @@ index 0000000..3a4d7fa
|
|||||||
+ unsigned char buf[50];
|
+ unsigned char buf[50];
|
||||||
+ int count;
|
+ int count;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+ snd_seq_ev_clear(&ev);
|
+ snd_seq_ev_clear(&ev);
|
||||||
+
|
+
|
||||||
@ -1207,7 +1828,8 @@ index 0000000..3a4d7fa
|
|||||||
+ snd_midi_event_t *midi_event;
|
+ snd_midi_event_t *midi_event;
|
||||||
+ snd_seq_event_t ev;
|
+ snd_seq_event_t ev;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+#define ENCODE(str) snd_midi_event_encode(midi_event, \
|
+#define ENCODE(str) snd_midi_event_encode(midi_event, \
|
||||||
+ (const unsigned char *)str, \
|
+ (const unsigned char *)str, \
|
||||||
@ -1317,7 +1939,8 @@ index 0000000..3a4d7fa
|
|||||||
+ snd_midi_event_t *midi_event;
|
+ snd_midi_event_t *midi_event;
|
||||||
+ snd_seq_event_t ev;
|
+ snd_seq_event_t ev;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+ TEST_CHECK(ENCODE("\x91\x02") == 2);
|
+ TEST_CHECK(ENCODE("\x91\x02") == 2);
|
||||||
+ TEST_CHECK(ev.type == SND_SEQ_EVENT_NONE);
|
+ TEST_CHECK(ev.type == SND_SEQ_EVENT_NONE);
|
||||||
@ -1337,7 +1960,8 @@ index 0000000..3a4d7fa
|
|||||||
+ unsigned char buf[50];
|
+ unsigned char buf[50];
|
||||||
+ int count;
|
+ int count;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+ snd_seq_ev_set_noteon(&ev, 1, 2, 3);
|
+ snd_seq_ev_set_noteon(&ev, 1, 2, 3);
|
||||||
+ TEST_CHECK(DECODES_TO("910203"));
|
+ TEST_CHECK(DECODES_TO("910203"));
|
||||||
@ -1361,7 +1985,8 @@ index 0000000..3a4d7fa
|
|||||||
+ snd_midi_event_t *midi_event;
|
+ snd_midi_event_t *midi_event;
|
||||||
+ snd_seq_event_t ev;
|
+ snd_seq_event_t ev;
|
||||||
+
|
+
|
||||||
+ ALSA_CHECK(snd_midi_event_new(256, &midi_event));
|
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
|
||||||
|
+ return;
|
||||||
+
|
+
|
||||||
+#define ENCODE_BYTE(c) snd_midi_event_encode_byte(midi_event, c, &ev)
|
+#define ENCODE_BYTE(c) snd_midi_event_encode_byte(midi_event, c, &ev)
|
||||||
+ TEST_CHECK(ENCODE_BYTE(0x81) == 0);
|
+ TEST_CHECK(ENCODE_BYTE(0x81) == 0);
|
||||||
|
17
alsa.changes
17
alsa.changes
@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 20 10:21:17 CEST 2009 - tiwai@suse.de
|
||||||
|
|
||||||
|
- minor improvement of alsa-info for dmesg output
|
||||||
|
- minor fixes in conf.c; renaming parameters, prevent adopting
|
||||||
|
a non-orphan in snd_config_add()
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 16 11:33:55 CEST 2009 - tiwai@suse.de
|
||||||
|
|
||||||
|
- Misc fixes in conf.c
|
||||||
|
- rawmidi: disable active-sensing-on-close by default
|
||||||
|
- USB-Audio.conf: fix definition for M-Audio AudioPhile spdif device
|
||||||
|
- LSB midi event test codes
|
||||||
|
- updated to alsa-info.sh to 0.4.57; don't upload the information
|
||||||
|
as default; include relevant dmesg outputs
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jul 7 14:57:24 CEST 2009 - tiwai@suse.de
|
Tue Jul 7 14:57:24 CEST 2009 - tiwai@suse.de
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ Obsoletes: alsa-64bit
|
|||||||
#
|
#
|
||||||
Summary: Advanced Linux Sound Architecture
|
Summary: Advanced Linux Sound Architecture
|
||||||
Version: 1.0.20
|
Version: 1.0.20
|
||||||
Release: 6
|
Release: 7
|
||||||
Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2
|
Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2
|
||||||
Source8: 40-alsa.rules
|
Source8: 40-alsa.rules
|
||||||
Source11: alsasound
|
Source11: alsasound
|
||||||
|
Loading…
x
Reference in New Issue
Block a user