4 CHANGELOG='https://www.alsa-project.org/alsa-info.sh.changelog'
6 #################################################################################
7 #Copyright (C) 2007 Free Software Foundation.
9 #This program is free software; you can redistribute it and/or modify
10 #it under the terms of the GNU General Public License as published by
11 #the Free Software Foundation; either version 2 of the License, or
12 #(at your option) any later version.
14 #This program is distributed in the hope that it will be useful,
15 #but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 #GNU General Public License for more details.
19 #You should have received a copy of the GNU General Public License
20 #along with this program; if not, write to the Free Software
21 #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ##################################################################################
25 # The script was written for 2 main reasons:
26 # 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user.
27 # 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them.
29 #Set the locale (this may or may not be a good idea.. let me know)
32 # Change the PATH variable, so we can run lspci (needed for some distros)
33 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
34 BGTITLE="ALSA-Info v $SCRIPT_VERSION"
35 PASTEBINKEY='C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc'
37 WGET="$(command -v wget)"
38 REQUIRES="mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl"
41 # Define some simple functions
45 test -z "$WGET" || test ! -x "$WGET" && return
47 SHFILE=$(mktemp -t alsa-info.XXXXXXXXXX) || exit 1
48 wget -O $SHFILE "https://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
49 REMOTE_VERSION=$(grep SCRIPT_VERSION $SHFILE | head -n1 | sed 's/.*=//')
50 if [ -s "$SHFILE" ] && [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
55 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
57 if [[ $DIALOG_EXIT_CODE = 0 ]]; then
61 if [ -z "$OVERWRITE" ]; then
62 dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to download it?" 0 0
65 if [[ $DIALOG_EXIT_CODE = 0 ]]
67 echo "Newer version detected: $REMOTE_VERSION"
68 echo "To view the ChangeLog, please visit $CHANGELOG"
69 if [ "$OVERWRITE" = "yes" ]; then
71 echo "ALSA-Info script has been updated to v $REMOTE_VERSION"
72 echo "Please re-run the script"
73 rm $SHFILE 2>/dev/null
75 echo "ALSA-Info script has been downloaded as $SHFILE."
76 echo "Please re-run the script from new location."
80 rm $SHFILE 2>/dev/null
83 echo "Newer version detected: $REMOTE_VERSION"
84 echo "To view the ChangeLog, please visit $CHANGELOG"
86 echo "The original file $0 will be overwritten!"
87 echo -n "If you do not like to proceed, press Ctrl-C now.." ; read inp
89 echo "ALSA-Info script has been updated. Please re-run it."
90 rm $SHFILE 2>/dev/null
92 echo "ALSA-Info script has been downloaded $SHFILE."
93 echo "Please, re-run it from new location."
98 rm $SHFILE 2>/dev/null
103 if [ -n "$TEMPDIR" ] && [ "$KEEP_FILES" != "yes" ]; then
104 rm -rf "$TEMPDIR" 2>/dev/null
106 test -n "$KEEP_OUTPUT" || rm -f "$NFILE"
111 echo "!!Aplay/Arecord output" >> "$FILE"
112 echo "!!--------------------" >> "$FILE"
114 echo "APLAY" >> "$FILE"
116 aplay -l >> "$FILE" 2>&1
118 echo "ARECORD" >> "$FILE"
120 arecord -l >> "$FILE" 2>&1
125 echo "!!All Loaded Modules" >> "$FILE"
126 echo "!!------------------" >> "$FILE"
128 awk '{print $1}' < /proc/modules | sort >> "$FILE"
134 echo "!!Amixer output" >> "$FILE"
135 echo "!!-------------" >> "$FILE"
137 for f in /proc/asound/card*/id; do
138 [ -f "$f" ] && read -r CARD_NAME < "$f" || continue
139 echo "!!-------Mixer controls for card $CARD_NAME" >> "$FILE"
141 amixer -c "$CARD_NAME" info >> "$FILE" 2>&1
142 amixer -c "$CARD_NAME" >> "$FILE" 2>&1
149 echo "!!Alsactl output" >> "$FILE"
150 echo "!!--------------" >> "$FILE"
152 alsactl -f "$TEMPDIR/alsactl.tmp" store
153 echo "--startcollapse--" >> "$FILE"
154 cat "$TEMPDIR/alsactl.tmp" >> "$FILE"
155 echo "--endcollapse--" >> "$FILE"
161 echo "!!ALSA Device nodes" >> "$FILE"
162 echo "!!-----------------" >> "$FILE"
164 ls -la /dev/snd/* >> "$FILE"
170 if [[ -e "$HOME/.asoundrc" ]] || [[ -e "/etc/asound.conf" ]] || [[ -e "$HOME/.asoundrc.asoundconf" ]]; then
171 echo "!!ALSA configuration files" >> "$FILE"
172 echo "!!------------------------" >> "$FILE"
175 #Check for ~/.asoundrc
176 if [[ -e "$HOME/.asoundrc" ]]
178 echo "!!User specific config file (~/.asoundrc)" >> "$FILE"
180 cat "$HOME/.asoundrc" >> "$FILE"
184 #Check for .asoundrc.asoundconf (seems to be Ubuntu specific)
185 if [[ -e "$HOME/.asoundrc.asoundconf" ]]
187 echo "!!asoundconf-generated config file" >> "$FILE"
189 cat "$HOME/.asoundrc.asoundconf" >> "$FILE"
193 #Check for /etc/asound.conf
194 if [[ -e /etc/asound.conf ]]
196 echo "!!System wide config file (/etc/asound.conf)" >> "$FILE"
198 cat /etc/asound.conf >> "$FILE"
208 for i in /sys/class/sound/*; do
211 if [ -f "$i/init_pin_configs" ]; then
212 if [ -z "$printed" ]; then
213 echo "!!Sysfs Files" >> "$FILE"
214 echo "!!-----------" >> "$FILE"
217 for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs hints; do
218 echo "$i/$f:" >> "$FILE"
219 cat "$i/$f" >> "$FILE"
227 if [ -n "$printed" ]; then
233 echo "!!ALSA/HDA dmesg" >> "$FILE"
234 echo "!!--------------" >> "$FILE"
236 dmesg | grep -C1 -E 'ALSA|HDA|HDMI|snd[_-]|sound|audio|hda.codec|hda.intel' >> "$FILE"
244 RPM="$(command -v rpmquery)"
245 DPKG="$(command -v dpkg)"
246 [ -n "$RPM$DPKG" ] || return
247 local PATTERN='(alsa-(lib|oss|plugins|tools|ucm|(topology|ucm)-conf|utils|sof-firmware)|libalsa|tinycompress|sof-firmware)'
249 echo "!!Packages installed"
250 echo "!!--------------------"
253 if [ -x "$RPM" ]; then "$RPM" -a; fi
254 if [ -x "$DPKG" ]; then "$DPKG" -l; fi
255 } | grep -E "$PATTERN"
273 get_alsa_library_version() {
274 ALSA_LIB_VERSION="$(grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null | awk '{ print $3 }' | sed 's/"//g')"
276 if [ -z "$ALSA_LIB_VERSION" ]; then
277 if [ -f /etc/lsb-release ]; then
279 case "$DISTRIB_ID" in
281 if command -v dpkg > /dev/null ; then
282 ALSA_LIB_VERSION="$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)"
285 if [ "$ALSA_LIB_VERSION" = '<none>' ]; then
294 elif [ -f /etc/debian_version ]; then
295 if command -v dpkg > /dev/null ; then
296 ALSA_LIB_VERSION="$(dpkg -l libasound2 | tail -1 | awk '{ print $3 }' | cut -f 1 -d -)"
299 if [ "$ALSA_LIB_VERSION" = '<none>' ]; then
308 for prg in $REQUIRES; do
309 t="$(command -v "$prg")"
310 if test -z "$t"; then
311 echo "This script requires $prg utility to continue."
316 # Run checks to make sure the programs we need are installed.
317 LSPCI="$(command -v lspci)"
318 TPUT="$(command -v tput)"
319 DIALOG="$(command -v dialog)"
321 # Check to see if sysfs is enabled in the kernel. We'll need this later on
322 SYSFS="$(mount | grep sysfs | awk '{ print $3 }')"
324 # Check modprobe config files for sound related options
325 SNDOPTIONS="$(modprobe -c | sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p')"
331 WWWSERVICE='www.alsa-project.org'
336 while [ -z "$REPEAT" ]; do
339 --update|--help|--about)
368 #Script header output.
369 if [ "$WELCOME" = yes ]; then
372 This script visits the following commands/files to collect diagnostic
373 information about your ALSA installation and sound related hardware.
385 See '$0 --help' for command line options.
387 if [ -n "$DIALOG" ]; then
388 dialog --backtitle "$BGTITLE" \
389 --title "ALSA-Info script v $SCRIPT_VERSION" \
390 --msgbox "$greeting_message" 20 80
392 echo "ALSA Information Script v $SCRIPT_VERSION"
393 echo "--------------------------------"
394 echo "$greeting_message"
398 # Set the output file
399 TEMPDIR="$(mktemp -t -d alsa-info.XXXXXXXXXX)" || exit 1
400 FILE="$TEMPDIR/alsa-info.txt"
401 if [ -z "$NFILE" ]; then
402 NFILE="$(mktemp -t alsa-info.txt.XXXXXXXXXX)" || exit 1
407 if [ "$PROCEED" = yes ]; then
409 if [ -z "$LSPCI" ]; then
410 if [ -d /sys/bus/pci ]; then
411 echo "This script requires lspci. Please install it, and re-run this script."
415 # Fetch the info and store in temp files/variables
416 TSTAMP=$(LANG=C TZ=UTC date)
417 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 /etc/*release /etc/*version)
418 KERNEL_RELEASE=$(uname -r)
419 KERNEL_MACHINE=$(uname -m)
420 KERNEL_PROCESSOR=$(uname -p)
421 KERNEL_OS=$(uname -o)
422 KERNEL_VERSION=$(uname -v)
423 if [[ "$KERNEL_VERSION" = *SMP* ]]; then KERNEL_SMP=Yes; else KERNEL_SMP=No; fi
424 ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//')
425 get_alsa_library_version
426 ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }')
428 ESDINST=$(command -v esd)
429 PWINST=$(command -v pipewire)
430 PAINST=$(command -v pulseaudio)
431 ARTSINST=$(command -v artsd)
432 JACKINST=$(command -v jackd)
433 JACK2INST=$(command -v jackdbus)
434 ROARINST=$(command -v roard)
435 DMIDECODE=$(command -v dmidecode)
438 if [ -d /sys/class/dmi/id ]; then
439 # No root privileges are required when using sysfs method
440 DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)
441 DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
442 DMI_SYSTEM_PRODUCT_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null)
443 DMI_SYSTEM_FIRMWARE_VERSION=$(cat /sys/class/dmi/id/bios_version 2>/dev/null)
444 DMI_SYSTEM_SKU=$(cat /sys/class/dmi/id/product_sku 2>/dev/null)
445 DMI_BOARD_VENDOR=$(cat /sys/class/dmi/id/board_vendor 2>/dev/null)
446 DMI_BOARD_NAME=$(cat /sys/class/dmi/id/board_name 2>/dev/null)
447 elif [ -x $DMIDECODE ]; then
448 DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
449 DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
450 DMI_SYSTEM_PRODUCT_VERSION=$($DMIDECODE -s system-version 2>/dev/null)
451 DMI_SYSTEM_FIRMWARE_VERSION=$($DMIDECODE -s bios-version 2>/dev/null)
452 DMI_SYSTEM_SKU=$($DMIDECODE -s system-sku-number 2>/dev/null)
453 DMI_BOARD_VENDOR=$($DMIDECODE -s baseboard-manufacturer 2>/dev/null)
454 DMI_BOARD_NAME=$($DMIDECODE -s baseboard-product-name 2>/dev/null)
457 # Check for ACPI device status
458 if [ -d /sys/bus/acpi/devices ]; then
459 for f in /sys/bus/acpi/devices/*/status; do
460 ACPI_STATUS=$(cat $f 2>/dev/null);
461 if [[ "$ACPI_STATUS" -ne 0 ]]; then
462 echo $f $'\t' $ACPI_STATUS >>$TEMPDIR/acpidevicestatus.tmp;
467 # Check for SoundWire ACPI _adr device status
468 if [ -d /sys/bus/acpi/devices ]; then
469 for f in /sys/bus/acpi/devices/*/adr; do
470 ACPI_ADR=$(cat $f 2>/dev/null);
471 ACPI_ADR_INT=$(printf "%d" $ACPI_ADR);
472 if [[ "$ACPI_ADR_INT" -ne 0 ]]; then
474 0x??????025d*) echo "Realtek $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
475 0x??????01fa*) echo "Cirrus Logic $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
476 0x??????0102*) echo "TI $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
482 awk '{ print $2 " (card " $1 ")" }' < /proc/asound/modules > $TEMPDIR/alsamodules.tmp 2> /dev/null
483 cat /proc/asound/cards > $TEMPDIR/alsacards.tmp
484 if [[ ! -z "$LSPCI" ]]; then
485 for class in 0401 0402 0403; do
486 lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p'
487 done > $TEMPDIR/lspci.tmp
490 #Check for HDA-Intel cards codec#*
491 cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null
493 #Check for AC97 cards codec
494 cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null
495 cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null
497 #Check for USB descriptors
498 if [ -x /usr/bin/lsusb ]; then
499 for f in /proc/asound/card[0-9]*/usbbus; do
500 test -f "$f" || continue
501 id=$(sed 's@/@:@' $f)
502 lsusb -v -s $id >> $TEMPDIR/lsusb.tmp 2> /dev/null
506 #Check for USB stream setup
507 cat /proc/asound/card*/stream[0-9]* > $TEMPDIR/alsa-usbstream.tmp 2> /dev/null
509 #Check for USB mixer setup
510 cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null
512 #Fetch the info, and put it in $FILE in a nice readable format.
513 if [[ -z $PASTEBIN ]]; then
514 echo "upload=true&script=true&cardinfo=" > $FILE
516 echo "name=$USER&type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content=" > $FILE
518 echo "!!################################" >> $FILE
519 echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE
520 echo "!!################################" >> $FILE
522 echo "!!Script ran on: $TSTAMP" >> $FILE
525 echo "!!Linux Distribution" >> $FILE
526 echo "!!------------------" >> $FILE
528 echo $DISTRO >> $FILE
531 echo "!!DMI Information" >> $FILE
532 echo "!!---------------" >> $FILE
534 echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE
535 echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
536 echo "Product Version: $DMI_SYSTEM_PRODUCT_VERSION" >> $FILE
537 echo "Firmware Version: $DMI_SYSTEM_FIRMWARE_VERSION" >> $FILE
538 echo "System SKU: $DMI_SYSTEM_SKU" >> $FILE
539 echo "Board Vendor: $DMI_BOARD_VENDOR" >> $FILE
540 echo "Board Name: $DMI_BOARD_NAME" >> $FILE
543 echo "!!ACPI Device Status Information" >> $FILE
544 echo "!!---------------" >> $FILE
546 cat $TEMPDIR/acpidevicestatus.tmp >> $FILE
549 echo "!!ACPI SoundWire Device Status Information" >> $FILE
550 echo "!!---------------" >> $FILE
552 cat $TEMPDIR/sdwstatus.tmp >> $FILE
555 echo "!!Kernel Information" >> $FILE
556 echo "!!------------------" >> $FILE
558 echo "Kernel release: $KERNEL_VERSION" >> $FILE
559 echo "Operating System: $KERNEL_OS" >> $FILE
560 echo "Architecture: $KERNEL_MACHINE" >> $FILE
561 echo "Processor: $KERNEL_PROCESSOR" >> $FILE
562 echo "SMP Enabled: $KERNEL_SMP" >> $FILE
565 echo "!!ALSA Version" >> $FILE
566 echo "!!------------" >> $FILE
568 echo "Driver version: $ALSA_DRIVER_VERSION" >> $FILE
569 echo "Library version: $ALSA_LIB_VERSION" >> $FILE
570 echo "Utilities version: $ALSA_UTILS_VERSION" >> $FILE
573 echo "!!Loaded ALSA modules" >> $FILE
574 echo "!!-------------------" >> $FILE
576 cat $TEMPDIR/alsamodules.tmp >> $FILE
579 echo "!!Sound Servers on this system" >> $FILE
580 echo "!!----------------------------" >> $FILE
582 if [[ -n $PWINST ]];then
583 [[ $(pgrep '^(.*/)?pipewire$') ]] && PWRUNNING="Yes" || PWRUNNING="No"
584 echo "PipeWire:" >> $FILE
585 echo " Installed - Yes ($PWINST)" >> $FILE
586 echo " Running - $PWRUNNING" >> $FILE
589 if [[ -n $PAINST ]];then
590 [[ $(pgrep '^(.*/)?pulseaudio$') ]] && PARUNNING="Yes" || PARUNNING="No"
591 echo "Pulseaudio:" >> $FILE
592 echo " Installed - Yes ($PAINST)" >> $FILE
593 echo " Running - $PARUNNING" >> $FILE
596 if [[ -n $ESDINST ]];then
597 [[ $(pgrep '^(.*/)?esd$') ]] && ESDRUNNING="Yes" || ESDRUNNING="No"
598 echo "ESound Daemon:" >> $FILE
599 echo " Installed - Yes ($ESDINST)" >> $FILE
600 echo " Running - $ESDRUNNING" >> $FILE
603 if [[ -n $ARTSINST ]];then
604 [[ $(pgrep '^(.*/)?artsd$') ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No"
605 echo "aRts:" >> $FILE
606 echo " Installed - Yes ($ARTSINST)" >> $FILE
607 echo " Running - $ARTSRUNNING" >> $FILE
610 if [[ -n $JACKINST ]];then
611 [[ $(pgrep '^(.*/)?jackd$') ]] && JACKRUNNING="Yes" || JACKRUNNING="No"
612 echo "Jack:" >> $FILE
613 echo " Installed - Yes ($JACKINST)" >> $FILE
614 echo " Running - $JACKRUNNING" >> $FILE
617 if [[ -n $JACK2INST ]];then
618 [[ $(pgrep '^(.*/)?jackdbus$') ]] && JACK2RUNNING="Yes" || JACK2RUNNING="No"
619 echo "Jack2:" >> $FILE
620 echo " Installed - Yes ($JACK2INST)" >> $FILE
621 echo " Running - $JACK2RUNNING" >> $FILE
624 if [[ -n $ROARINST ]];then
625 [[ $(pgrep '^(.*/)?roard$') ]] && ROARRUNNING="Yes" || ROARRUNNING="No"
626 echo "RoarAudio:" >> $FILE
627 echo " Installed - Yes ($ROARINST)" >> $FILE
628 echo " Running - $ROARRUNNING" >> $FILE
631 if [[ -z "$PAINST" && -z "$ESDINST" && -z "$ARTSINST" && -z "$JACKINST" && -z "$ROARINST" ]];then
632 echo "No sound servers found." >> $FILE
636 echo "!!Soundcards recognised by ALSA" >> $FILE
637 echo "!!-----------------------------" >> $FILE
639 cat $TEMPDIR/alsacards.tmp >> $FILE
643 if [[ ! -z "$LSPCI" ]]; then
644 echo "!!PCI Soundcards installed in the system" >> $FILE
645 echo "!!--------------------------------------" >> $FILE
647 cat $TEMPDIR/lspci.tmp >> $FILE
652 if [ "$SNDOPTIONS" ]; then
653 echo "!!Modprobe options (Sound related)" >> $FILE
654 echo "!!--------------------------------" >> $FILE
656 modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> $FILE
661 if [ -d "$SYSFS" ]; then
662 echo "!!Loaded sound module options" >> $FILE
663 echo "!!---------------------------" >> $FILE
665 for mod in $(cat /proc/asound/modules | awk '{ print $2 }'); do
666 echo "!!Module: $mod" >> $FILE
667 for params in $(echo $SYSFS/module/$mod/parameters/*); do
670 echo "$params : $value" | sed 's:.*/::'
675 echo "!!Sysfs card info" >> $FILE
676 echo "!!---------------" >> $FILE
678 for cdir in $(echo $SYSFS/class/sound/card*); do
679 echo "!!Card: $cdir" >> $FILE
680 driver=$(readlink -f "$cdir/device/driver")
681 echo "Driver: $driver" >> $FILE
682 echo "Tree:" >> $FILE
683 tree --noreport $cdir -L 2 | sed -e 's/^/\t/g' >> $FILE
687 if [ -d $SYSFS/class/sound/ctl-led ]; then
688 echo "!!Sysfs ctl-led info" >> $FILE
689 echo "!!---------------" >> $FILE
691 for path in $(echo $SYSFS/class/sound/ctl-led/[ms][ip]*/card*); do
692 echo "!!CTL-LED: $path" >> $FILE
693 if [ -r "$path/list" ]; then
694 list=$(cat "$path/list")
695 echo "List: $list" >> $FILE
697 #echo "Tree:" >> $FILE
698 #tree --noreport $path -L 2 | sed -e 's/^/\t/g' >> $FILE
704 if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then
705 echo "!!HDA-Intel Codec information" >> $FILE
706 echo "!!---------------------------" >> $FILE
707 echo "--startcollapse--" >> $FILE
709 cat $TEMPDIR/alsa-hda-intel.tmp >> $FILE
710 echo "--endcollapse--" >> $FILE
715 if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then
716 echo "!!AC97 Codec information" >> $FILE
717 echo "!!----------------------" >> $FILE
718 echo "--startcollapse--" >> $FILE
720 cat $TEMPDIR/alsa-ac97.tmp >> $FILE
722 cat $TEMPDIR/alsa-ac97-regs.tmp >> $FILE
723 echo "--endcollapse--" >> $FILE
728 if [ -s "$TEMPDIR/lsusb.tmp" ]; then
729 echo "!!USB Descriptors" >> $FILE
730 echo "!!---------------" >> $FILE
731 echo "--startcollapse--" >> $FILE
732 cat $TEMPDIR/lsusb.tmp >> $FILE
733 echo "--endcollapse--" >> $FILE
738 if [ -s "$TEMPDIR/alsa-usbstream.tmp" ]; then
739 echo "!!USB Stream information" >> $FILE
740 echo "!!----------------------" >> $FILE
741 echo "--startcollapse--" >> $FILE
743 cat $TEMPDIR/alsa-usbstream.tmp >> $FILE
744 echo "--endcollapse--" >> $FILE
749 if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then
750 echo "!!USB Mixer information" >> $FILE
751 echo "!!---------------------" >> $FILE
752 echo "--startcollapse--" >> $FILE
754 cat $TEMPDIR/alsa-usbmixer.tmp >> $FILE
755 echo "--endcollapse--" >> $FILE
760 #If no command line options are specified, then run as though --with-all was specified
767 #loop through command line arguments, until none are left.
791 echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
828 if [ -z "$WITHALL" ]; then
836 echo "Written/Tested by the following users of #alsa on irc.freenode.net:"
838 echo " wishie - Script author and developer / Testing"
839 echo " crimsun - Various script ideas / Testing"
840 echo " gnubien - Various script ideas / Testing"
841 echo " GrueMaster - HDA Intel specific items / Testing"
842 echo " olegfink - Script update function"
843 echo " TheMuso - display to stdout functionality"
847 echo "alsa-info.sh version $SCRIPT_VERSION"
849 echo "Available options:"
850 echo " --with-aplay (includes the output of aplay -l)"
851 echo " --with-amixer (includes the output of amixer)"
852 echo " --with-alsactl (includes the output of alsactl)"
853 echo " --with-configs (includes the output of ~/.asoundrc and"
854 echo " /etc/asound.conf if they exist)"
855 echo " --with-devices (shows the device nodes in /dev/snd/)"
856 echo " --with-dmesg (shows the ALSA/HDA kernel messages)"
857 echo " --with-packages (includes known packages installed)"
859 echo " --output FILE (specify the file to output for no-upload mode)"
860 echo " --update (check server for script updates)"
861 echo " --upload (upload contents to remote server)"
862 echo " --no-upload (do not upload contents to remote server)"
863 echo " --pastebin (use 'https://pastebin.ca') as remote server"
864 echo " instead www.alsa-project.org"
865 echo " --stdout (print alsa information to standard output"
866 echo " instead of a file)"
867 echo " --about (show some information about the script)"
868 echo " --debug (will run the script as normal, but will not"
869 echo " delete ${FILE})"
877 if [ "$PROCEED" = no ]; then
881 if [ -z "$WITHALL" ]; then
885 # Check if wget is installed, and supports --post-file.
886 if ! wget --help 2>/dev/null | grep -q post-file; then
887 # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually.
888 if [ "$UPLOAD" != yes ]; then
890 elif [ -n "$DIALOG" ]; then
891 if [ -z "$PASTEBIN" ]; then
892 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
894 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
897 if [ -z "$PASTEBIN" ]; then
899 echo "Could not automatically upload output to 'https://www.alsa-project.org'"
900 echo "Possible reasons are:"
901 echo " 1. Couldn't find 'wget' in your PATH"
902 echo " 2. Your version of wget is less than 1.8.2"
904 echo "Please manually upload $NFILE to 'https://www.alsa-project.org/cardinfo-db' and submit your post."
908 echo "Could not automatically upload output to 'https://www.pastebin.ca'"
909 echo "Possible reasons are:"
910 echo " 1. Couldn't find 'wget' in your PATH"
911 echo " 2. Your version of wget is less than 1.8.2"
913 echo "Please manually upload $NFILE to 'https://www.pastebin.ca/upload.php' and submit your post."
920 if [ "$UPLOAD" = ask ]; then
921 if [ -n "$DIALOG" ]; then
922 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
923 DIALOG_EXIT_CODE="$?"
924 if [ "$DIALOG_EXIT_CODE" != 0 ]; then
930 echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : "
932 if [ "$CONFIRM" != y ]; then
941 if [ "$UPLOAD" = no ]; then
943 mv -f "$FILE" "$NFILE" || exit 1
946 if [[ -n "$DIALOG" ]]
948 dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
951 echo "Your ALSA information is in $NFILE"
959 if [[ -n "$DIALOG" ]]
961 dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70
963 echo -n "Uploading information to $WWWSERVICE ..."
966 if [[ -z "$PASTEBIN" ]]; then
967 wget -O - --tries=5 --timeout=60 --post-file="$FILE" 'https://www.alsa-project.org/cardinfo-db/' &> "$TEMPDIR/wget.tmp"
969 wget -O - --tries=5 --timeout=60 --post-file="$FILE" 'https://pastebin.ca/quiet-paste.php?api='"${PASTEBINKEY}"'&encrypt=t&encryptpw=blahblah' &> "$TEMPDIR/wget.tmp"
972 if [ "$?" -ne 0 ]; then
973 mv -f "$FILE" "$NFILE" || exit 1
976 if [ -n "$DIALOG" ]; then
977 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
980 echo "An error occurred while contacting $WWWSERVICE."
981 echo "Your information was NOT automatically uploaded."
983 echo "Your ALSA information is in $NFILE"
990 if [ -n "$DIALOG" ]; then
992 dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
993 DIALOG_EXIT_CODE="$?"
994 if [ "$DIALOG_EXIT_CODE" = 0 ]; then
995 grep -v alsa-info.txt "$FILE" > "$TEMPDIR/uploaded.txt"
996 dialog --backtitle "$BGTITLE" --textbox "$TEMPDIR/uploaded.txt" 0 0
1009 if [ -z "$PASTEBIN" ]; then
1010 FINAL_URL="$(grep 'SUCCESS:' "$TEMPDIR/wget.tmp" | cut -d ' ' -f 2)"
1012 FINAL_URL="$(grep 'SUCCESS:' "$TEMPDIR/wget.tmp" | sed -n 's/.*\:\([0-9]\+\).*/https:\/\/pastebin.ca\/\1/p')"
1015 # See if tput is available, and use it if it is.
1016 if [ -x "$TPUT" ]; then
1017 FINAL_URL="$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0)"
1020 # Output the URL of the uploaded file.
1021 echo "Your ALSA information is located at $FINAL_URL"
1022 echo "Please inform the person helping you."