branches, one, buggy version, this won't work in some cases

This commit is contained in:
inxi-svn 2014-07-23 23:10:14 +00:00
parent 1d937e93a6
commit db39163d64

62
inxi
View file

@ -3,7 +3,7 @@
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.1.28 #### Version: 2.1.28
#### Date: 2014-07-22 #### Date: 2014-07-22
#### Patch Number: 02-b1 #### Patch Number: 03-b1
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -6421,6 +6421,7 @@ get_network_advanced_data()
do do
IFS="," IFS=","
a_network_adv_working=( ${A_NETWORK_DATA[i]} ) a_network_adv_working=( ${A_NETWORK_DATA[i]} )
IFS="$ORIGINAL_IFS"
# reset these every go round # reset these every go round
driver_test='' driver_test=''
if_id='' if_id=''
@ -6430,6 +6431,7 @@ get_network_advanced_data()
oper_state='' oper_state=''
usb_data='' usb_data=''
chip_id='' chip_id=''
array_counter=0
if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then 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 # 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 # 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 fi
log_function_data "POST: working_path: $working_path\nif_data: $if_data - if_id: $if_id" 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 ## 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 [[ -n $if_data ]];then
#if_data=$(echo $if_data)
for if_item in $if_data for if_item in $if_data
do do
# strip out trailing spaces # strip out trailing spaces
@ -6531,6 +6538,7 @@ get_network_advanced_data()
working_path=$working_path/net/$if_item working_path=$working_path/net/$if_item
if_id=$if_item if_id=$if_item
fi fi
echo "$if_data ii: $if_item $array_counter"
speed='' speed=''
duplex='' duplex=''
mac_id='' mac_id=''
@ -6550,16 +6558,66 @@ get_network_advanced_data()
if [[ -n ${a_network_adv_working[10]} ]];then if [[ -n ${a_network_adv_working[10]} ]];then
chip_id=${a_network_adv_working[10]} chip_id=${a_network_adv_working[10]}
fi fi
# echo $if_item $array_counter
# now we create one array index per id found, note that one pcibusid device can have > 1 id # 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_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++)) ((array_counter++))
if [[ $array_counter -gt 3 ]];then
echo 'endless loop bug hit, exiting'
#exit
fi
done done
fi fi
IFS="$ORIGINAL_IFS"
done done
a_temp=${A_NETWORK_DATA[@]}
log_function_data "A_NETWORK_DATA (advanced): $a_temp"
eval $LOGFE 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() get_networking_usb_data()
{ {