Trying to remove some extra alsa (....) data, and fix the card numbering

This commit is contained in:
inxi-svn 2008-11-14 01:39:46 +00:00
parent 662de26450
commit 3991b6efa1

13
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.5.27-b-1-t-1 #### version: 0.5.27-b-1-t-2
#### Date: November 13 2008 #### Date: November 13 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -1022,7 +1022,11 @@ get_audio_data()
if [[ -e /proc/asound/version ]];then if [[ -e /proc/asound/version ]];then
A_AUDIO_DATA[$alsa_index]=$( gawk '{ A_AUDIO_DATA[$alsa_index]=$( gawk '{
{ IGNORECASE=1 } { IGNORECASE=1 }
gsub( "Driver ","",$0 ) # some alsa strings have the build date in (...)
gsub( "Driver | [(].*[)]","",$0 )
gsub(/,/, " ", $0)
gsub(/^ +| +$/, "", $0)
gsub(/ [ \t]+/, " ", $0)
if ( $0 != "" ){ if ( $0 != "" ){
print $0 ",alsa" print $0 ",alsa"
} }
@ -1919,7 +1923,8 @@ print_audio_data()
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
if [[ -n ${A_AUDIO_DATA[@]} ]];then if [[ -n ${A_AUDIO_DATA[@]} ]];then
if [[ ${#A_AUDIO_DATA[@]} -le 1 ]];then # slightly complicated because 2nd array item could be the alsa data
if [[ ${#A_AUDIO_DATA[@]} -le 1 ]] || [[ ${#A_AUDIO_DATA[@]} -eq 2 && -n $( grep ',alsa' <<< ${A_AUDIO_DATA[@]} ) ]];then
card_one='Card ' card_one='Card '
fi fi
@ -1943,7 +1948,7 @@ print_audio_data()
if [[ ${a_audio_working[1]} != 'alsa' ]];then if [[ ${a_audio_working[1]} != 'alsa' ]];then
audio_data="${C1}Card-$(( $i + 1 )) ${C2}${a_audio_working[0]}$port_data" audio_data="${C1}Card-$(( $i + 1 )) ${C2}${a_audio_working[0]}$port_data"
else else
audio_data="${C1}Sound Driver: ${C2}${a_audio_working[0]}" audio_data="${C1}Sound System: ${C2}${a_audio_working[0]}"
fi fi
audio_data=$( create_print_line " " "$audio_data" ) audio_data=$( create_print_line " " "$audio_data" )
print_screen_output "$audio_data" print_screen_output "$audio_data"