some tuning to support variants

This commit is contained in:
inxi-svn 2011-04-25 05:22:06 +00:00
parent 4e6de3d991
commit 80936e4e84

27
inxi
View file

@ -3034,29 +3034,36 @@ get_networking_data()
get_network_advanced_data() get_network_advanced_data()
{ {
eval $LOGFS eval $LOGFS
local a_network_adv_working='' data1='' working_path='' data2='' local a_network_adv_working='' card_port='' working_path=''
local data3='' data4='' local eth_id='' speed='' duplex='' mac_id=''
for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ )) for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ ))
do do
IFS="," IFS=","
a_network_adv_working=( ${A_NETWORK_DATA[i]} ) a_network_adv_working=( ${A_NETWORK_DATA[i]} )
working_path="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}/net" working_path="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}"
data1=$( ls $working_path 2>/dev/null ) if [[ -e $working_path/net ]];then
working_path=$working_path/$data1 card_port=$( ls $working_path/net 2>/dev/null )
if [[ -n $data1 ]];then eth_id=$card_port
# 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0
else
card_port=$( ls $working_path | grep 'net:' )
eth_id=$( cut -d ':' -f 2 <<< "$data1" )
fi
working_path=$working_path/net/$card_port
if [[ -n $card_port ]];then
if [[ -f $working_path/speed ]];then if [[ -f $working_path/speed ]];then
data2=$( cat $working_path/speed ) speed=$( cat $working_path/speed )
fi fi
if [[ -f $working_path/duplex ]];then if [[ -f $working_path/duplex ]];then
data3=$( cat $working_path/duplex ) duplex=$( cat $working_path/duplex )
fi fi
if [[ -f $working_path/address ]];then if [[ -f $working_path/address ]];then
data4=$( cat $working_path/address ) mac_id=$( cat $working_path/address )
fi fi
fi 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]}","$data1","$data2","$data3","$data4 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]}","$eth_id","$speed","$duplex","$mac_id
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
done done