#!/bin/bash
#
# Emulate the ifModeShow command on the 4.0 Linux-based switches.
# Requires mii-tool.
#

IFACE=$1
if [ "$IFACE" = "" ]; then
        echo "Usage:     ifModeShow <interface>"
        echo "Example:   ifModeShow \"eth0\""
        exit 1
fi
if [ "$IFACE" != "eth0" ]; then
        echo "ifModeSet can only be used with eth0."
        exit 1
fi

MII_STATE=$(/sbin/mii-tool $MII_CMD $MII_MODES $IFACE 2>/dev/null)
MII_STATE=${MII_STATE#eth0: } 	# leading iface name
echo "Link mode:" $MII_STATE
exit 0
