Improved audio device detection with new string

This commit is contained in:
inxi-svn 2008-11-05 02:05:26 +00:00
parent 582c6eecac
commit 99509242d1

71
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.3.19 #### version: 0.3.20
#### Date: November 4 2008 #### Date: November 4 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -748,7 +748,7 @@ get_audio_data()
IFS=$'\n' IFS=$'\n'
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F': ' ' A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F': ' '
{ IGNORECASE=1 } { IGNORECASE=1 }
/multimedia audio controller/ { print $NF }' ) ) /multimedia audio controller|audio device/ { print $NF }' ) )
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
for (( i=0; i < ${#A_AUDIO_DATA[@]}; i++ )) for (( i=0; i < ${#A_AUDIO_DATA[@]}; i++ ))
do do
@ -811,15 +811,19 @@ get_cpu_data()
cpu[nr, "model"] = $NF cpu[nr, "model"] = $NF
} }
/^cpu MHz|^clock\t+:/ { /^cpu MHz|^clock\t+:/ {
if (!min) { if (!min) {
min = $NF min = $NF
} }
else { else {
if ($NF < min) { min = $NF } if ($NF < min) {
min = $NF
}
} }
if ($NF > max) { max = $NF } if ($NF > max) {
max = $NF
}
gsub(/MHZ/,"",$NF) ## clears out for cell cpu gsub(/MHZ/,"",$NF) ## clears out for cell cpu
gsub(/.000000/,".00",$NF) ## clears out for cell cpu gsub(/.000000/,".00",$NF) ## clears out for cell cpu
cpu[nr, "speed"] = $NF cpu[nr, "speed"] = $NF
@ -869,31 +873,6 @@ get_cpu_data()
fi fi
done done
done done
## not using this now, replaced by new get_core_count, but if we need this in the future
## it will be in modules/legacy, for now leaving it here
# test for multi core cpu present
# multi_cpu=$( grep -i 'dual\|triple\|quad' <<< "${A_CPU_DATA[@]}" )
# if [ -n "$multi_cpu" ];then
# NO_CPU_COUNT=1
# else
# case $(( ${#A_CPU_DATA[@]}-1 )) in
# 2)
# CPU2="Dual"
# ;;
# 3)
# CPU2="Triple"
# ;;
# 4)
# CPU2="Quad"
# ;;
# [5-9]|[1-9][0-9])
# CPU2="${#A_CPU_DATA[@]}x"
# ;;
# *)
# unset CPU2
# ;;
# esac
# fi
IFS="," IFS=","
a_cpu_working=(${A_CPU_DATA[0]}) a_cpu_working=(${A_CPU_DATA[0]})
@ -912,27 +891,37 @@ get_cpu_data()
# vmx = Intel IVT (vanderpool) virtualization extensions # vmx = Intel IVT (vanderpool) virtualization extensions
CPU_FLAGS=$( echo "$CPU_FLAGS" | awk ' CPU_FLAGS=$( echo "$CPU_FLAGS" | awk '
BEGIN { BEGIN {
RS=" " RS=" "
ssel["sse"] = 1 ssel["sse"] = 1
ssel["sse2"] = 2 ssel["sse2"] = 2
ssel["pni"] = 3 ssel["pni"] = 3
sses[1] = "sse" sses[1] = "sse"
sses[2] = "sse2" sses[2] = "sse2"
sses[3] = "sse3" sses[3] = "sse3"
} }
/^(nx|lm|svm|vmx)$/ { /^(nx|lm|svm|vmx)$/ {
if (s) { s = s " " $0 } if (s) {
else { s = $0 } s = s " " $0
}
else {
s = $0
}
} }
/^(sse2?|pni)$/ { /^(sse2?|pni)$/ {
if (ssel[$0] > sse) sse = ssel[$0] if (ssel[$0] > sse) {
sse = ssel[$0]
}
} }
END { END {
if (sse) { if (sse) {
if (s) s = sses[sse] " " s; if (s) {
else s = sses[sse] s = sses[sse] " " s
} }
print s else {
s = sses[sse]
}
}
print s
} }
' ) ' )