This commit is contained in:
inxi-svn 2009-02-18 06:08:45 +00:00
parent d41372da60
commit 57073c23a1

13
inxi
View file

@ -1264,7 +1264,8 @@ get_cmdline()
## create array of sound cards installed on system, and if found, use asound data as well ## create array of sound cards installed on system, and if found, use asound data as well
get_audio_data() get_audio_data()
{ {
local i='' alsa_data='' alsa_driver='' device_count='' usb_proc_file='' local i='' alsa_data='' alsa_driver='' device_count=''
local usb_proc_file='' array_count='' usb_id='' usb_data=''
IFS=$'\n' IFS=$'\n'
# this first step handles the drivers for cases where the second step fails to find one # this first step handles the drivers for cases where the second step fails to find one
@ -1375,9 +1376,7 @@ get_audio_data()
}' $DIR_ASOUND_DEVICE ) ) }' $DIR_ASOUND_DEVICE ) )
fi fi
# alsa usb detection by damentz
# alsa usb
# for every sound card symlink in /proc/asound - display information about it # for every sound card symlink in /proc/asound - display information about it
for usb_proc_file in /proc/asound/* for usb_proc_file in /proc/asound/*
do do
@ -1396,10 +1395,9 @@ get_audio_data()
} }
#printf "\n" #printf "\n"
}' <<< "$usb_data" ) }' <<< "$usb_data" )
# usb_data=$( lsusb -v 2>/dev/null |\ # this method is interesting, it shouldn't work but it does
# grep $( cat $usb_proc_file/usbid ) |\
# gawk '{ gsub(/,/, " ", $0);for( i=7; i<NF; i++) { printf($i " ") } printf "\n" }' )
#A_AUDIO_DATA=( "${A_AUDIO_DATA[@]}" "$usb_data,snd-usb-audio,," ) #A_AUDIO_DATA=( "${A_AUDIO_DATA[@]}" "$usb_data,snd-usb-audio,," )
# but until we learn why the above worked, I'm using this one, which is safer
if [[ -n "$usb_data" ]];then if [[ -n "$usb_data" ]];then
array_count=${#A_AUDIO_DATA[@]} array_count=${#A_AUDIO_DATA[@]}
A_AUDIO_DATA[$array_count]="$usb_data,snd-usb-audio,," A_AUDIO_DATA[$array_count]="$usb_data,snd-usb-audio,,"
@ -1407,6 +1405,7 @@ get_audio_data()
fi fi
done done
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
# handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes.. # handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes..
if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]];then if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]];then
A_AUDIO_DATA[0]='Failed to Detect Sound Card!' A_AUDIO_DATA[0]='Failed to Detect Sound Card!'