From 949019f36eabfd8f288231698025f1d28ab78e1d Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 30 Apr 2011 23:10:06 +0000 Subject: [PATCH] synched audio output to use usb id as well if -x runs --- inxi | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/inxi b/inxi index 15c8e00..67a84f8 100755 --- a/inxi +++ b/inxi @@ -2147,12 +2147,19 @@ get_audio_data() usb_data=$( gawk ' BEGIN { IGNORECASE=1 + string="" + separator="" } { gsub( /,/, " ", $0 ) gsub(/'"$BAN_LIST_NORMAL"'/, "", $0) - for( i=7; i <= NF; i++ ) { - printf( $i " " ) + gsub(/ [ \t]+/, " ", $0) + for ( i=7; i<= NF; i++ ) { + string = string separator $i + separator = " " + } + if ( $6 != "" ){ + print string ",snd-usb-audio,,," $6 } }' <<< "$usb_data" ) # this method is interesting, it shouldn't work but it does @@ -2160,7 +2167,7 @@ get_audio_data() # but until we learn why the above worked, I'm using this one, which is safer if [[ -n $usb_data ]];then array_count=${#A_AUDIO_DATA[@]} - A_AUDIO_DATA[$array_count]="$usb_data,snd-usb-audio,," + A_AUDIO_DATA[$array_count]="$usb_data" fi fi done @@ -3360,6 +3367,7 @@ get_networking_data() { gsub( /,/, " ", $0 ) gsub(/'"$BAN_LIST_NORMAL"'/, "", $0) + gsub(/ [ \t]+/, " ", $0) gsub(/realtek semiconductor/, "Realtek", $0) gsub(/davicom semiconductor/, "Davicom", $0) for ( i=7; i<= NF; i++ ) { @@ -4777,6 +4785,7 @@ print_audio_data() eval $LOGFS local i='' card_one='Card-1' audio_data='' a_audio_data='' port_data='' pci_bus_id='' local a_audio_working='' alsa_driver='' alsa_data='' port_plural='' module_version='' + local bus_usb_text='' bus_usb_id='' # set A_AUDIO_DATA and get alsa data get_audio_data alsa_data=$( get_audio_alsa_data ) @@ -4811,7 +4820,13 @@ print_audio_data() port_data=" ${C1}port$port_plural${C2} ${a_audio_working[2]}" fi if [[ -n ${a_audio_working[4]} && $B_EXTRA_DATA == 'true' ]];then - pci_bus_id=" ${C1}busID:${C2} ${a_audio_working[4]}" + if [[ ${a_audio_working[1]} != 'snd-usb-audio' ]];then + bus_usb_text='busID' + else + bus_usb_text='USB-ID' + fi + bus_usb_id=${a_audio_working[4]} + pci_bus_id=" ${C1}$bus_usb_text:${C2} $bus_usb_id" fi audio_data="${C1}$card_one${C2} ${a_audio_working[0]}$alsa_driver$port_data$pci_bus_id" audio_data=$( create_print_line "Audio:" "$audio_data" ) @@ -4827,6 +4842,8 @@ print_audio_data() port_plural='' module_version='' pci_bus_id='' + bus_usb_text='' + bus_usb_id='' if [[ -n ${a_audio_working[3]} && $B_EXTRA_DATA == 'true' ]];then module_version=$( print_module_version "${a_audio_working[3]}" 'audio' ) elif [[ -n ${a_audio_working[1]} && $B_EXTRA_DATA == 'true' ]];then @@ -4843,7 +4860,13 @@ print_audio_data() port_data=" ${C1}port$port_plural${C2} ${a_audio_working[2]}" fi if [[ -n ${a_audio_working[4]} && $B_EXTRA_DATA == 'true' ]];then - pci_bus_id=" ${C1}busID:${C2} ${a_audio_working[4]}" + if [[ ${a_audio_working[1]} != 'snd-usb-audio' ]];then + bus_usb_text='busID' + else + bus_usb_text='USB-ID' + fi + bus_usb_id=${a_audio_working[4]} + pci_bus_id=" ${C1}$bus_usb_text:${C2} $bus_usb_id" fi if [[ -n ${a_audio_working[0]} ]];then audio_data="${C1}Card-$(( $i + 1 ))${C2} ${a_audio_working[0]}$alsa_driver$port_data$pci_bus_id"