(change version)

added damentz usb audio patch, debugged, cleaned up, should be working, we'll see.
This commit is contained in:
inxi-svn 2009-02-18 06:17:45 +00:00
parent 2cb135761f
commit 22ca4cb17b

34
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.0.2
#### Date: 14 February 2009
#### version: 1.0.3
#### Date: 17 February 2009
########################################################################
#### SPECIAL THANKS
########################################################################
@ -21,6 +21,7 @@
#### Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif
#### inxi version: Copyright (C) 2008-9 Scott Rogers & Harald Hope
#### Further fixes (listed as known): Horst Tritremmel <hjt at sidux.com>
#### Steven Barrett (aka: damentz) - usb audio patch;
####
#### Current script home page: http://techpatterns.com/forums/about1131.html
#### Script svn: http://code.google.com/p/inxi
@ -1265,6 +1266,7 @@ get_cmdline()
get_audio_data()
{
local i='' alsa_data='' alsa_driver='' device_count=''
local usb_proc_file='' array_count='' usb_id='' usb_data=''
IFS=$'\n'
# this first step handles the drivers for cases where the second step fails to find one
@ -1374,6 +1376,34 @@ get_audio_data()
}
}' $DIR_ASOUND_DEVICE ) )
fi
# alsa usb detection by damentz
# for every sound card symlink in /proc/asound - display information about it
for usb_proc_file in /proc/asound/*
do
# if lsusb exists, the file is a symlink, and contains an important usb exclusive file: continue
if [[ -n $( which lsusb ) && -L $usb_proc_file && -e $usb_proc_file/usbid ]]; then
# send error messages of lsusb to /dev/null as it will display a bunch if not a super user
# also, find the contents of usbid in lsusb and print everything after the 7th word on the corresponding line
# finally, strip out commas as they will change the driver :)
# lsusb is not contained in some users paths, hardcode it!
usb_id=$( cat $usb_proc_file/usbid )
usb_data=$( lsusb -v 2>/dev/null | grep "$usb_id" )
usb_data=$( gawk '{
gsub( /,/, " ", $0 )
for( i=7; i<NF; i++ ) {
printf( $i " " )
}
}' <<< "$usb_data" )
# this method is interesting, it shouldn't work but it does
#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
array_count=${#A_AUDIO_DATA[@]}
A_AUDIO_DATA[$array_count]="$usb_data,snd-usb-audio,,"
fi
fi
done
IFS="$ORIGINAL_IFS"
# handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes..