[package] mac-to-devinfo updates and cleanups (#5488)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@16794 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian
2009-07-12 10:55:29 +00:00
parent e602b72d3a
commit 3ba2924807
7 changed files with 161 additions and 55 deletions

View File

@ -19,13 +19,27 @@ UCISTATE="$(mktemp -t)"
. $UCIFUNC
MAC=$1
if [ "$1" == "-x" ]; then
PORT="$2"
if [ -z "$PORT" ]; then
echo "-x without the port"
echo "Usage: $0 [-x port] MAC-address"
exit 1
fi
shift
shift
fi
MAC="$1"
if [ -z "$MAC" ]; then
echo "Must specify MAC address"
echo "Unknown MAC address | Unknown | unknown | unknown | unknown"
exit 1
fi
MAC=$(echo $MAC | sed -e 's/^\([0-9]\):/0\1:/g' | sed -e 's/:\([0-9]\)$/:0\1/g' | sed -e 's/:\([0-9]\):/:0\1:/g')
parse_override() {
local cfg="$1"
config_get name "$cfg" name
@ -65,6 +79,18 @@ parse_override() {
fi
if [ $((0x$MACMSB)) -ge $((0x$LOWMSB)) ] && [ $((0x$MACMSB)) -le $((0x$HIGHMSB)) ]; then
if [ $((0x$MACLSB)) -ge $((0x$LOWLSB)) ] && [ $((0x$MACLSB)) -le $((0x$HIGHLSB)) ]; then
if [ "$PORT" == "5060" ]; then
if [ "$vendor" == "Vertical Communications" ]; then
devtype="VoIP Phone"
model="IP200x"
fi
fi
if [ "$PORT" == "6060" ]; then
if [ "$vendor" == "Vertical Communications" ]; then
devtype="VoIP PBX"
model="Xcelerator IP"
fi
fi
if [ -n "$OUTSTRING" ]; then
echo "ERROR: We already have found information '$OUTSTRING'" >&2
echo -n "and now we have: " >&2