From 194ee57cbc8270a91efe2854394a7204fb931eb5 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 19 Oct 2012 05:10:56 +0000 Subject: [PATCH] first test at adding vendor:product id for -xx --- inxi | 64 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/inxi b/inxi index b944c51..bc7929f 100755 --- a/inxi +++ b/inxi @@ -3,7 +3,7 @@ #### Script Name: inxi #### version: 1.8.19 #### Date: October 18 2012 -#### Patch Number: 01 +#### Patch Number: 02 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -2762,7 +2762,7 @@ get_audio_data() IFS=$'\n' # this first step handles the drivers for cases where the second step fails to find one - device_count=$( echo "$Lspci_Data" | grep -iEc '(multimedia audio controller|audio device)' ) + device_count=$( echo "$Lspci_v_Data" | grep -iEc '(multimedia audio controller|audio device)' ) if [[ $device_count -eq 1 ]] && [[ $B_ASOUND_DEVICE_FILE == 'true' ]];then alsa_driver=$( gawk -F ']: ' ' BEGIN { @@ -2785,7 +2785,7 @@ get_audio_data() alsa_driver=$( echo $alsa_driver ) # now we'll build the main audio data, card name, driver, and port. If no driver is found, # and if the first method above is not null, and one card is found, it will use that instead. - A_AUDIO_DATA=( $( echo "$Lspci_Data" | gawk -F ': ' -v alsaDriver="$alsa_driver" ' + A_AUDIO_DATA=( $( echo "$Lspci_v_Data" | gawk -F ': ' -v alsaDriver="$alsa_driver" ' BEGIN { IGNORECASE=1 } @@ -2922,7 +2922,7 @@ get_audio_usb_data() } if ( $2 != "" ){ sub(/:/,"", $4) - print string ",USB Audio,,," $2 "-" $4 + print string ",USB Audio,,," $2 "-" $4 "," $6 } }' <<< "$usb_data" ) fi @@ -3976,7 +3976,7 @@ get_graphics_card_data() gsub(/ [ \t]+/, " ", $NF) busId=gensub(/^([0-9a-f:\.]+) (.+)$/,"\\1","",$1) print $NF "," busId - }' <<< "$Lspci_Data" ) ) + }' <<< "$Lspci_v_Data" ) ) IFS="$ORIGINAL_IFS" # for (( i=0; i < ${#A_GFX_CARD_DATA[@]}; i++ )) # do @@ -3984,7 +3984,7 @@ get_graphics_card_data() # done # GFXMEM is UNUSED at the moment, because it shows AGP aperture size, which is not necessarily equal to GFX memory.. - # GFXMEM="size=[$(echo "$Lspci_Data" | gawk '/VGA/{while (!/^$/) {getline;if (/size=[0-9][0-9]*M/) {size2=gensub(/.*\[size=([0-9]+)M\].*/,"\\1","g",$0);if (size 1 instance of the same chipset @@ -4768,6 +4788,7 @@ get_networking_data() usePorts="" useModules="" usePciBusId="" + if ( eth[i] > 1 ) { a[j] = eth[i] "x " i } @@ -4970,7 +4991,7 @@ get_networking_usb_data() } if ( $2 != "" ){ sub(/:/, "", $4 ) - print string ",,,,usb-" $2 "-" $4 + print string ",,,,usb-" $2 "-" $4 "," $6 } }' <<< "$lsusb_data" ) ) @@ -6635,13 +6656,16 @@ print_it_out() { eval $LOGFS # note that print_it_out passes local variable values on to its children, - # and in some cases, their children, with Lspci_Data - local Lspci_Data='' # only for verbose + # and in some cases, their children, with Lspci_v_Data + local Lspci_v_Data='' Lspci_n_Data='' # only for verbose if [[ $B_SHOW_SHORT_OUTPUT == 'true' ]];then print_short_data else - Lspci_Data="$( get_lspci_data )" + Lspci_v_Data="$( get_lspci_data 'v' )" + if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + Lspci_n_Data="$( get_lspci_data 'n' )" + fi if [[ $B_SHOW_SYSTEM == 'true' ]];then print_system_data fi @@ -7543,7 +7567,7 @@ print_networking_data() eval $LOGFS local i='' card_id='' network_data='' a_network_working='' port_data='' driver_data='' local card_string='' port_plural='' module_version='' pci_bus_id='' bus_usb_text='' - local bus_usb_id='' line_starter='Network:' card_string='' card_data='' + local bus_usb_id='' line_starter='Network:' card_string='' card_data='' vendor_product='' # set A_NETWORK_DATA get_networking_data @@ -7565,6 +7589,7 @@ print_networking_data() pci_bus_id='' port_data='' port_plural='' + vendor_product='' if [[ ${#A_NETWORK_DATA[@]} -gt 1 ]];then card_id="-$(( $i + 1 ))" @@ -7585,14 +7610,23 @@ print_networking_data() if [[ -z $( grep '^usb-' <<< ${a_network_working[4]} ) ]];then bus_usb_text='bus-ID' bus_usb_id=${a_network_working[4]} + if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + vendor_product=$( get_lspci_vendor_product "${a_network_working[4]}" ) + fi else bus_usb_text='usb-ID' bus_usb_id=$( cut -d '-' -f '2-4' <<< ${a_network_working[4]} ) + if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + vendor_product=${a_network_working[5]} + fi fi pci_bus_id="${C1}$bus_usb_text$SEP3${C2} $bus_usb_id" + if [[ -n $vendor_product ]];then + vendor_product=" ${C1}chip-ID$SEP3${C2} $vendor_product" + fi fi card_string="${C1}Card$card_id:${C2} ${a_network_working[0]} " - card_data="$driver_data$port_data$pci_bus_id" + card_data="$driver_data$port_data$pci_bus_id$vendor_product" if [[ $( calculate_line_length "$card_string$card_data" ) -gt $LINE_MAX ]];then network_data=$( create_print_line "$line_starter" "$card_string" ) line_starter=' '