#!/bin/bash

usage="
        Usage: $(basename "$0") <phyId, monId, PhyPath> [-h]
      Example: $(basename "$0") phy0
Functionality: It resolves the deviceId for the given phyId, monId or PhyPath, for example, returning \"wlan0\" for \"phy0\", \"mon0\", or a sample PhyPath \"311\".

      Options:
	-h		Show usage information
"

while getopts 'h' OPT; do
    case $OPT in
        h)
            echo "$usage"
			exit 1
    esac
done

if [[ $# == 0 ]]; then
	(>&2 echo "Argument devId is mandatory.")
	echo "$usage"
	exit 1
fi

scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
result=""
result+=$(${scriptDir}/PHY2DEV  $1)
result+=$(${scriptDir}/MON2DEV  $1)
result+=$(${scriptDir}/PATH2DEV $1)

if [[ -n "$result" ]]; then
    echo "$result"
fi