Fixed minor bugs affecting InterfaceUtils.
This commit is contained in:
parent
e6058201cb
commit
dd33314fa8
|
@ -55,16 +55,16 @@ function interface_hardware() {
|
||||||
local __interface_hardware__device="/sys/class/net/$1/device"
|
local __interface_hardware__device="/sys/class/net/$1/device"
|
||||||
local __interface_hardware__hwinfo="$__interface_hardware__device/modalias"
|
local __interface_hardware__hwinfo="$__interface_hardware__device/modalias"
|
||||||
|
|
||||||
InterfaceHardwareBus="`cut -d ":" -f 1 "$__interface_chipset__hwinfo" 2> $InterfaceUtilsOutputDevice`"
|
InterfaceHardwareBus="`cut -d ":" -f 1 "$__interface_hardware__hwinfo" 2> $InterfaceUtilsOutputDevice`"
|
||||||
|
|
||||||
case "$InterfaceHardwareBus" in
|
case "$InterfaceHardwareBus" in
|
||||||
"usb") # Wanted to replace the line below with awk, but i'll probably just add complexity & issues (mawk vs gawk).
|
"usb") # Wanted to replace the line below with awk, but i'll probably just add complexity & issues (mawk vs gawk).
|
||||||
InterfaceHardwareID="`cut -d ":" -f 2 $__interface_chipset__hwinfo | cut -b 1-10 | sed 's/^.//;s/p/:/'`";;
|
InterfaceHardwareID="`cut -d ":" -f 2 $__interface_hardware__hwinfo | cut -b 1-10 | sed 's/^.//;s/p/:/'`";;
|
||||||
"pci" | "pcmcia" | "sdio")
|
"pci" | "pcmcia" | "sdio")
|
||||||
InterfaceHardwareID="`cat "$__interface_hardware__device/vendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/device" 2> $InterfaceUtilsOutputDevice`";;
|
InterfaceHardwareID="`cat "$__interface_hardware__device/vendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/device" 2> $InterfaceUtilsOutputDevice`";;
|
||||||
default) # The following will only work for USB devices.
|
default) # The following will only work for USB devices.
|
||||||
InterfaceHardwareID="`cat "$__interface_hardware__device/idVendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/idProduct" 2> $InterfaceUtilsOutputDevice`";;
|
InterfaceHardwareID="`cat "$__interface_hardware__device/idVendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/idProduct" 2> $InterfaceUtilsOutputDevice`"
|
||||||
InterfaceHardwareBus="usb" # This will be reset below if InterfaceHardwareID is invalid.
|
InterfaceHardwareBus="usb";; # This will be reset below if InterfaceHardwareID is invalid.
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check for invalid InterfaceHardwareID (starts or ends with :) .. not a happy face, still won't quote it.
|
# Check for invalid InterfaceHardwareID (starts or ends with :) .. not a happy face, still won't quote it.
|
||||||
|
@ -83,10 +83,10 @@ function interface_chipset() {
|
||||||
case "$InterfaceHardwareBus" in
|
case "$InterfaceHardwareBus" in
|
||||||
"usb")
|
"usb")
|
||||||
if [ ! "$InterfaceUSBBus" ]; then return 3; fi
|
if [ ! "$InterfaceUSBBus" ]; then return 3; fi
|
||||||
InterfaceChipset="`lsusb -d "$InterfaceHardwareID" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //'`"
|
InterfaceChipset="`lsusb -d "$InterfaceHardwareID" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //'`";;
|
||||||
"pci" | "pcmcia")
|
"pci" | "pcmcia")
|
||||||
if [ ! "$InterfacePCIBus" ]; then return 4; fi
|
if [ ! "$InterfacePCIBus" ]; then return 4; fi
|
||||||
InterfaceChipset="$(lspci -d $InterfaceHardwareID | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')"
|
InterfaceChipset="$(lspci -d $InterfaceHardwareID | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')";;
|
||||||
"sdio")
|
"sdio")
|
||||||
if [[ "${InterfaceHardwareID,,}" = "0x02d0"* ]]
|
if [[ "${InterfaceHardwareID,,}" = "0x02d0"* ]]
|
||||||
then InterfaceChipset=$(printf "Broadcom %d" ${InterfaceHardwareID:7})
|
then InterfaceChipset=$(printf "Broadcom %d" ${InterfaceHardwareID:7})
|
||||||
|
|
Loading…
Reference in New Issue