From b79da130992ed2a304d701ff7e4a1678c2a8e185 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 14 Nov 2008 03:28:27 +0000 Subject: [PATCH] more tests, safeguards --- inxi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/inxi b/inxi index 845d7e5..06d916c 100755 --- a/inxi +++ b/inxi @@ -1936,6 +1936,7 @@ print_audio_data() # if [[ -n ${a_audio_working[2]} ]];then # port_data=" ${C1}at port${C2} ${a_audio_working[2]}" # fi + # this should only trigger if the /proc/asound/cards data is used, not lspci -nn if [[ -n ${a_audio_working[1]} && ${a_audio_working[1]} != 'alsa' ]];then alsa_driver=" ${C1}driver${C2} ${a_audio_working[1]}" fi @@ -1953,17 +1954,19 @@ print_audio_data() # if [[ ${a_audio_working[2]} == 'port' ]];then # port_data=" ${C1}at port${C2} ${a_audio_working[2]}" # fi - # we're testing for the presence of the 2nd array item here + # we're testing for the presence of the 2nd array item here, which is the driver name if [[ -n ${a_audio_working[1]} && ${a_audio_working[1]} != 'alsa' ]];then alsa_driver="${C1}driver${C2} ${a_audio_working[1]}" fi - if [[ ${a_audio_working[1]} != 'alsa' ]];then + if [[ -n ${a_audio_working[1]} && ${a_audio_working[1]} != 'alsa' ]];then audio_data="${C1}Card-$(( $i + 1 )) ${C2}${a_audio_working[0]}$alsa_driver$port_data" - else + elif [[ -n ${a_audio_working[1]} && ${a_audio_working[1]} == 'alsa' ]];then audio_data="${C1}Sound: ${C2}${a_audio_working[0]}" fi - audio_data=$( create_print_line " " "$audio_data" ) - print_screen_output "$audio_data" + if [[ -n $audio_data ]];then + audio_data=$( create_print_line " " "$audio_data" ) + print_screen_output "$audio_data" + fi done fi }