not showing speed/duplex for lan card when it is down. Because cards don't always have 'up', but

might show 'unknown' for state, only not showing if it is down explicitly.
This commit is contained in:
inxi-svn 2011-11-22 05:33:11 +00:00
parent 94e9d050d0
commit 023ba2d188

9
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.7.25 #### version: 1.7.26
#### Date: November 21 2011 #### Date: November 21 2011
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
@ -51,7 +51,7 @@
#### DEPENDENCIES #### DEPENDENCIES
#### * bash >=3.0 (bash); df, readlink, stty, tr, uname, wc (coreutils); #### * bash >=3.0 (bash); df, readlink, stty, tr, uname, wc (coreutils);
#### gawk (gawk); grep (grep); lspci (pciutils); #### gawk (gawk); grep (grep); lspci (pciutils);
#### free, ps, uptime (procps); #### free, ps, uptime (procps); find (findutils)
#### * Also the proc filesystem should be present and mounted #### * Also the proc filesystem should be present and mounted
#### * Some features, like -M and -d will not work, or will work incompletely, #### * Some features, like -M and -d will not work, or will work incompletely,
#### if /sys is missing #### if /sys is missing
@ -4483,7 +4483,6 @@ get_network_advanced_data()
sed 's|/net.*||' ) sed 's|/net.*||' )
fi fi
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
# slice off the usb- part # slice off the usb- part
@ -7018,7 +7017,9 @@ print_network_advanced_data()
oper_state=${a_network_working[6]} oper_state=${a_network_working[6]}
fi fi
# no print out for wifi since it doesn't have duplex/speed data availabe # no print out for wifi since it doesn't have duplex/speed data availabe
if [[ $b_is_wifi != 'true' ]];then # note that some cards show 'unknown' for state, so only testing explicitly
# for 'down' string in that to skip showing speed/duplex
if [[ $b_is_wifi != 'true' && $oper_state != 'down' ]];then
if [[ -n ${a_network_working[7]} ]];then if [[ -n ${a_network_working[7]} ]];then
# make sure the value is strictly numeric before appending Mbps # make sure the value is strictly numeric before appending Mbps
if [[ -n $( grep -E '^[0-9\.,]+$' <<< "${a_network_working[7]}" ) ]];then if [[ -n $( grep -E '^[0-9\.,]+$' <<< "${a_network_working[7]}" ) ]];then