branch one, advanced networking, small changes and cleanups

This commit is contained in:
inxi-svn 2014-07-22 19:36:48 +00:00
parent 8463de14ab
commit 1d937e93a6

26
inxi
View file

@ -6413,7 +6413,7 @@ get_networking_data()
get_network_advanced_data() get_network_advanced_data()
{ {
eval $LOGFS eval $LOGFS
local a_network_adv_working='' if_path='' working_path='' working_uevent_path='' dir_path='' local a_network_adv_working='' if_data='' working_path='' working_uevent_path='' dir_path=''
local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' b_path_made='true' local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' b_path_made='true'
local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' array_counter=0 local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' array_counter=0
@ -6507,23 +6507,23 @@ get_network_advanced_data()
if [[ -e $working_path/net ]];then if [[ -e $working_path/net ]];then
# in cases like infiniband dual port devices, there can be two ids, like ib0 ib1, # in cases like infiniband dual port devices, there can be two ids, like ib0 ib1,
# with line break in output # with line break in output
if_path=$( ls $working_path/net 2>/dev/null ) if_data=$( ls $working_path/net 2>/dev/null )
b_path_made='false' b_path_made='false'
# this is the normal usb detection if the first one didn't work # this is the normal usb detection if the first one didn't work
elif [[ -n $usb_data && -e $working_uevent_path/net ]];then elif [[ -n $usb_data && -e $working_uevent_path/net ]];then
if_path=$( ls $working_uevent_path/net 2>/dev/null ) if_data=$( ls $working_uevent_path/net 2>/dev/null )
if_id=$if_path if_id=$if_data
working_path=$working_uevent_path/net/$if_path working_path=$working_uevent_path/net/$if_data
# 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0 # 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0
else else
if_path=$( ls $working_path 2>/dev/null | grep 'net:' ) if_data=$( ls $working_path 2>/dev/null | grep 'net:' )
if_id=$( cut -d ':' -f 2 <<< "$if_path" ) if_id=$( cut -d ':' -f 2 <<< "$if_data" )
working_path=$working_path/$if_path working_path=$working_path/$if_data
fi fi
log_function_data "POST: working_path: $working_path\nif_path: $if_path - 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 [[ -n $if_path ]];then if [[ -n $if_data ]];then
for if_item in $if_path for if_item in $if_data
do do
# strip out trailing spaces # strip out trailing spaces
if_item=${if_item%% } if_item=${if_item%% }
@ -6531,6 +6531,10 @@ 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
speed=''
duplex=''
mac_id=''
oper_state=''
if [[ -r $working_path/speed ]];then if [[ -r $working_path/speed ]];then
speed=$( cat $working_path/speed 2>/dev/null ) speed=$( cat $working_path/speed 2>/dev/null )
fi fi