mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 00:47:47 +00:00
branch one, second test to handle dual port infiniband device for networking
This commit is contained in:
parent
8e8c78d8ef
commit
8463de14ab
82
inxi
82
inxi
|
@ -2,8 +2,8 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.28
|
#### Version: 2.1.28
|
||||||
#### Date: 2014-07-21
|
#### Date: 2014-07-22
|
||||||
#### Patch Number: 01-b1
|
#### Patch Number: 02-b1
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -6414,8 +6414,8 @@ 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_path='' working_path='' working_uevent_path='' dir_path=''
|
||||||
local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' b_infiniband='false'
|
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=''
|
local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' array_counter=0
|
||||||
|
|
||||||
for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ ))
|
for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ ))
|
||||||
do
|
do
|
||||||
|
@ -6447,14 +6447,17 @@ get_network_advanced_data()
|
||||||
# now we want the real one, that xiin also displays, without symbolic links.
|
# now we want the real one, that xiin also displays, without symbolic links.
|
||||||
if [[ -n $working_path && -e $working_path ]];then
|
if [[ -n $working_path && -e $working_path ]];then
|
||||||
working_path=$( readlink -f $working_path 2>/dev/null )
|
working_path=$( readlink -f $working_path 2>/dev/null )
|
||||||
# first look for infiniband, don't run this check if it's infiniband
|
else
|
||||||
# sometimes there is another directory between the path and /net
|
working_path=$( find -P /sys/ -type d -name "*:${a_network_adv_working[4]}" 2>/dev/null )
|
||||||
if [[ ! -e $working_path/net ]];then
|
# just on off chance we get two returns, just one one
|
||||||
# using find here, probably will need to also use it in usb part since the grep
|
working_path=${working_path%% *}
|
||||||
# method seems to not be working now. Slice off the rest, which leaves the basic path
|
fi
|
||||||
working_path=$( find $working_path/*/net/*/uevent 2>/dev/null | \
|
# sometimes there is another directory between the path and /net
|
||||||
sed 's|/net.*||' )
|
if [[ -n $working_path && ! -e $working_path/net ]];then
|
||||||
fi
|
# using find here, probably will need to also use it in usb part since the grep
|
||||||
|
# method seems to not be working now. Slice off the rest, which leaves the basic path
|
||||||
|
working_path=$( find $working_path/*/net/*/uevent 2>/dev/null | \
|
||||||
|
sed 's|/net.*||' )
|
||||||
fi
|
fi
|
||||||
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
|
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
|
||||||
else
|
else
|
||||||
|
@ -6501,14 +6504,11 @@ get_network_advanced_data()
|
||||||
# the short path, minus the last longer numeric directory name, ie:
|
# the short path, minus the last longer numeric directory name, ie:
|
||||||
# from debian squeeze 2.6.32-5-686:
|
# from debian squeeze 2.6.32-5-686:
|
||||||
# /sys/devices/pci0000:00/0000:00:0b.1/usb1/1-1/net/wlan0/address
|
# /sys/devices/pci0000:00/0000:00:0b.1/usb1/1-1/net/wlan0/address
|
||||||
|
|
||||||
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,
|
||||||
|
# with line break in output
|
||||||
if_path=$( ls $working_path/net 2>/dev/null )
|
if_path=$( ls $working_path/net 2>/dev/null )
|
||||||
if_id=$if_path
|
b_path_made='false'
|
||||||
# hack for now, for infiniband can have more than one id, so we'll only use the first one
|
|
||||||
# until I figure out a way to get the whole thing to recognize all the ids
|
|
||||||
if_path=${if_path%% *}
|
|
||||||
working_path=$working_path/net/$if_path
|
|
||||||
# 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_path=$( ls $working_uevent_path/net 2>/dev/null )
|
||||||
|
@ -6521,26 +6521,36 @@ get_network_advanced_data()
|
||||||
working_path=$working_path/$if_path
|
working_path=$working_path/$if_path
|
||||||
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_path: $if_path - if_id: $if_id"
|
||||||
|
## note: in cases of dual ports with different ids, this loop will create extra array items
|
||||||
if [[ -n $if_path ]];then
|
if [[ -n $if_path ]];then
|
||||||
if [[ -r $working_path/speed ]];then
|
for if_item in $if_path
|
||||||
speed=$( cat $working_path/speed 2>/dev/null )
|
do
|
||||||
fi
|
# strip out trailing spaces
|
||||||
if [[ -r $working_path/duplex ]];then
|
if_item=${if_item%% }
|
||||||
duplex=$( cat $working_path/duplex 2>/dev/null )
|
if [[ $b_path_made == 'false' ]];then
|
||||||
fi
|
working_path=$working_path/net/$if_item
|
||||||
if [[ -r $working_path/address ]];then
|
if_id=$if_item
|
||||||
mac_id=$( cat $working_path/address 2>/dev/null )
|
fi
|
||||||
fi
|
if [[ -r $working_path/speed ]];then
|
||||||
if [[ -r $working_path/operstate ]];then
|
speed=$( cat $working_path/speed 2>/dev/null )
|
||||||
oper_state=$( cat $working_path/operstate 2>/dev/null )
|
fi
|
||||||
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
|
||||||
|
# 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++))
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n ${a_network_adv_working[10]} ]];then
|
|
||||||
chip_id=${a_network_adv_working[10]}
|
|
||||||
fi
|
|
||||||
A_NETWORK_DATA[i]=${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
|
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue