2014-07-30 12:18:07 +02:00
#!/bin/bash
2023-03-24 09:07:29 +01:00
SCRIPT_VERSION = 0.5.2
2023-04-29 01:40:56 +02:00
CHANGELOG = 'https://www.alsa-project.org/alsa-info.sh.changelog'
2014-07-30 12:18:07 +02:00
#################################################################################
#Copyright (C) 2007 Free Software Foundation.
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##################################################################################
2019-03-12 15:52:49 +01:00
# The script was written for 2 main reasons:
# 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user.
# 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them.
2014-07-30 12:18:07 +02:00
#Set the locale (this may or may not be a good idea.. let me know)
export LC_ALL = C
2019-03-12 15:52:49 +01:00
# Change the PATH variable, so we can run lspci (needed for some distros)
2023-04-29 01:40:56 +02:00
PATH = " $PATH :/bin:/sbin:/usr/bin:/usr/sbin "
2014-07-30 12:18:07 +02:00
BGTITLE = " ALSA-Info v $SCRIPT_VERSION "
2023-04-29 01:40:56 +02:00
PASTEBINKEY = 'C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc'
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
WGET = " $( command -v wget) "
REQUIRES = ( mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl)
2015-04-27 21:27:05 +02:00
2019-03-12 15:52:49 +01:00
#
# Define some simple functions
#
2014-07-30 12:18:07 +02:00
update( ) {
2015-04-27 21:27:05 +02:00
test -z " $WGET " -o ! -x " $WGET " && return
2023-04-29 01:40:56 +02:00
SHFILE = " $( mktemp -t alsa-info.XXXXXXXXXX) " || exit 1
wget -O " $SHFILE " 'https://www.alsa-project.org/alsa-info.sh' >/dev/null 2>& 1
REMOTE_VERSION = " $( grep SCRIPT_VERSION " $SHFILE " | head -n1 | sed 's/.*=//' ) "
2015-04-27 21:27:05 +02:00
if [ -s " $SHFILE " -a " $REMOTE_VERSION " != " $SCRIPT_VERSION " ] ; then
2023-04-29 01:40:56 +02:00
if [ [ -n " $DIALOG " ] ]
2014-07-30 12:18:07 +02:00
then
OVERWRITE =
2023-04-29 01:40:56 +02:00
if [ -w " $0 " ] ; then
2014-07-30 12:18:07 +02:00
dialog --yesno " Newer version of ALSA-Info has been found\n\nDo you wish to install it?\nNOTICE: The original file $0 will be overwritten! " 0 0
2023-04-29 01:40:56 +02:00
DIALOG_EXIT_CODE = " $? "
if [ [ " $DIALOG_EXIT_CODE " = 0 ] ] ; then
2014-07-30 12:18:07 +02:00
OVERWRITE = yes
fi
fi
if [ -z " $OVERWRITE " ] ; then
dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to download it?" 0 0
2023-04-29 01:40:56 +02:00
DIALOG_EXIT_CODE = " $? "
2014-07-30 12:18:07 +02:00
fi
2023-04-29 01:40:56 +02:00
if [ [ " $DIALOG_EXIT_CODE " = 0 ] ]
2014-07-30 12:18:07 +02:00
then
echo " Newer version detected: $REMOTE_VERSION "
echo " To view the ChangeLog, please visit $CHANGELOG "
2023-04-29 01:40:56 +02:00
if [ " $OVERWRITE " = yes ] ; then
cp " $SHFILE " " $0 "
2014-07-30 12:18:07 +02:00
echo " ALSA-Info script has been updated to v $REMOTE_VERSION "
echo "Please re-run the script"
2023-04-29 01:40:56 +02:00
rm " $SHFILE " 2>/dev/null
2014-07-30 12:18:07 +02:00
else
echo " ALSA-Info script has been downloaded as $SHFILE . "
echo "Please re-run the script from new location."
fi
exit
else
2023-04-29 01:40:56 +02:00
rm " $SHFILE " 2>/dev/null
2014-07-30 12:18:07 +02:00
fi
else
echo " Newer version detected: $REMOTE_VERSION "
echo " To view the ChangeLog, please visit $CHANGELOG "
2023-04-29 01:40:56 +02:00
if [ -w " $0 " ] ; then
2014-07-30 12:18:07 +02:00
echo " The original file $0 will be overwritten! "
echo -n "If you do not like to proceed, press Ctrl-C now.." ; read inp
2023-04-29 01:40:56 +02:00
cp " $SHFILE " " $0 "
2014-07-30 12:18:07 +02:00
echo "ALSA-Info script has been updated. Please re-run it."
2023-04-29 01:40:56 +02:00
rm " $SHFILE " 2>/dev/null
2014-07-30 12:18:07 +02:00
else
echo " ALSA-Info script has been downloaded $SHFILE . "
echo "Please, re-run it from new location."
fi
exit
fi
else
2023-04-29 01:40:56 +02:00
rm " $SHFILE " 2>/dev/null
2014-07-30 12:18:07 +02:00
fi
}
cleanup( ) {
2023-04-29 01:40:56 +02:00
if [ -n " $TEMPDIR " -a " $KEEP_FILES " != yes ] ; then
2014-07-30 12:18:07 +02:00
rm -rf " $TEMPDIR " 2>/dev/null
fi
test -n " $KEEP_OUTPUT " || rm -f " $NFILE "
}
withaplay( ) {
2023-04-29 01:40:56 +02:00
echo "!!Aplay/Arecord output" >> " $FILE "
echo "!!--------------------" >> " $FILE "
echo "" >> " $FILE "
echo "APLAY" >> " $FILE "
echo "" >> " $FILE "
aplay -l >> " $FILE " 2>& 1
echo "" >> " $FILE "
echo "ARECORD" >> " $FILE "
echo "" >> " $FILE "
arecord -l >> " $FILE " 2>& 1
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
2019-12-21 06:32:02 +01:00
withmodules( ) {
2023-04-29 01:40:56 +02:00
echo "!!All Loaded Modules" >> " $FILE "
echo "!!------------------" >> " $FILE "
echo "" >> " $FILE "
awk '{print $1}' < /proc/modules | sort >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
withamixer( ) {
2023-04-29 01:40:56 +02:00
echo "!!Amixer output" >> " $FILE "
echo "!!-------------" >> " $FILE "
echo "" >> " $FILE "
2019-12-21 06:32:03 +01:00
for f in /proc/asound/card*/id; do
[ -f " $f " ] && read -r CARD_NAME < " $f " || continue
2023-04-29 01:40:56 +02:00
echo " !!-------Mixer controls for card $CARD_NAME " >> " $FILE "
echo "" >> " $FILE "
amixer -c " $CARD_NAME " info >> " $FILE " 2>& 1
amixer -c " $CARD_NAME " >> " $FILE " 2>& 1
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
done
2023-04-29 01:40:56 +02:00
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
withalsactl( ) {
2023-04-29 01:40:56 +02:00
echo "!!Alsactl output" >> " $FILE "
echo "!!--------------" >> " $FILE "
echo "" >> " $FILE "
alsactl -f " $TEMPDIR /alsactl.tmp " store
echo "--startcollapse--" >> " $FILE "
cat " $TEMPDIR /alsactl.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
withdevices( ) {
2023-04-29 01:40:56 +02:00
echo "!!ALSA Device nodes" >> " $FILE "
echo "!!-----------------" >> " $FILE "
echo "" >> " $FILE "
ls -la /dev/snd/* >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
withconfigs( ) {
2023-04-29 01:40:56 +02:00
if [ [ -e " $HOME /.asoundrc " ] ] || [ [ -e "/etc/asound.conf" ] ] || [ [ -e " $HOME /.asoundrc.asoundconf " ] ] ; then
echo "!!ALSA configuration files" >> " $FILE "
echo "!!------------------------" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
#Check for ~/.asoundrc
2023-04-29 01:40:56 +02:00
if [ [ -e " $HOME /.asoundrc " ] ]
2014-07-30 12:18:07 +02:00
then
2023-04-29 01:40:56 +02:00
echo "!!User specific config file (~/.asoundrc)" >> " $FILE "
echo "" >> " $FILE "
cat " $HOME /.asoundrc " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
#Check for .asoundrc.asoundconf (seems to be Ubuntu specific)
2023-04-29 01:40:56 +02:00
if [ [ -e " $HOME /.asoundrc.asoundconf " ] ]
2014-07-30 12:18:07 +02:00
then
2023-04-29 01:40:56 +02:00
echo "!!asoundconf-generated config file" >> " $FILE "
echo "" >> " $FILE "
cat " $HOME /.asoundrc.asoundconf " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
#Check for /etc/asound.conf
if [ [ -e /etc/asound.conf ] ]
then
2023-04-29 01:40:56 +02:00
echo "!!System wide config file (/etc/asound.conf)" >> " $FILE "
echo "" >> " $FILE "
cat /etc/asound.conf >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
fi
}
withsysfs( ) {
local i f
local printed = ""
for i in /sys/class/sound/*; do
case " $i " in
*/hwC?D?)
2023-04-29 01:40:56 +02:00
if [ -f " $i /init_pin_configs " ] ; then
2014-07-30 12:18:07 +02:00
if [ -z " $printed " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!Sysfs Files" >> " $FILE "
echo "!!-----------" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs hints; do
2023-04-29 01:40:56 +02:00
echo " $i / $f : " >> " $FILE "
cat " $i / $f " >> " $FILE "
echo >> " $FILE "
2014-07-30 12:18:07 +02:00
done
printed = yes
fi
; ;
esac
done
if [ -n " $printed " ] ; then
2023-04-29 01:40:56 +02:00
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
}
withdmesg( ) {
2023-04-29 01:40:56 +02:00
echo "!!ALSA/HDA dmesg" >> " $FILE "
echo "!!--------------" >> " $FILE "
echo "" >> " $FILE "
dmesg | grep -C1 -E 'ALSA|HDA|HDMI|snd[_-]|sound|audio|hda.codec|hda.intel' >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
}
2020-05-01 09:52:42 +02:00
withpackages( ) {
2020-06-09 10:24:38 +02:00
local RPM
local DPKG
2020-07-01 16:27:11 +02:00
RPM = " $( command -v rpmquery) "
DPKG = " $( command -v dpkg) "
2020-05-01 09:52:42 +02:00
[ -n " $RPM $DPKG " ] || return
2020-07-01 16:27:11 +02:00
local PATTERN = '(alsa-(lib|oss|plugins|tools|(topology|ucm)-conf|utils|sof-firmware)|libalsa|tinycompress|sof-firmware)'
2020-05-01 09:52:42 +02:00
{
echo "!!Packages installed"
echo "!!--------------------"
echo ""
{
if [ -x " $RPM " ] ; then " $RPM " -a; fi
if [ -x " $DPKG " ] ; then " $DPKG " -l; fi
} | grep -E " $PATTERN "
echo ""
} >> " $FILE "
}
2014-07-30 12:18:07 +02:00
withall( ) {
withdevices
withconfigs
withaplay
withamixer
withalsactl
2019-12-21 06:32:02 +01:00
withmodules
2014-07-30 12:18:07 +02:00
withsysfs
withdmesg
2020-05-01 09:52:42 +02:00
withpackages
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
}
get_alsa_library_version( ) {
2023-04-29 01:40:56 +02:00
ALSA_LIB_VERSION = " $( grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null | awk '{ print $3 }' | sed 's/"//g' ) "
2014-07-30 12:18:07 +02:00
if [ -z " $ALSA_LIB_VERSION " ] ; then
if [ -f /etc/lsb-release ] ; then
. /etc/lsb-release
case " $DISTRIB_ID " in
Ubuntu)
2020-07-01 16:27:11 +02:00
if command -v dpkg > /dev/null ; then
2023-04-29 01:40:56 +02:00
ALSA_LIB_VERSION = " $( dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -) "
2014-07-30 12:18:07 +02:00
fi
2023-04-29 01:40:56 +02:00
if [ " $ALSA_LIB_VERSION " = '<none>' ] ; then
2014-07-30 12:18:07 +02:00
ALSA_LIB_VERSION = ""
fi
return
; ;
*)
return
; ;
esac
elif [ -f /etc/debian_version ] ; then
2020-07-01 16:27:11 +02:00
if command -v dpkg > /dev/null ; then
2023-04-29 01:40:56 +02:00
ALSA_LIB_VERSION = " $( dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -) "
2014-07-30 12:18:07 +02:00
fi
2023-04-29 01:40:56 +02:00
if [ " $ALSA_LIB_VERSION " = '<none>' ] ; then
2014-07-30 12:18:07 +02:00
ALSA_LIB_VERSION = ""
fi
return
fi
fi
}
2019-03-12 15:52:49 +01:00
# Basic requires
2023-04-29 01:40:56 +02:00
for prg in " ${ REQUIRES [@] } " ; do
t = " $( command -v " $prg " ) "
2019-03-12 15:52:49 +01:00
if test -z " $t " ; then
echo " This script requires $prg utility to continue. "
exit 1
fi
done
2014-07-30 12:18:07 +02:00
2019-03-12 15:52:49 +01:00
# Run checks to make sure the programs we need are installed.
2020-07-01 16:27:11 +02:00
LSPCI = " $( command -v lspci) "
TPUT = " $( command -v tput) "
DIALOG = " $( command -v dialog) "
2014-07-30 12:18:07 +02:00
2019-03-12 15:52:49 +01:00
# Check to see if sysfs is enabled in the kernel. We'll need this later on
2023-04-29 01:40:56 +02:00
SYSFS = " $( mount | grep sysfs | awk '{ print $3 }' ) "
2014-07-30 12:18:07 +02:00
2019-03-12 15:52:49 +01:00
# Check modprobe config files for sound related options
2023-04-29 01:40:56 +02:00
SNDOPTIONS = " $( modprobe -c | sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' ) "
2014-07-30 12:18:07 +02:00
KEEP_OUTPUT =
NFILE = ""
PASTEBIN = ""
2023-04-29 01:40:56 +02:00
WWWSERVICE = 'www.alsa-project.org'
WELCOME = yes
PROCEED = yes
UPLOAD = ask
2014-07-30 12:18:07 +02:00
REPEAT = ""
while [ -z " $REPEAT " ] ; do
2023-04-29 01:40:56 +02:00
REPEAT = no
2014-07-30 12:18:07 +02:00
case " $1 " in
--update| --help| --about)
2023-04-29 01:40:56 +02:00
WELCOME = no
PROCEED = no
2014-07-30 12:18:07 +02:00
; ;
--upload)
2023-04-29 01:40:56 +02:00
UPLOAD = yes
WELCOME = no
2014-07-30 12:18:07 +02:00
; ;
--no-upload)
2023-04-29 01:40:56 +02:00
UPLOAD = no
WELCOME = no
2014-07-30 12:18:07 +02:00
; ;
--pastebin)
2023-04-29 01:40:56 +02:00
PASTEBIN = yes
WWWSERVICE = pastebin
2014-07-30 12:18:07 +02:00
; ;
--no-dialog)
DIALOG = ""
REPEAT = ""
shift
; ;
--stdout)
DIALOG = ""
2023-04-29 01:40:56 +02:00
WELCOME = no
2014-07-30 12:18:07 +02:00
; ;
esac
done
#Script header output.
2023-04-29 01:40:56 +02:00
if [ " $WELCOME " = yes ] ; then
2014-07-30 12:18:07 +02:00
greeting_message = " \
This script visits the following commands/files to collect diagnostic
information about your ALSA installation and sound related hardware.
dmesg
lspci
aplay
amixer
alsactl
2020-05-01 09:52:42 +02:00
rpm, dpkg
2014-07-30 12:18:07 +02:00
/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 "--------------------------------"
echo " $greeting_message "
fi # dialog
fi # WELCOME
2019-03-12 15:52:49 +01:00
# Set the output file
2023-04-29 01:40:56 +02:00
TEMPDIR = " $( mktemp -t -d alsa-info.XXXXXXXXXX) " || exit 1
2014-07-30 12:18:07 +02:00
FILE = " $TEMPDIR /alsa-info.txt "
if [ -z " $NFILE " ] ; then
2023-04-29 01:40:56 +02:00
NFILE = " $( mktemp -t alsa-info.txt.XXXXXXXXXX) " || exit 1
2014-07-30 12:18:07 +02:00
fi
trap cleanup 0
2023-04-29 01:40:56 +02:00
if [ " $PROCEED " = yes ] ; then
2014-07-30 12:18:07 +02:00
if [ -z " $LSPCI " ] ; then
if [ -d /sys/bus/pci ] ; then
echo "This script requires lspci. Please install it, and re-run this script."
fi
fi
2019-03-12 15:52:49 +01:00
# Fetch the info and store in temp files/variables
2023-04-29 01:40:56 +02:00
TSTAMP = " $( LANG = C TZ = UTC date) "
DISTRO = " $( grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus\|ALT" /etc/{ issue,*release,*version} ) "
KERNEL_VERSION = " $( uname -r) "
KERNEL_PROCESSOR = " $( uname -p) "
KERNEL_MACHINE = " $( uname -m) "
KERNEL_OS = " $( uname -o) "
[ [ " $( uname -v | grep SMP) " ] ] && KERNEL_SMP = Yes || KERNEL_SMP = No
ALSA_DRIVER_VERSION = " $( cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//' ) "
2014-07-30 12:18:07 +02:00
get_alsa_library_version
2023-04-29 01:40:56 +02:00
ALSA_UTILS_VERSION = " $( amixer -v | awk '{ print $3 }' ) "
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
ESDINST = " $( command -v esd) "
PWINST = " $( command -v pipewire) "
PAINST = " $( command -v pulseaudio) "
ARTSINST = " $( command -v artsd) "
JACKINST = " $( command -v jackd) "
JACK2INST = " $( command -v jackdbus) "
ROARINST = " $( command -v roard) "
DMIDECODE = " $( command -v dmidecode) "
2014-07-30 12:18:07 +02:00
#Check for DMI data
if [ -d /sys/class/dmi/id ] ; then
# No root privileges are required when using sysfs method
2023-04-29 01:40:56 +02:00
DMI_SYSTEM_MANUFACTURER = " $( cat /sys/class/dmi/id/sys_vendor 2>/dev/null) "
DMI_SYSTEM_PRODUCT_NAME = " $( cat /sys/class/dmi/id/product_name 2>/dev/null) "
DMI_SYSTEM_PRODUCT_VERSION = " $( cat /sys/class/dmi/id/product_version 2>/dev/null) "
DMI_SYSTEM_FIRMWARE_VERSION = " $( cat /sys/class/dmi/id/bios_version 2>/dev/null) "
DMI_SYSTEM_SKU = " $( cat /sys/class/dmi/id/product_sku 2>/dev/null) "
DMI_BOARD_VENDOR = " $( cat /sys/class/dmi/id/board_vendor 2>/dev/null) "
DMI_BOARD_NAME = " $( cat /sys/class/dmi/id/board_name 2>/dev/null) "
elif [ -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) "
DMI_SYSTEM_PRODUCT_VERSION = " $( " $DMIDECODE " -s system-version 2>/dev/null) "
DMI_SYSTEM_FIRMWARE_VERSION = " $( " $DMIDECODE " -s bios-version 2>/dev/null) "
DMI_SYSTEM_SKU = " $( " $DMIDECODE " -s system-sku-number 2>/dev/null) "
DMI_BOARD_VENDOR = " $( " $DMIDECODE " -s baseboard-manufacturer 2>/dev/null) "
DMI_BOARD_NAME = " $( " $DMIDECODE " -s baseboard-product-name 2>/dev/null) "
2014-07-30 12:18:07 +02:00
fi
2017-01-10 01:32:24 +01:00
# Check for ACPI device status
if [ -d /sys/bus/acpi/devices ] ; then
for f in /sys/bus/acpi/devices/*/status; do
2023-04-29 01:40:56 +02:00
ACPI_STATUS = " $( cat " $f " 2>/dev/null) "
2017-01-10 01:32:24 +01:00
if [ [ " $ACPI_STATUS " -ne 0 ] ] ; then
2023-04-29 01:40:56 +02:00
echo " $f " $'\t' " $ACPI_STATUS " >> " $TEMPDIR /acpidevicestatus.tmp "
2017-01-10 01:32:24 +01:00
fi
done
fi
2023-04-29 01:40:56 +02:00
awk '{ print $2 " (card " $1 ")" }' < /proc/asound/modules > " $TEMPDIR /alsamodules.tmp " 2> /dev/null
cat /proc/asound/cards > " $TEMPDIR /alsacards.tmp "
2014-07-30 12:18:07 +02:00
if [ [ ! -z " $LSPCI " ] ] ; then
2019-12-21 06:32:01 +01:00
for class in 0401 0402 0403; do
lspci -vvnn -d " :: $class " | sed -n '/^[^\t]/,+1p'
2023-04-29 01:40:56 +02:00
done > " $TEMPDIR /lspci.tmp "
2014-07-30 12:18:07 +02:00
fi
#Check for HDA-Intel cards codec#*
2023-04-29 01:40:56 +02:00
cat /proc/asound/card*/codec\# * > " $TEMPDIR /alsa-hda-intel.tmp " 2> /dev/null
2014-07-30 12:18:07 +02:00
#Check for AC97 cards codec
2023-04-29 01:40:56 +02:00
cat /proc/asound/card*/codec97\# 0/ac97\# 0-0 > " $TEMPDIR /alsa-ac97.tmp " 2> /dev/null
cat /proc/asound/card*/codec97\# 0/ac97\# 0-0+regs > " $TEMPDIR /alsa-ac97-regs.tmp " 2> /dev/null
2014-07-30 12:18:07 +02:00
2020-12-09 18:35:49 +01:00
#Check for USB descriptors
if [ -x /usr/bin/lsusb ] ; then
for f in /proc/asound/card[ 0-9] */usbbus; do
test -f " $f " || continue
2023-04-29 01:40:56 +02:00
id = " $( sed 's@/@:@' " $f " ) "
lsusb -v -s " $id " >> " $TEMPDIR /lsusb.tmp " 2> /dev/null
2020-12-09 18:35:49 +01:00
done
fi
#Check for USB stream setup
2023-04-29 01:40:56 +02:00
cat /proc/asound/card*/stream[ 0-9] * > " $TEMPDIR /alsa-usbstream.tmp " 2> /dev/null
2020-12-09 18:35:49 +01:00
2014-07-30 12:18:07 +02:00
#Check for USB mixer setup
2023-04-29 01:40:56 +02:00
cat /proc/asound/card*/usbmixer > " $TEMPDIR /alsa-usbmixer.tmp " 2> /dev/null
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
#Fetch the info, and put it in FILE in a nice readable format.
if [ [ -z " $PASTEBIN " ] ] ; then
echo "upload=true&script=true&cardinfo=" > " $FILE "
2014-07-30 12:18:07 +02:00
else
2023-04-29 01:40:56 +02:00
echo " name= ${ USER } &type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content= " > " $FILE "
fi
echo "!!################################" >> " $FILE "
echo " !!ALSA Information Script v $SCRIPT_VERSION " >> " $FILE "
echo "!!################################" >> " $FILE "
echo "" >> " $FILE "
echo " !!Script ran on: $TSTAMP " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!Linux Distribution" >> " $FILE "
echo "!!------------------" >> " $FILE "
echo "" >> " $FILE "
echo " $DISTRO " >> " $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 " Product Version: $DMI_SYSTEM_PRODUCT_VERSION " >> " $FILE "
echo " Firmware Version: $DMI_SYSTEM_FIRMWARE_VERSION " >> " $FILE "
echo " System SKU: $DMI_SYSTEM_SKU " >> " $FILE "
echo " Board Vendor: $DMI_BOARD_VENDOR " >> " $FILE "
echo " Board Name: $DMI_BOARD_NAME " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!ACPI Device Status Information" >> " $FILE "
echo "!!---------------" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /acpidevicestatus.tmp " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!Kernel Information" >> " $FILE "
echo "!!------------------" >> " $FILE "
echo "" >> " $FILE "
echo " Kernel release: $KERNEL_VERSION " >> " $FILE "
echo " Operating System: $KERNEL_OS " >> " $FILE "
echo " Architecture: $KERNEL_MACHINE " >> " $FILE "
echo " Processor: $KERNEL_PROCESSOR " >> " $FILE "
echo " SMP Enabled: $KERNEL_SMP " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!ALSA Version" >> " $FILE "
echo "!!------------" >> " $FILE "
echo "" >> " $FILE "
echo " Driver version: $ALSA_DRIVER_VERSION " >> " $FILE "
echo " Library version: $ALSA_LIB_VERSION " >> " $FILE "
echo " Utilities version: $ALSA_UTILS_VERSION " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!Loaded ALSA modules" >> " $FILE "
echo "!!-------------------" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsamodules.tmp " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
echo "!!Sound Servers on this system" >> " $FILE "
echo "!!----------------------------" >> " $FILE "
echo "" >> " $FILE "
if [ [ -n " $PWINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?pipewire$' ) " ] ] && PWRUNNING = Yes || PWRUNNING = No
echo "PipeWire:" >> " $FILE "
echo " Installed - Yes ( $PWINST ) " >> " $FILE "
echo " Running - $PWRUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $PAINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?pulseaudio$' ) " ] ] && PARUNNING = Yes || PARUNNING = No
echo "Pulseaudio:" >> " $FILE "
echo " Installed - Yes ( $PAINST ) " >> " $FILE "
echo " Running - $PARUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $ESDINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?esd$' ) " ] ] && ESDRUNNING = Yes || ESDRUNNING = No
echo "ESound Daemon:" >> " $FILE "
echo " Installed - Yes ( $ESDINST ) " >> " $FILE "
echo " Running - $ESDRUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $ARTSINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?artsd$' ) " ] ] && ARTSRUNNING = Yes || ARTSRUNNING = No
echo "aRts:" >> " $FILE "
echo " Installed - Yes ( $ARTSINST ) " >> " $FILE "
echo " Running - $ARTSRUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $JACKINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?jackd$' ) " ] ] && JACKRUNNING = Yes || JACKRUNNING = No
echo "Jack:" >> " $FILE "
echo " Installed - Yes ( $JACKINST ) " >> " $FILE "
echo " Running - $JACKRUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $JACK2INST " ] ] ; then
[ [ " $( pgrep '^(.*/)?jackdbus$' ) " ] ] && JACK2RUNNING = Yes || JACK2RUNNING = No
echo "Jack2:" >> " $FILE "
echo " Installed - Yes ( $JACK2INST ) " >> " $FILE "
echo " Running - $JACK2RUNNING " >> " $FILE "
echo "" >> " $FILE "
fi
if [ [ -n " $ROARINST " ] ] ; then
[ [ " $( pgrep '^(.*/)?roard$' ) " ] ] && ROARRUNNING = Yes || ROARRUNNING = No
echo "RoarAudio:" >> " $FILE "
echo " Installed - Yes ( $ROARINST ) " >> " $FILE "
echo " Running - $ROARRUNNING " >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
if [ [ -z " $PAINST " && -z " $ESDINST " && -z " $ARTSINST " && -z " $JACKINST " && -z " $ROARINST " ] ] ; then
2023-04-29 01:40:56 +02:00
echo "No sound servers found." >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
2023-04-29 01:40:56 +02:00
echo "" >> " $FILE "
echo "!!Soundcards recognised by ALSA" >> " $FILE "
echo "!!-----------------------------" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsacards.tmp " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
if [ [ ! -z " $LSPCI " ] ] ; then
2023-04-29 01:40:56 +02:00
echo "!!PCI Soundcards installed in the system" >> " $FILE "
echo "!!--------------------------------------" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /lspci.tmp " >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
2021-02-22 10:56:31 +01:00
if [ " $SNDOPTIONS " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!Modprobe options (Sound related)" >> " $FILE "
echo "!!--------------------------------" >> " $FILE "
echo "" >> " $FILE "
modprobe -c| sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
2019-03-12 15:52:49 +01:00
if [ -d " $SYSFS " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!Loaded sound module options" >> " $FILE "
echo "!!---------------------------" >> " $FILE "
echo "" >> " $FILE "
2019-03-12 15:52:49 +01:00
for mod in $( cat /proc/asound/modules | awk '{ print $2 }' ) ; do
2023-04-29 01:40:56 +02:00
echo " !!Module: $mod " >> " $FILE "
for params in $( echo " $SYSFS " /module/" $mod " /parameters/*) ; do
echo -ne '\t'
value = " $( cat " $params " ) "
2019-03-12 15:52:49 +01:00
echo " $params : $value " | sed 's:.*/::'
2023-04-29 01:40:56 +02:00
done >> " $FILE "
echo "" >> " $FILE "
2019-03-12 15:52:49 +01:00
done
2023-04-29 01:40:56 +02:00
echo "" >> " $FILE "
echo "!!Sysfs card info" >> " $FILE "
echo "!!---------------" >> " $FILE "
echo "" >> " $FILE "
for cdir in $( echo " $SYSFS " /class/sound/card*) ; do
echo " !!Card: $cdir " >> " $FILE "
driver = " $( readlink -f " $cdir /device/driver " ) "
echo " Driver: $driver " >> " $FILE "
echo "Tree:" >> " $FILE "
tree --noreport " $cdir " -L 2 | sed -e 's/^/\t/g' >> " $FILE "
echo "" >> " $FILE "
2021-02-22 10:56:31 +01:00
done
2023-04-29 01:40:56 +02:00
echo "" >> " $FILE "
if [ -d " $SYSFS /class/sound/ctl-led " ] ; then
echo "!!Sysfs ctl-led info" >> " $FILE "
echo "!!---------------" >> " $FILE "
echo "" >> " $FILE "
for path in $( echo " $SYSFS " /class/sound/ctl-led/[ ms] [ ip] */card*) ; do
echo " !!CTL-LED: $path " >> " $FILE "
2023-03-24 09:07:29 +01:00
if [ -r " $path /list " ] ; then
2023-04-29 01:40:56 +02:00
list = " $( cat " $path /list " ) "
echo " List: $list " >> " $FILE "
2023-03-24 09:07:29 +01:00
fi
2023-04-29 01:40:56 +02:00
#echo "Tree:" >> "$FILE"
#tree --noreport $path -L 2 | sed -e 's/^/\t/g' >> "$FILE"
echo "" >> " $FILE "
2023-03-24 09:07:29 +01:00
done
fi
2014-07-30 12:18:07 +02:00
fi
if [ -s " $TEMPDIR /alsa-hda-intel.tmp " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!HDA-Intel Codec information" >> " $FILE "
echo "!!---------------------------" >> " $FILE "
echo "--startcollapse--" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsa-hda-intel.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
if [ -s " $TEMPDIR /alsa-ac97.tmp " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!AC97 Codec information" >> " $FILE "
echo "!!----------------------" >> " $FILE "
echo "--startcollapse--" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsa-ac97.tmp " >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsa-ac97-regs.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
2020-12-09 18:35:49 +01:00
if [ -s " $TEMPDIR /lsusb.tmp " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!USB Descriptors" >> " $FILE "
echo "!!---------------" >> " $FILE "
echo "--startcollapse--" >> " $FILE "
cat " $TEMPDIR /lsusb.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2020-12-09 18:35:49 +01:00
fi
2021-12-03 14:52:52 +01:00
if [ -s " $TEMPDIR /alsa-usbstream.tmp " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!USB Stream information" >> " $FILE "
echo "!!----------------------" >> " $FILE "
echo "--startcollapse--" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsa-usbstream.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2020-12-09 18:35:49 +01:00
fi
2014-07-30 12:18:07 +02:00
if [ -s " $TEMPDIR /alsa-usbmixer.tmp " ] ; then
2023-04-29 01:40:56 +02:00
echo "!!USB Mixer information" >> " $FILE "
echo "!!---------------------" >> " $FILE "
echo "--startcollapse--" >> " $FILE "
echo "" >> " $FILE "
cat " $TEMPDIR /alsa-usbmixer.tmp " >> " $FILE "
echo "--endcollapse--" >> " $FILE "
echo "" >> " $FILE "
echo "" >> " $FILE "
2014-07-30 12:18:07 +02:00
fi
#If no command line options are specified, then run as though --with-all was specified
if [ -z " $1 " ] ; then
update
fi
fi # proceed
#loop through command line arguments, until none are left.
if [ -n " $1 " ] ; then
until [ -z " $1 " ]
do
case " $1 " in
--pastebin)
update
; ;
--update)
update
exit
; ;
--upload)
2023-04-29 01:40:56 +02:00
UPLOAD = yes
2014-07-30 12:18:07 +02:00
; ;
--no-upload)
2023-04-29 01:40:56 +02:00
UPLOAD = no
2014-07-30 12:18:07 +02:00
; ;
--output)
shift
NFILE = " $1 "
2023-04-29 01:40:56 +02:00
KEEP_OUTPUT = yes
2014-07-30 12:18:07 +02:00
; ;
--debug)
echo " Debugging enabled. $FILE and $TEMPDIR will not be deleted "
2023-04-29 01:40:56 +02:00
KEEP_FILES = yes
2014-07-30 12:18:07 +02:00
echo ""
; ;
--with-all)
withall
; ;
--with-aplay)
withaplay
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
--with-amixer)
withamixer
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
--with-alsactl)
withalsactl
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
--with-devices)
withdevices
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
--with-dmesg)
withdmesg
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
--with-configs)
2019-12-21 06:32:04 +01:00
withconfigs
2023-04-29 01:40:56 +02:00
WITHALL = no
2014-07-30 12:18:07 +02:00
; ;
2020-05-01 09:52:42 +02:00
--with-packages)
withpackages
2023-04-29 01:40:56 +02:00
WITHALL = no
2020-05-01 09:52:42 +02:00
; ;
2014-07-30 12:18:07 +02:00
--stdout)
2023-04-29 01:40:56 +02:00
UPLOAD = no
2014-08-22 10:31:41 +02:00
if [ -z " $WITHALL " ] ; then
withall
fi
2023-04-29 01:40:56 +02:00
cat " $FILE "
rm " $FILE "
2019-12-21 06:32:05 +01:00
exit
2014-07-30 12:18:07 +02:00
; ;
--about)
echo "Written/Tested by the following users of #alsa on irc.freenode.net:"
echo ""
echo " wishie - Script author and developer / Testing"
echo " crimsun - Various script ideas / Testing"
echo " gnubien - Various script ideas / Testing"
echo " GrueMaster - HDA Intel specific items / Testing"
echo " olegfink - Script update function"
echo " TheMuso - display to stdout functionality"
exit 0
; ;
*)
echo " alsa-info.sh version $SCRIPT_VERSION "
echo ""
echo "Available options:"
echo " --with-aplay (includes the output of aplay -l)"
echo " --with-amixer (includes the output of amixer)"
echo " --with-alsactl (includes the output of alsactl)"
echo " --with-configs (includes the output of ~/.asoundrc and"
echo " /etc/asound.conf if they exist)"
echo " --with-devices (shows the device nodes in /dev/snd/)"
echo " --with-dmesg (shows the ALSA/HDA kernel messages)"
2020-05-01 09:52:42 +02:00
echo " --with-packages (includes known packages installed)"
2014-07-30 12:18:07 +02:00
echo ""
echo " --output FILE (specify the file to output for no-upload mode)"
echo " --update (check server for script updates)"
echo " --upload (upload contents to remote server)"
echo " --no-upload (do not upload contents to remote server)"
2023-04-29 01:40:56 +02:00
echo " --pastebin (use 'https://pastebin.ca') as remote server"
2014-07-30 12:18:07 +02:00
echo " instead www.alsa-project.org"
echo " --stdout (print alsa information to standard output"
echo " instead of a file)"
echo " --about (show some information about the script)"
echo " --debug (will run the script as normal, but will not"
2023-04-29 01:40:56 +02:00
echo " delete ${ FILE } ) "
2014-07-30 12:18:07 +02:00
exit 0
; ;
esac
shift 1
done
fi
2023-04-29 01:40:56 +02:00
if [ " $PROCEED " = no ] ; then
2014-07-30 12:18:07 +02:00
exit 1
fi
2014-08-22 10:31:41 +02:00
if [ -z " $WITHALL " ] ; then
withall
fi
2019-12-21 06:32:10 +01:00
# Check if wget is installed, and supports --post-file.
if ! wget --help 2>/dev/null | grep -q post-file; then
# We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually.
2023-04-29 01:40:56 +02:00
if [ " $UPLOAD " != yes ] ; then
2019-12-21 06:32:10 +01:00
:
elif [ -n " $DIALOG " ] ; then
if [ -z " $PASTEBIN " ] ; then
2023-04-29 01:40:56 +02:00
dialog --backtitle " $BGTITLE " --msgbox " Could not automatically upload output to 'https://www.alsa-project.org'.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to 'https://www.alsa-project.org/cardinfo-db' and submit your post. " 25 100
2019-12-21 06:32:10 +01:00
else
2023-04-29 01:40:56 +02:00
dialog --backtitle " $BGTITLE " --msgbox " Could not automatically upload output to 'https://www.pastebin.ca'.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to 'https://www.pastebin.ca/upload.php' and submit your post. " 25 100
2019-12-21 06:32:10 +01:00
fi
else
if [ -z " $PASTEBIN " ] ; then
echo ""
2023-04-29 01:40:56 +02:00
echo "Could not automatically upload output to 'https://www.alsa-project.org'"
2019-12-21 06:32:10 +01:00
echo "Possible reasons are:"
echo " 1. Couldn't find 'wget' in your PATH"
echo " 2. Your version of wget is less than 1.8.2"
echo ""
2023-04-29 01:40:56 +02:00
echo " Please manually upload $NFILE to 'https://www.alsa-project.org/cardinfo-db' and submit your post. "
2019-12-21 06:32:10 +01:00
echo ""
else
echo ""
2023-04-29 01:40:56 +02:00
echo "Could not automatically upload output to 'https://www.pastebin.ca'"
2019-12-21 06:32:10 +01:00
echo "Possible reasons are:"
echo " 1. Couldn't find 'wget' in your PATH"
echo " 2. Your version of wget is less than 1.8.2"
echo ""
2023-04-29 01:40:56 +02:00
echo " Please manually upload $NFILE to 'https://www.pastebin.ca/upload.php' and submit your post. "
2019-12-21 06:32:10 +01:00
echo ""
fi
fi
2023-04-29 01:40:56 +02:00
UPLOAD = no
2019-12-21 06:32:10 +01:00
fi
2023-04-29 01:40:56 +02:00
if [ " $UPLOAD " = ask ] ; then
2014-07-30 12:18:07 +02:00
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
2023-04-29 01:40:56 +02:00
DIALOG_EXIT_CODE = " $? "
if [ " $DIALOG_EXIT_CODE " != 0 ] ; then
UPLOAD = no
2014-07-30 12:18:07 +02:00
else
2023-04-29 01:40:56 +02:00
UPLOAD = yes
2014-07-30 12:18:07 +02:00
fi
else
echo -n " Automatically upload ALSA information to $WWWSERVICE ? [y/N] : "
read -e CONFIRM
2023-04-29 01:40:56 +02:00
if [ " $CONFIRM " != y ] ; then
UPLOAD = no
2014-07-30 12:18:07 +02:00
else
2023-04-29 01:40:56 +02:00
UPLOAD = yes
2014-07-30 12:18:07 +02:00
fi
fi
fi
2023-04-29 01:40:56 +02:00
if [ " $UPLOAD " = no ] ; then
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
mv -f " $FILE " " $NFILE " || exit 1
KEEP_OUTPUT = yes
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
if [ [ -n " $DIALOG " ] ]
2014-07-30 12:18:07 +02:00
then
2019-12-21 06:32:11 +01:00
dialog --backtitle " $BGTITLE " --title "Information collected" --msgbox " \n\nYour ALSA information is in $NFILE " 10 60
2014-07-30 12:18:07 +02:00
else
2019-12-21 06:32:11 +01:00
echo ""
echo " Your ALSA information is in $NFILE "
echo ""
2014-07-30 12:18:07 +02:00
fi
exit
fi # UPLOAD
2023-04-29 01:40:56 +02:00
if [ [ -n " $DIALOG " ] ]
2014-07-30 12:18:07 +02:00
then
2019-12-21 06:32:08 +01:00
dialog --backtitle " $BGTITLE " --infobox " Uploading information to $WWWSERVICE ... " 6 70
else
echo -n " Uploading information to $WWWSERVICE ... "
fi
2014-07-30 12:18:07 +02:00
2023-04-29 01:40:56 +02:00
if [ [ -z " $PASTEBIN " ] ] ; then
wget -O - --tries= 5 --timeout= 60 --post-file= " $FILE " 'https://www.alsa-project.org/cardinfo-db/' & > " $TEMPDIR /wget.tmp "
2014-07-30 12:18:07 +02:00
else
2023-04-29 01:40:56 +02:00
wget -O - --tries= 5 --timeout= 60 --post-file= " $FILE " 'https://pastebin.ca/quiet-paste.php?api=' " ${ PASTEBINKEY } " '&encrypt=t&encryptpw=blahblah' & > " $TEMPDIR /wget.tmp "
2019-12-21 06:32:11 +01:00
fi
2023-04-29 01:40:56 +02:00
if [ " $? " -ne 0 ] ; then
mv -f " $FILE " " $NFILE " || exit 1
KEEP_OUTPUT = yes
2019-12-21 06:32:11 +01:00
if [ -n " $DIALOG " ] ; then
dialog --backtitle " $BGTITLE " --title "Information not uploaded" --msgbox " An error occurred while contacting $WWWSERVICE .\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE " 10 100
else
echo ""
echo " An error occurred while contacting $WWWSERVICE . "
echo "Your information was NOT automatically uploaded."
echo ""
echo " Your ALSA information is in $NFILE "
echo ""
fi
exit
2014-07-30 12:18:07 +02:00
fi
2019-12-21 06:32:08 +01:00
if [ -n " $DIALOG " ] ; then
2014-07-30 12:18:07 +02:00
dialog --backtitle " $BGTITLE " --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
2023-04-29 01:40:56 +02:00
DIALOG_EXIT_CODE = " $? "
if [ " $DIALOG_EXIT_CODE " = 0 ] ; then
grep -v alsa-info.txt " $FILE " > " $TEMPDIR /uploaded.txt "
dialog --backtitle " $BGTITLE " --textbox " $TEMPDIR /uploaded.txt " 0 0
2014-07-30 12:18:07 +02:00
fi
clear
# no dialog
else
2019-12-21 06:32:07 +01:00
echo -e " Done!"
2014-07-30 12:18:07 +02:00
echo ""
2019-03-12 15:52:49 +01:00
fi # dialog
2014-07-30 12:18:07 +02:00
2019-12-21 06:32:09 +01:00
if [ -z " $PASTEBIN " ] ; then
2023-04-29 01:40:56 +02:00
FINAL_URL = " $( grep 'SUCCESS:' " $TEMPDIR /wget.tmp " | cut -d ' ' -f 2) "
2014-07-30 12:18:07 +02:00
else
2023-04-29 01:40:56 +02:00
FINAL_URL = " $( grep 'SUCCESS:' " $TEMPDIR /wget.tmp " | sed -n 's/.*\:\([0-9]\+\).*/https:\/\/pastebin.ca\/\1/p' ) "
2019-12-21 06:32:09 +01:00
fi
# See if tput is available, and use it if it is.
if [ -x " $TPUT " ] ; then
2023-04-29 01:40:56 +02:00
FINAL_URL = " $( tput setaf 1; printf '%s' " $FINAL_URL " ; tput sgr0) "
2014-07-30 12:18:07 +02:00
fi
# Output the URL of the uploaded file.
echo " Your ALSA information is located at $FINAL_URL "
echo "Please inform the person helping you."
echo ""