From 22ca4cb17b615ce3b3ba4e17a1b1b6c5fff4e9c5 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 18 Feb 2009 06:17:45 +0000 Subject: [PATCH] (change version) added damentz usb audio patch, debugged, cleaned up, should be working, we'll see. --- inxi | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/inxi b/inxi index 086c965..6c88503 100755 --- a/inxi +++ b/inxi @@ -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 +#### 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