diff --git a/inxi b/inxi index 58fbd0d..0c27608 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.2-b1-t1 -#### Date: 11 February 2009 +#### version: 1.0.3-b1-t1 +#### Date: 17 February 2009 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -1264,7 +1264,8 @@ get_cmdline() ## create array of sound cards installed on system, and if found, use asound data as well get_audio_data() { - local i='' alsa_data='' alsa_driver='' device_count='' + local i='' alsa_data='' alsa_driver='' device_count='' usb_proc_file='' + local usb_data='' usb_data_id='' IFS=$'\n' # this first step handles the drivers for cases where the second step fails to find one @@ -1376,6 +1377,32 @@ get_audio_data() fi IFS="$ORIGINAL_IFS" + + # alsa usb + # 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_data_id=$( cat $usb_proc_file/usbid ) + usb_data=$( lsusb -v 2>/dev/null | grep <<< $usb_data_id ) + usb_data=$( sed 's/,/ /' <<< $usb_data ) # replace with gawk but use for now + usb_data=$( gawk '{ + for( i=7; i < NF; i++ ) { + printf($i " ") + } + printf "\n" + }' <<< $usb_data ) + + if [[ -n "$usb_data" ]];then + A_AUDIO_DATA=( "${A_AUDIO_DATA[@]}" "$usb_data,snd-usb-audio" ) + fi + fi + done + # handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes.. if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]];then A_AUDIO_DATA[0]='Failed to Detect Sound Card!'