From db39163d644957df55ef9551aac097701f1a2873 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 23 Jul 2014 23:10:14 +0000 Subject: [PATCH] branches, one, buggy version, this won't work in some cases --- inxi | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/inxi b/inxi index 5f59ab3..7885526 100755 --- a/inxi +++ b/inxi @@ -3,7 +3,7 @@ #### Script Name: inxi #### Version: 2.1.28 #### Date: 2014-07-22 -#### Patch Number: 02-b1 +#### Patch Number: 03-b1 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -6421,6 +6421,7 @@ get_network_advanced_data() do IFS="," a_network_adv_working=( ${A_NETWORK_DATA[i]} ) + IFS="$ORIGINAL_IFS" # reset these every go round driver_test='' if_id='' @@ -6430,6 +6431,7 @@ get_network_advanced_data() oper_state='' usb_data='' chip_id='' + array_counter=0 if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then # note although this may exist technically don't use it, it's a virtual path # and causes weird cat errors when there's a missing file as well as a virtual path @@ -6522,7 +6524,12 @@ get_network_advanced_data() fi log_function_data "POST: working_path: $working_path\nif_data: $if_data - if_id: $if_id" ## note: in cases of dual ports with different ids, this loop will create extra array items +# if_data="eth0 +# ib0 +# ib1" + # if_data=$(tr '\n' ' ' <<< $if_data) if [[ -n $if_data ]];then + #if_data=$(echo $if_data) for if_item in $if_data do # strip out trailing spaces @@ -6531,6 +6538,7 @@ get_network_advanced_data() working_path=$working_path/net/$if_item if_id=$if_item fi + echo "$if_data ii: $if_item $array_counter" speed='' duplex='' mac_id='' @@ -6550,16 +6558,66 @@ get_network_advanced_data() if [[ -n ${a_network_adv_working[10]} ]];then chip_id=${a_network_adv_working[10]} fi + # echo $if_item $array_counter # now we create one array index per id found, note that one pcibusid device can have > 1 id A_NETWORK_DATA[array_counter]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id + ((array_counter++)) + if [[ $array_counter -gt 3 ]];then + echo 'endless loop bug hit, exiting' + #exit + fi done fi - IFS="$ORIGINAL_IFS" done + a_temp=${A_NETWORK_DATA[@]} + log_function_data "A_NETWORK_DATA (advanced): $a_temp" eval $LOGFE } +# array_counter=0 +# if_data="eth0 +# ib1" +# # if_data=$(tr '\n' ' ' <<< $if_data) +# if [[ -n $if_data ]];then +# #if_data=$(echo $if_data) +# for if_item in $if_data +# do +# # strip out trailing spaces +# if_item=${if_item%% } +# if [[ $b_path_made == 'false' ]];then +# working_path=$working_path/net/$if_item +# if_id=$if_item +# fi +# speed='' +# duplex='' +# mac_id='' +# oper_state='' +# if [[ -r $working_path/speed ]];then +# speed=$( cat $working_path/speed 2>/dev/null ) +# fi +# if [[ -r $working_path/duplex ]];then +# duplex=$( cat $working_path/duplex 2>/dev/null ) +# fi +# if [[ -r $working_path/address ]];then +# mac_id=$( cat $working_path/address 2>/dev/null ) +# fi +# if [[ -r $working_path/operstate ]];then +# oper_state=$( cat $working_path/operstate 2>/dev/null ) +# fi +# if [[ -n ${a_network_adv_working[10]} ]];then +# chip_id=${a_network_adv_working[10]} +# fi +# # echo $if_item $array_counter +# # now we create one array index per id found, note that one pcibusid device can have > 1 id +# A_NETWORK_DATA[array_counter]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id +# a_temp=${A_NETWORK_DATA[@]} +# echo ${a_temp[@]} +# ((array_counter++)) +# echo "$if_data" ii: $if_item $array_counter +# done +# fi +# exit get_networking_usb_data() {