From 143a732b4952f622065c5b17320e1fac91ae49a6 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 14 Nov 2008 01:49:58 +0000 Subject: [PATCH] (Change Version) Fixed extra data issue on alsa output, now etch on old laptop is also showing sound card by the way. Removing (...date build...) string from alsa output if present, and removing trailing dot. --- inxi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/inxi b/inxi index 470ec34..7501d37 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.5.27 +#### version: 0.5.28 #### Date: November 13 2008 ######################################################################## #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif @@ -1018,7 +1018,12 @@ get_audio_data() if [[ -e /proc/asound/version ]];then A_AUDIO_DATA[$alsa_index]=$( gawk '{ { IGNORECASE=1 } - gsub( "Driver ","",$0 ) + # some alsa strings have the build date in (...) + # also remove trailing . + gsub( "Driver | [(].*[)]|\.$","",$0 ) + gsub(/,/, " ", $0) + gsub(/^ +| +$/, "", $0) + gsub(/ [ \t]+/, " ", $0) if ( $0 != "" ){ print $0 ",alsa" } @@ -1899,7 +1904,6 @@ print_short_data() #### LINE ITEM PRINT FUNCTIONS -# print sound card data # print sound card data print_audio_data() { @@ -1913,7 +1917,8 @@ print_audio_data() IFS="$ORIGINAL_IFS" 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 ' fi @@ -1937,7 +1942,7 @@ print_audio_data() if [[ ${a_audio_working[1]} != 'alsa' ]];then audio_data="${C1}Card-$(( $i + 1 )) ${C2}${a_audio_working[0]}$port_data" else - audio_data="${C1}Sound Driver: ${C2}${a_audio_working[0]}" + audio_data="${C1}Sound System: ${C2}${a_audio_working[0]}" fi audio_data=$( create_print_line " " "$audio_data" ) print_screen_output "$audio_data" @@ -1945,7 +1950,6 @@ print_audio_data() fi } - print_cpu_data() { local cpu_data='' i='' cpu_clock_speed='' cpu_multi_clock_data=''