(Change Version)

Added alsa sound output as well if the /proc file is found
This commit is contained in:
inxi-svn 2008-11-14 00:42:13 +00:00
parent cc83b9eed4
commit 6cf526e231

22
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 0.5.25
#### version: 0.5.26
#### Date: November 13 2008
########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -983,10 +983,10 @@ set_calculated_variables()
#### -------------------------------------------------------------------
#### get data types
#### -------------------------------------------------------------------
## create array of sound cards installed on system
## create array of sound cards installed on system, and if found, use asound data as well
get_audio_data()
{
local i=''
local i='' alsa_index=0
IFS=$'\n'
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F': ' '
@ -1013,6 +1013,11 @@ get_audio_data()
if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]];then
A_AUDIO_DATA[0]='Failed to Detect Sound Card!'
fi
# now we'll add in the alsa data if the file exists
alsa_index=${#A_AUDIO_DATA[@]}
if [[ -e /proc/asound/version ]];then
A_AUDIO_DATA[$alsa_index]="$( cat /proc/asound/version ),alsa"
fi
}
## create A_CPU_CORE_DATA, currently with two values: integer core count; core string text
@ -1888,6 +1893,7 @@ print_short_data()
#### LINE ITEM PRINT FUNCTIONS
# print sound card data
# print sound card data
print_audio_data()
{
@ -1918,16 +1924,22 @@ print_audio_data()
a_audio_working=( ${A_AUDIO_DATA[i]} )
IFS="$ORIGINAL_IFS"
port_data=''
if [[ -n ${a_audio_working[1]} ]];then
port_data=" ${C1}at port${C2} ${a_audio_working[1]}"
if [[ ${a_audio_working[1]} == '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
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]}"
fi
audio_data=$( create_print_line " " "$audio_data" )
print_screen_output "$audio_data"
done
fi
}
print_cpu_data()
{
local cpu_data='' i='' cpu_clock_speed='' cpu_multi_clock_data=''