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,*release,*version})
418 read -r KERNEL_RELEASE KERNEL_MACHINE KERNEL_PROCESSOR KERNEL_OS < <(uname -rpmo)
419 read -r KERNEL_VERSION < <(uname -v)
420 if [[ "$KERNEL_VERSION" = *SMP* ]]; then KERNEL_SMP=Yes; else KERNEL_SMP=No; fi
421 ALSA_DRIVER_VERSION=$(cat /proc/asound/version | head -n1 | awk '{ print $7 }' | sed 's/\.$//')
422 get_alsa_library_version
423 ALSA_UTILS_VERSION=$(amixer -v | awk '{ print $3 }')
425 ESDINST=$(command -v esd)
426 PWINST=$(command -v pipewire)
427 PAINST=$(command -v pulseaudio)
428 ARTSINST=$(command -v artsd)
429 JACKINST=$(command -v jackd)
430 JACK2INST=$(command -v jackdbus)
431 ROARINST=$(command -v roard)
432 DMIDECODE=$(command -v dmidecode)
435 if [ -d /sys/class/dmi/id ]; then
436 # No root privileges are required when using sysfs method
437 DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)
438 DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
439 DMI_SYSTEM_PRODUCT_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null)
440 DMI_SYSTEM_FIRMWARE_VERSION=$(cat /sys/class/dmi/id/bios_version 2>/dev/null)
441 DMI_SYSTEM_SKU=$(cat /sys/class/dmi/id/product_sku 2>/dev/null)
442 DMI_BOARD_VENDOR=$(cat /sys/class/dmi/id/board_vendor 2>/dev/null)
443 DMI_BOARD_NAME=$(cat /sys/class/dmi/id/board_name 2>/dev/null)
444 elif [ -x $DMIDECODE ]; then
445 DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
446 DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
447 DMI_SYSTEM_PRODUCT_VERSION=$($DMIDECODE -s system-version 2>/dev/null)
448 DMI_SYSTEM_FIRMWARE_VERSION=$($DMIDECODE -s bios-version 2>/dev/null)
449 DMI_SYSTEM_SKU=$($DMIDECODE -s system-sku-number 2>/dev/null)
450 DMI_BOARD_VENDOR=$($DMIDECODE -s baseboard-manufacturer 2>/dev/null)
451 DMI_BOARD_NAME=$($DMIDECODE -s baseboard-product-name 2>/dev/null)
454 # Check for ACPI device status
455 if [ -d /sys/bus/acpi/devices ]; then
456 for f in /sys/bus/acpi/devices/*/status; do
457 ACPI_STATUS=$(cat $f 2>/dev/null);
458 if [[ "$ACPI_STATUS" -ne 0 ]]; then
459 echo $f $'\t' $ACPI_STATUS >>$TEMPDIR/acpidevicestatus.tmp;
464 # Check for SoundWire ACPI _adr device status
465 if [ -d /sys/bus/acpi/devices ]; then
466 for f in /sys/bus/acpi/devices/*/adr; do
467 ACPI_ADR=$(cat $f 2>/dev/null);
468 if [[ "$ACPI_ADR" -ne 0 ]]; then
470 0x??????025d*) echo "Realtek $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
471 0x??????01fa*) echo "Cirrus Logic $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
472 0x??????0102*) echo "TI $ACPI_ADR" >>$TEMPDIR/sdwstatus.tmp;;
478 awk '{ print $2 " (card " $1 ")" }' < /proc/asound/modules > $TEMPDIR/alsamodules.tmp 2> /dev/null
479 cat /proc/asound/cards > $TEMPDIR/alsacards.tmp
480 if [[ ! -z "$LSPCI" ]]; then
481 for class in 0401 0402 0403; do
482 lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p'
483 done > $TEMPDIR/lspci.tmp
486 #Check for HDA-Intel cards codec#*
487 cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null
489 #Check for AC97 cards codec
490 cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null
491 cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null
493 #Check for USB descriptors
494 if [ -x /usr/bin/lsusb ]; then
495 for f in /proc/asound/card[0-9]*/usbbus; do
496 test -f "$f" || continue
497 id=$(sed 's@/@:@' $f)
498 lsusb -v -s $id >> $TEMPDIR/lsusb.tmp 2> /dev/null
502 #Check for USB stream setup
503 cat /proc/asound/card*/stream[0-9]* > $TEMPDIR/alsa-usbstream.tmp 2> /dev/null
505 #Check for USB mixer setup
506 cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null
508 #Fetch the info, and put it in $FILE in a nice readable format.
509 if [[ -z $PASTEBIN ]]; then
510 echo "upload=true&script=true&cardinfo=" > $FILE
512 echo "name=$USER&type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content=" > $FILE
514 echo "!!################################" >> $FILE
515 echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE
516 echo "!!################################" >> $FILE
518 echo "!!Script ran on: $TSTAMP" >> $FILE
521 echo "!!Linux Distribution" >> $FILE
522 echo "!!------------------" >> $FILE
524 echo $DISTRO >> $FILE
527 echo "!!DMI Information" >> $FILE
528 echo "!!---------------" >> $FILE
530 echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE
531 echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
532 echo "Product Version: $DMI_SYSTEM_PRODUCT_VERSION" >> $FILE
533 echo "Firmware Version: $DMI_SYSTEM_FIRMWARE_VERSION" >> $FILE
534 echo "System SKU: $DMI_SYSTEM_SKU" >> $FILE
535 echo "Board Vendor: $DMI_BOARD_VENDOR" >> $FILE
536 echo "Board Name: $DMI_BOARD_NAME" >> $FILE
539 echo "!!ACPI Device Status Information" >> $FILE
540 echo "!!---------------" >> $FILE
542 cat $TEMPDIR/acpidevicestatus.tmp >> $FILE
545 echo "!!ACPI SoundWire Device Status Information" >> $FILE
546 echo "!!---------------" >> $FILE
548 cat $TEMPDIR/sdwstatus.tmp >> $FILE
551 echo "!!Kernel Information" >> $FILE
552 echo "!!------------------" >> $FILE
554 echo "Kernel release: $KERNEL_VERSION" >> $FILE
555 echo "Operating System: $KERNEL_OS" >> $FILE
556 echo "Architecture: $KERNEL_MACHINE" >> $FILE
557 echo "Processor: $KERNEL_PROCESSOR" >> $FILE
558 echo "SMP Enabled: $KERNEL_SMP" >> $FILE
561 echo "!!ALSA Version" >> $FILE
562 echo "!!------------" >> $FILE
564 echo "Driver version: $ALSA_DRIVER_VERSION" >> $FILE
565 echo "Library version: $ALSA_LIB_VERSION" >> $FILE
566 echo "Utilities version: $ALSA_UTILS_VERSION" >> $FILE
569 echo "!!Loaded ALSA modules" >> $FILE
570 echo "!!-------------------" >> $FILE
572 cat $TEMPDIR/alsamodules.tmp >> $FILE
575 echo "!!Sound Servers on this system" >> $FILE
576 echo "!!----------------------------" >> $FILE
578 if [[ -n $PWINST ]];then
579 [[ $(pgrep '^(.*/)?pipewire$') ]] && PWRUNNING="Yes" || PWRUNNING="No"
580 echo "PipeWire:" >> $FILE
581 echo " Installed - Yes ($PWINST)" >> $FILE
582 echo " Running - $PWRUNNING" >> $FILE
585 if [[ -n $PAINST ]];then
586 [[ $(pgrep '^(.*/)?pulseaudio$') ]] && PARUNNING="Yes" || PARUNNING="No"
587 echo "Pulseaudio:" >> $FILE
588 echo " Installed - Yes ($PAINST)" >> $FILE
589 echo " Running - $PARUNNING" >> $FILE
592 if [[ -n $ESDINST ]];then
593 [[ $(pgrep '^(.*/)?esd$') ]] && ESDRUNNING="Yes" || ESDRUNNING="No"
594 echo "ESound Daemon:" >> $FILE
595 echo " Installed - Yes ($ESDINST)" >> $FILE
596 echo " Running - $ESDRUNNING" >> $FILE
599 if [[ -n $ARTSINST ]];then
600 [[ $(pgrep '^(.*/)?artsd$') ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No"
601 echo "aRts:" >> $FILE
602 echo " Installed - Yes ($ARTSINST)" >> $FILE
603 echo " Running - $ARTSRUNNING" >> $FILE
606 if [[ -n $JACKINST ]];then
607 [[ $(pgrep '^(.*/)?jackd$') ]] && JACKRUNNING="Yes" || JACKRUNNING="No"
608 echo "Jack:" >> $FILE
609 echo " Installed - Yes ($JACKINST)" >> $FILE
610 echo " Running - $JACKRUNNING" >> $FILE
613 if [[ -n $JACK2INST ]];then
614 [[ $(pgrep '^(.*/)?jackdbus$') ]] && JACK2RUNNING="Yes" || JACK2RUNNING="No"
615 echo "Jack2:" >> $FILE
616 echo " Installed - Yes ($JACK2INST)" >> $FILE
617 echo " Running - $JACK2RUNNING" >> $FILE
620 if [[ -n $ROARINST ]];then
621 [[ $(pgrep '^(.*/)?roard$') ]] && ROARRUNNING="Yes" || ROARRUNNING="No"
622 echo "RoarAudio:" >> $FILE
623 echo " Installed - Yes ($ROARINST)" >> $FILE
624 echo " Running - $ROARRUNNING" >> $FILE
627 if [[ -z "$PAINST" && -z "$ESDINST" && -z "$ARTSINST" && -z "$JACKINST" && -z "$ROARINST" ]];then
628 echo "No sound servers found." >> $FILE
632 echo "!!Soundcards recognised by ALSA" >> $FILE
633 echo "!!-----------------------------" >> $FILE
635 cat $TEMPDIR/alsacards.tmp >> $FILE
639 if [[ ! -z "$LSPCI" ]]; then
640 echo "!!PCI Soundcards installed in the system" >> $FILE
641 echo "!!--------------------------------------" >> $FILE
643 cat $TEMPDIR/lspci.tmp >> $FILE
648 if [ "$SNDOPTIONS" ]; then
649 echo "!!Modprobe options (Sound related)" >> $FILE
650 echo "!!--------------------------------" >> $FILE
652 modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> $FILE
657 if [ -d "$SYSFS" ]; then
658 echo "!!Loaded sound module options" >> $FILE
659 echo "!!---------------------------" >> $FILE
661 for mod in $(cat /proc/asound/modules | awk '{ print $2 }'); do
662 echo "!!Module: $mod" >> $FILE
663 for params in $(echo $SYSFS/module/$mod/parameters/*); do
666 echo "$params : $value" | sed 's:.*/::'
671 echo "!!Sysfs card info" >> $FILE
672 echo "!!---------------" >> $FILE
674 for cdir in $(echo $SYSFS/class/sound/card*); do
675 echo "!!Card: $cdir" >> $FILE
676 driver=$(readlink -f "$cdir/device/driver")
677 echo "Driver: $driver" >> $FILE
678 echo "Tree:" >> $FILE
679 tree --noreport $cdir -L 2 | sed -e 's/^/\t/g' >> $FILE
683 if [ -d $SYSFS/class/sound/ctl-led ]; then
684 echo "!!Sysfs ctl-led info" >> $FILE
685 echo "!!---------------" >> $FILE
687 for path in $(echo $SYSFS/class/sound/ctl-led/[ms][ip]*/card*); do
688 echo "!!CTL-LED: $path" >> $FILE
689 if [ -r "$path/list" ]; then
690 list=$(cat "$path/list")
691 echo "List: $list" >> $FILE
693 #echo "Tree:" >> $FILE
694 #tree --noreport $path -L 2 | sed -e 's/^/\t/g' >> $FILE
700 if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then
701 echo "!!HDA-Intel Codec information" >> $FILE
702 echo "!!---------------------------" >> $FILE
703 echo "--startcollapse--" >> $FILE
705 cat $TEMPDIR/alsa-hda-intel.tmp >> $FILE
706 echo "--endcollapse--" >> $FILE
711 if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then
712 echo "!!AC97 Codec information" >> $FILE
713 echo "!!----------------------" >> $FILE
714 echo "--startcollapse--" >> $FILE
716 cat $TEMPDIR/alsa-ac97.tmp >> $FILE
718 cat $TEMPDIR/alsa-ac97-regs.tmp >> $FILE
719 echo "--endcollapse--" >> $FILE
724 if [ -s "$TEMPDIR/lsusb.tmp" ]; then
725 echo "!!USB Descriptors" >> $FILE
726 echo "!!---------------" >> $FILE
727 echo "--startcollapse--" >> $FILE
728 cat $TEMPDIR/lsusb.tmp >> $FILE
729 echo "--endcollapse--" >> $FILE
734 if [ -s "$TEMPDIR/alsa-usbstream.tmp" ]; then
735 echo "!!USB Stream information" >> $FILE
736 echo "!!----------------------" >> $FILE
737 echo "--startcollapse--" >> $FILE
739 cat $TEMPDIR/alsa-usbstream.tmp >> $FILE
740 echo "--endcollapse--" >> $FILE
745 if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then
746 echo "!!USB Mixer information" >> $FILE
747 echo "!!---------------------" >> $FILE
748 echo "--startcollapse--" >> $FILE
750 cat $TEMPDIR/alsa-usbmixer.tmp >> $FILE
751 echo "--endcollapse--" >> $FILE
756 #If no command line options are specified, then run as though --with-all was specified
763 #loop through command line arguments, until none are left.
787 echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
824 if [ -z "$WITHALL" ]; then
832 echo "Written/Tested by the following users of #alsa on irc.freenode.net:"
834 echo " wishie - Script author and developer / Testing"
835 echo " crimsun - Various script ideas / Testing"
836 echo " gnubien - Various script ideas / Testing"
837 echo " GrueMaster - HDA Intel specific items / Testing"
838 echo " olegfink - Script update function"
839 echo " TheMuso - display to stdout functionality"
843 echo "alsa-info.sh version $SCRIPT_VERSION"
845 echo "Available options:"
846 echo " --with-aplay (includes the output of aplay -l)"
847 echo " --with-amixer (includes the output of amixer)"
848 echo " --with-alsactl (includes the output of alsactl)"
849 echo " --with-configs (includes the output of ~/.asoundrc and"
850 echo " /etc/asound.conf if they exist)"
851 echo " --with-devices (shows the device nodes in /dev/snd/)"
852 echo " --with-dmesg (shows the ALSA/HDA kernel messages)"
853 echo " --with-packages (includes known packages installed)"
855 echo " --output FILE (specify the file to output for no-upload mode)"
856 echo " --update (check server for script updates)"
857 echo " --upload (upload contents to remote server)"
858 echo " --no-upload (do not upload contents to remote server)"
859 echo " --pastebin (use 'https://pastebin.ca') as remote server"
860 echo " instead www.alsa-project.org"
861 echo " --stdout (print alsa information to standard output"
862 echo " instead of a file)"
863 echo " --about (show some information about the script)"
864 echo " --debug (will run the script as normal, but will not"
865 echo " delete ${FILE})"
873 if [ "$PROCEED" = no ]; then
877 if [ -z "$WITHALL" ]; then
881 # Check if wget is installed, and supports --post-file.
882 if ! wget --help 2>/dev/null | grep -q post-file; then
883 # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually.
884 if [ "$UPLOAD" != yes ]; then
886 elif [ -n "$DIALOG" ]; then
887 if [ -z "$PASTEBIN" ]; then
888 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
890 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
893 if [ -z "$PASTEBIN" ]; then
895 echo "Could not automatically upload output to 'https://www.alsa-project.org'"
896 echo "Possible reasons are:"
897 echo " 1. Couldn't find 'wget' in your PATH"
898 echo " 2. Your version of wget is less than 1.8.2"
900 echo "Please manually upload $NFILE to 'https://www.alsa-project.org/cardinfo-db' and submit your post."
904 echo "Could not automatically upload output to 'https://www.pastebin.ca'"
905 echo "Possible reasons are:"
906 echo " 1. Couldn't find 'wget' in your PATH"
907 echo " 2. Your version of wget is less than 1.8.2"
909 echo "Please manually upload $NFILE to 'https://www.pastebin.ca/upload.php' and submit your post."
916 if [ "$UPLOAD" = ask ]; then
917 if [ -n "$DIALOG" ]; then
918 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
919 DIALOG_EXIT_CODE="$?"
920 if [ "$DIALOG_EXIT_CODE" != 0 ]; then
926 echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : "
928 if [ "$CONFIRM" != y ]; then
937 if [ "$UPLOAD" = no ]; then
939 mv -f "$FILE" "$NFILE" || exit 1
942 if [[ -n "$DIALOG" ]]
944 dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
947 echo "Your ALSA information is in $NFILE"
955 if [[ -n "$DIALOG" ]]
957 dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70
959 echo -n "Uploading information to $WWWSERVICE ..."
962 if [[ -z "$PASTEBIN" ]]; then
963 wget -O - --tries=5 --timeout=60 --post-file="$FILE" 'https://www.alsa-project.org/cardinfo-db/' &> "$TEMPDIR/wget.tmp"
965 wget -O - --tries=5 --timeout=60 --post-file="$FILE" 'https://pastebin.ca/quiet-paste.php?api='"${PASTEBINKEY}"'&encrypt=t&encryptpw=blahblah' &> "$TEMPDIR/wget.tmp"
968 if [ "$?" -ne 0 ]; then
969 mv -f "$FILE" "$NFILE" || exit 1
972 if [ -n "$DIALOG" ]; then
973 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
976 echo "An error occurred while contacting $WWWSERVICE."
977 echo "Your information was NOT automatically uploaded."
979 echo "Your ALSA information is in $NFILE"
986 if [ -n "$DIALOG" ]; then
988 dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100
989 DIALOG_EXIT_CODE="$?"
990 if [ "$DIALOG_EXIT_CODE" = 0 ]; then
991 grep -v alsa-info.txt "$FILE" > "$TEMPDIR/uploaded.txt"
992 dialog --backtitle "$BGTITLE" --textbox "$TEMPDIR/uploaded.txt" 0 0
1005 if [ -z "$PASTEBIN" ]; then
1006 FINAL_URL="$(grep 'SUCCESS:' "$TEMPDIR/wget.tmp" | cut -d ' ' -f 2)"
1008 FINAL_URL="$(grep 'SUCCESS:' "$TEMPDIR/wget.tmp" | sed -n 's/.*\:\([0-9]\+\).*/https:\/\/pastebin.ca\/\1/p')"
1011 # See if tput is available, and use it if it is.
1012 if [ -x "$TPUT" ]; then
1013 FINAL_URL="$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0)"
1016 # Output the URL of the uploaded file.
1017 echo "Your ALSA information is located at $FINAL_URL"
1018 echo "Please inform the person helping you."