alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues
@ 2019-12-21  5:32 David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 01/11] alsa-info.sh: Consolidate PCI device output David Ward
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

David Ward (11):
  alsa-info.sh: Consolidate PCI device output
  alsa-info.sh: Read from /proc/modules and sort the result
  alsa-info.sh: Simplify iteration over cards when calling amixer
  alsa-info.sh: Use existing function to print ALSA configuration files
  alsa-info.sh: Exit script after writing information to stdout
  alsa-info.sh: Replace gauge with infobox for upload dialog
  alsa-info.sh: Remove progress spinner during upload without dialog
  alsa-info.sh: Condense nested commands for file upload
  alsa-info.sh: Condense nested commands for formatting upload result
  alsa-info.sh: Perform test for wget earlier
  alsa-info.sh: Warn after actual upload failure; do not ping server

 alsa-info/alsa-info.sh | 251 ++++++++++++++++++-------------------------------
 1 file changed, 90 insertions(+), 161 deletions(-)

-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 01/11] alsa-info.sh: Consolidate PCI device output
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 02/11] alsa-info.sh: Read from /proc/modules and sort the result David Ward
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Include numeric IDs and subsystem info in the PCI device output,
without placing them in a separate section.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index cf7ad89..8fc6997 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -455,7 +455,9 @@ fi
 cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp
 cat /proc/asound/cards > $TEMPDIR/alsacards.tmp
 if [[ ! -z "$LSPCI" ]]; then
-  lspci | grep -i "multi\|audio">$TEMPDIR/lspci.tmp
+	for class in 0401 0402 0403; do
+		lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p'
+	done > $TEMPDIR/lspci.tmp
 fi
 
 #Check for HDA-Intel cards codec#*
@@ -585,12 +587,6 @@ echo "" >> $FILE
 cat $TEMPDIR/lspci.tmp >> $FILE
 echo "" >> $FILE
 echo "" >> $FILE
-echo "!!Advanced information - PCI Vendor/Device/Subsystem ID's" >> $FILE
-echo "!!-------------------------------------------------------" >> $FILE
-echo "" >> $FILE
-lspci -vvn |grep -A1 040[1-3] >> $FILE
-echo "" >> $FILE
-echo "" >> $FILE
 fi
 
 if [ "$SNDOPTIONS" ]
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 02/11] alsa-info.sh: Read from /proc/modules and sort the result
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 01/11] alsa-info.sh: Consolidate PCI device output David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer David Ward
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Sorting the list of loaded modules makes it much easier to compare
two alsa-info.txt files, even if they are both from the same system
(since the order actually changes after each reboot).

lsmod just formats the contents of /proc/modules. After this script
calls lsmod, it strips everything but module names from the output.
This same result can be obtained just as easily by reading directly
from /proc/modules; then there is no need to remove the header line
printed by lsmod before sorting the output.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 8fc6997..ed1d9e2 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -35,7 +35,7 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
 PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
 
 WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)
-REQUIRES="mktemp grep pgrep whereis ping awk date uname cat dmesg amixer alsactl"
+REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl"
 
 #
 # Define some simple functions
@@ -131,11 +131,11 @@ withaplay() {
 	echo "" >> $FILE
 }
 
-withlsmod() {
+withmodules() {
 	echo "!!All Loaded Modules" >> $FILE
 	echo "!!------------------" >> $FILE
 	echo "" >> $FILE
-	lsmod | awk '{print $1}' >> $FILE
+	awk '{print $1}' < /proc/modules | sort >> $FILE
 	echo "" >> $FILE
 	echo "" >> $FILE
 }
@@ -254,7 +254,7 @@ withall() {
 	withaplay
 	withamixer
 	withalsactl
-	withlsmod
+	withmodules
 	withsysfs
 	withdmesg
 	WITHALL="no"
@@ -366,7 +366,6 @@ information about your ALSA installation and sound related hardware.
 
   dmesg
   lspci
-  lsmod
   aplay
   amixer
   alsactl
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 01/11] alsa-info.sh: Consolidate PCI device output David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 02/11] alsa-info.sh: Read from /proc/modules and sort the result David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 04/11] alsa-info.sh: Use existing function to print ALSA configuration files David Ward
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Read card names directly from individual procfs files, and pass them
to amixer using the '-c' option.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index ed1d9e2..e1067d4 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -144,12 +144,12 @@ withamixer() {
         echo "!!Amixer output" >> $FILE
         echo "!!-------------" >> $FILE
         echo "" >> $FILE
-	for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do
-		CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }')
-		echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE
+	for f in /proc/asound/card*/id; do
+		[ -f "$f" ] && read -r CARD_NAME < "$f" || continue
+		echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE
 		echo "" >>$FILE
-		amixer -c$i info >> $FILE 2>&1
-		amixer -c$i >> $FILE 2>&1
+		amixer -c "$CARD_NAME" info >> $FILE 2>&1
+		amixer -c "$CARD_NAME" >> $FILE 2>&1
 		echo "" >> $FILE
 	done
 	echo "" >> $FILE
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 04/11] alsa-info.sh: Use existing function to print ALSA configuration files
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (2 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 05/11] alsa-info.sh: Exit script after writing information to stdout David Ward
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index e1067d4..bf353de 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -710,33 +710,8 @@ if [ -n "$1" ]; then
 			WITHALL="no"
 			;;
 		--with-configs)
+			withconfigs
 			WITHALL="no"
-			if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
-			then
-				echo "!!ALSA configuration files" >> $FILE
-				echo "!!------------------------" >> $FILE
-				echo "" >> $FILE
-
-				#Check for ~/.asoundrc
-				if [[ -e $HOME/.asoundrc ]]
-				then
-					echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE
-					echo "" >> $FILE
-					cat $HOME/.asoundrc >> $FILE
-					echo "" >> $FILE
-					echo "" >> $FILE
-				fi
-
-				#Check for /etc/asound.conf
-				if [[ -e /etc/asound.conf ]]
-				then
-					echo "!!System wide config file (/etc/asound.conf)" >> $FILE
-					echo "" >> $FILE
-					cat /etc/asound.conf >> $FILE
-					echo "" >> $FILE
-					echo "" >> $FILE
-				fi
-			fi
 			;;
 		--stdout)
 			UPLOAD="no"
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 05/11] alsa-info.sh: Exit script after writing information to stdout
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (3 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 04/11] alsa-info.sh: Use existing function to print ALSA configuration files David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 06/11] alsa-info.sh: Replace gauge with infobox for upload dialog David Ward
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

The '--stdout' option is mutually exclusive with uploading the file.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index bf353de..372d7ae 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -349,9 +349,7 @@ case "$1" in
 		;;
 	--stdout)
 		DIALOG=""
-		UPLOAD="no"
 		WELCOME="no"
-		TOSTDOUT="yes"
 		;;
 esac
 done
@@ -720,6 +718,7 @@ if [ -n "$1" ]; then
 			fi
 			cat $FILE
 			rm $FILE
+			exit
 			;;
 		--about)
 			echo "Written/Tested by the following users of #alsa on irc.freenode.net:"
@@ -793,10 +792,8 @@ fi
 
 if [ "$UPLOAD" = "no" ]; then
 
-	if [ -z "$TOSTDOUT" ]; then
-		mv -f $FILE $NFILE || exit 1
-		KEEP_OUTPUT="yes"
-	fi
+	mv -f $FILE $NFILE || exit 1
+	KEEP_OUTPUT="yes"
 
 	if [[ -n $DIALOG ]]
 	then
@@ -815,11 +812,9 @@ if [ "$UPLOAD" = "no" ]; then
 			echo "Your ALSA information is in $NFILE"
 			echo ""
 		else
-			if [ -z "$TOSTDOUT" ]; then
-				echo ""
-				echo "Your ALSA information is in $NFILE"
-				echo ""
-			fi
+			echo ""
+			echo "Your ALSA information is in $NFILE"
+			echo ""
 		fi
 	fi
 
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 06/11] alsa-info.sh: Replace gauge with infobox for upload dialog
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (4 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 05/11] alsa-info.sh: Exit script after writing information to stdout David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 07/11] alsa-info.sh: Remove progress spinner during upload without dialog David Ward
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

The gauge did not actually show the upload progress; in fact, the
dialog did not even appear until after the upload was completed.

Use an infobox instead, which will be displayed while wget runs.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 372d7ae..a02864d 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -830,19 +830,11 @@ if [[ -n $DIALOG ]]
 then
 
 if [[ -z $PASTEBIN ]]; then
+	dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70
 	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
-	{ for i in 10 20 30 40 50 60 70 80 90; do
-		echo $i
-		sleep 0.2
-	done
-	echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0
 else
+	dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70
 	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
-	{ for i in 10 20 30 40 50 60 70 80 90; do
-		echo $i
-		sleep 0.2
-	done
-	echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0
 fi
 
 dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 07/11] alsa-info.sh: Remove progress spinner during upload without dialog
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (5 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 06/11] alsa-info.sh: Replace gauge with infobox for upload dialog David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 08/11] alsa-info.sh: Condense nested commands for file upload David Ward
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

The spinner did not actually provide information about the status
of the file upload, and caused other problems: it would repeatedly
spawn new pgrep processes (without a delay between them), and it
blocked the script if any wget process was running on the system.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index a02864d..9bc8c38 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -857,16 +857,7 @@ else
 	wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp &
 fi
 
-#Progess spinner for wget transfer.
-i=1
-sp="/-\|"
-echo -n ' '
-while pgrep wget &>/dev/null
-do
-	echo -en "\b${sp:i++%${#sp}:1}"
-done
-
-echo -e "\b Done!"
+echo -e " Done!"
 echo ""
 
 fi # dialog
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 08/11] alsa-info.sh: Condense nested commands for file upload
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (6 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 07/11] alsa-info.sh: Remove progress spinner during upload without dialog David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 09/11] alsa-info.sh: Condense nested commands for formatting upload result David Ward
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 9bc8c38..7560b0d 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -828,15 +828,19 @@ then
 
 if [[ -n $DIALOG ]]
 then
+	dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70
+else
+	echo -n "Uploading information to $WWWSERVICE ..."
+fi
 
 if [[ -z $PASTEBIN ]]; then
-	dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70
 	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
 else
-	dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70
 	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
 fi
 
+if [ -n "$DIALOG" ]; then
+
 dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 
 DIALOG_EXIT_CODE=$?
 if [ $DIALOG_EXIT_CODE = 0 ]; then
@@ -849,14 +853,6 @@ clear
 # no dialog
 else
 
-if [[ -z $PASTEBIN ]]; then
-	echo -n "Uploading information to www.alsa-project.org ... " 
-	wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp &
-else
-	echo -n "Uploading information to www.pastebin.ca ... " 
-	wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp &
-fi
-
 echo -e " Done!"
 echo ""
 
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 09/11] alsa-info.sh: Condense nested commands for formatting upload result
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (7 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 08/11] alsa-info.sh: Condense nested commands for file upload David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 10/11] alsa-info.sh: Perform test for wget earlier David Ward
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 7560b0d..8b4745b 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -858,19 +858,15 @@ echo ""
 
 fi # dialog
 
-# See if tput is available, and use it if it is.
-if [ -n "$TPUT" ]; then
-	if [[ -z $PASTEBIN ]]; then
-		FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0)
-	else
-		FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'; tput sgr0)
-	fi
+if [ -z "$PASTEBIN" ]; then
+	FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2)
 else
-	if [[ -z $PASTEBIN ]]; then
-		FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2)
-	else
-		FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p')
-	fi
+	FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p')
+fi
+
+# See if tput is available, and use it if it is.
+if [ -x "$TPUT" ]; then
+	FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0)
 fi
 
 # Output the URL of the uploaded file.	
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 10/11] alsa-info.sh: Perform test for wget earlier
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (8 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 09/11] alsa-info.sh: Condense nested commands for formatting upload result David Ward
@ 2019-12-21  5:32 ` David Ward
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 11/11] alsa-info.sh: Warn after actual upload failure; do not ping server David Ward
  2020-01-07 13:07 ` [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues Takashi Iwai
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

If wget is not present, do not ask about uploading the information.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 73 ++++++++++++++++++++++++--------------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 8b4745b..399d662 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -769,6 +769,41 @@ if [ -z "$WITHALL" ]; then
 	withall
 fi
 
+# 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.
+	if [ "$UPLOAD" != "yes" ]; then
+		:
+	elif [ -n "$DIALOG" ]; then
+		if [ -z "$PASTEBIN" ]; then
+			dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://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 http://www.alsa-project.org/cardinfo-db/ and submit your post." 25 100
+		else
+			dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://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 http://www.pastebin.ca/upload.php and submit your post." 25 100
+		fi
+	else
+		if [ -z "$PASTEBIN" ]; then
+			echo ""
+			echo "Could not automatically upload output to http://www.alsa-project.org"
+			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 ""
+			echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post."
+			echo ""
+		else
+			echo ""
+			echo "Could not automatically upload output to http://www.pastebin.ca"
+			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 ""
+			echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post."
+			echo ""
+		fi
+	fi
+	UPLOAD="no"
+fi
+
 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
@@ -822,10 +857,6 @@ if [ "$UPLOAD" = "no" ]; then
 
 fi # UPLOAD
 
-# Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it does not.
-if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ $(wget --help | grep post-file) ]]
-then
-
 if [[ -n $DIALOG ]]
 then
 	dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70
@@ -873,37 +904,3 @@ fi
 echo "Your ALSA information is located at $FINAL_URL"
 echo "Please inform the person helping you."
 echo ""
-
-# We couldnt find a suitable wget, so tell the user to upload manually.
-else
-	mv -f $FILE $NFILE || exit 1
-	KEEP_OUTPUT="yes"
-	if [[ -z $DIALOG ]]
-	then
-		if [[ -z $PASTEBIN ]]; then
-		echo ""
-		echo "Could not automatically upload output to http://www.alsa-project.org"
-		echo "Possible reasons are:"
-		echo "    1. Couldnt find 'wget' in your PATH"
-		echo "    2. Your version of wget is less than 1.8.2"
-		echo ""
-		echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post."
-		echo ""
-		else
-		echo ""
-		echo "Could not automatically upload output to http://www.pastebin.ca"
-		echo "Possible reasons are:"
-		echo "    1. Couldnt find 'wget' in your PATH"
-		echo "    2. Your version of wget is less than 1.8.2"
-		echo ""
-		echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post."
-		echo ""
-		fi
-	else
-		if [[ -z $PASTEBIN ]]; then
-			dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://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 http://www.alsa-project,org/cardinfo-db/ and submit your post." 25 100
-		else
-			dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://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 http://www.pastebin.ca/upload.php and submit your post." 25 100
-		fi
-	fi
-fi
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [alsa-devel] [PATCH alsa-utils 11/11] alsa-info.sh: Warn after actual upload failure; do not ping server
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (9 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 10/11] alsa-info.sh: Perform test for wget earlier David Ward
@ 2019-12-21  5:32 ` David Ward
  2020-01-07 13:07 ` [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues Takashi Iwai
  11 siblings, 0 replies; 13+ messages in thread
From: David Ward @ 2019-12-21  5:32 UTC (permalink / raw)
  To: alsa-devel; +Cc: David Ward

Check the return value of wget to determine if the upload actually
failed. If so, display the message about upload failure, then exit.

Do not ping the web server; the result does not indicate whether a
file upload will succeed or not.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
 alsa-info/alsa-info.sh | 58 ++++++++++++++++++++++----------------------------
 1 file changed, 25 insertions(+), 33 deletions(-)

diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index 399d662..7bae30a 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -35,22 +35,12 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
 PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
 
 WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null)
-REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl"
+REQUIRES="mktemp grep pgrep whereis awk date uname cat sort dmesg amixer alsactl"
 
 #
 # Define some simple functions
 #
 
-pbcheck() {
-	[[ $UPLOAD = "no" ]] && return
-
-	if [[ -z $PASTEBIN ]]; then
-		[[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
-	else
-		[[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes"
-	fi
-}
-
 update() {
 	test -z "$WGET" -o ! -x "$WGET" && return
 
@@ -650,7 +640,6 @@ fi
 #If no command line options are specified, then run as though --with-all was specified
 if [ -z "$1" ]; then
 	update
-	pbcheck	
 fi
 
 fi # proceed
@@ -662,7 +651,6 @@ if [ -n "$1" ]; then
 	case "$1" in
 		--pastebin)
 		        update
-        		pbcheck
 			;;
 		--update)
 			update
@@ -832,25 +820,11 @@ if [ "$UPLOAD" = "no" ]; then
 
 	if [[ -n $DIALOG ]]
 	then
-		if [[ -n $PBERROR ]]; then
-			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
-			dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
-		fi
+		dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60
 	else
-		echo
-
-		if [[ -n $PBERROR ]]; then
-			echo "An error occurred while contacting the $WWWSERVICE."
-			echo "Your information was NOT automatically uploaded."
-			echo ""
-			echo "Your ALSA information is in $NFILE"
-			echo ""
-		else
-			echo ""
-			echo "Your ALSA information is in $NFILE"
-			echo ""
-		fi
+		echo ""
+		echo "Your ALSA information is in $NFILE"
+		echo ""
 	fi
 
 	exit
@@ -865,9 +839,27 @@ else
 fi
 
 if [[ -z $PASTEBIN ]]; then
-	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
+	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp
 else
-	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit"
+	wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp
+fi
+
+if [ $? -ne 0 ]; then
+	mv -f $FILE $NFILE || exit 1
+	KEEP_OUTPUT="yes"
+
+	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
 fi
 
 if [ -n "$DIALOG" ]; then
-- 
1.8.3.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues
  2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
                   ` (10 preceding siblings ...)
  2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 11/11] alsa-info.sh: Warn after actual upload failure; do not ping server David Ward
@ 2020-01-07 13:07 ` Takashi Iwai
  11 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2020-01-07 13:07 UTC (permalink / raw)
  To: David Ward; +Cc: alsa-devel

On Sat, 21 Dec 2019 06:32:00 +0100,
David Ward wrote:
> 
> David Ward (11):
>   alsa-info.sh: Consolidate PCI device output
>   alsa-info.sh: Read from /proc/modules and sort the result
>   alsa-info.sh: Simplify iteration over cards when calling amixer
>   alsa-info.sh: Use existing function to print ALSA configuration files
>   alsa-info.sh: Exit script after writing information to stdout
>   alsa-info.sh: Replace gauge with infobox for upload dialog
>   alsa-info.sh: Remove progress spinner during upload without dialog
>   alsa-info.sh: Condense nested commands for file upload
>   alsa-info.sh: Condense nested commands for formatting upload result
>   alsa-info.sh: Perform test for wget earlier
>   alsa-info.sh: Warn after actual upload failure; do not ping server

Applied all patches now.  Thanks!


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-01-07 13:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-21  5:32 [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 01/11] alsa-info.sh: Consolidate PCI device output David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 02/11] alsa-info.sh: Read from /proc/modules and sort the result David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 04/11] alsa-info.sh: Use existing function to print ALSA configuration files David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 05/11] alsa-info.sh: Exit script after writing information to stdout David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 06/11] alsa-info.sh: Replace gauge with infobox for upload dialog David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 07/11] alsa-info.sh: Remove progress spinner during upload without dialog David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 08/11] alsa-info.sh: Condense nested commands for file upload David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 09/11] alsa-info.sh: Condense nested commands for formatting upload result David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 10/11] alsa-info.sh: Perform test for wget earlier David Ward
2019-12-21  5:32 ` [alsa-devel] [PATCH alsa-utils 11/11] alsa-info.sh: Warn after actual upload failure; do not ping server David Ward
2020-01-07 13:07 ` [alsa-devel] [PATCH alsa-utils 00/11] alsa-info.sh: Improve output and fix file upload issues Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).