# Print USB interface status


UsbEth_Ok(){
    local iface=$1
    
    ip link show $iface &> /dev/null
    if [ $? != 0 ]; then
        echo "None"
        return 0
    fi
    
    local state=`ip link show $iface 2> /dev/null`
    echo $state | grep NO-CARRIER > /dev/null
    if [ $? = 0 ]; then
        echo "Cable unplugged"
    else
        echo $state | grep 'state DOWN' > /dev/null
        if [ $? = 0 ]; then
            echo "DOWN"
        else
            eval local usb_dev=\$USB_$eth_if
            test -e $usb_dev > /dev/null
            if [ $? = 0 ]; then
                echo "OK"
            else
                echo "Problem"
            fi
        fi
    fi
}


PrintUsbEth(){
    local iface=$1
    local comment=$2
    
    test -e /etc/init.d/network_$iface && {
        echo -n "| $comment     = `UsbEth_Ok $iface`"
    }
}


