#!/bin/bash

usage="
        Usage: $(basename "$0") <anyId-single> [-h]
      Example: $(basename "$0") phy0
Functionality: Test whether <anyId-single> is a QCA 9300 wireles NIC.

      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 deviceId is mandatory.")
	echo "$usage"
	exit 1
fi

scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"

anyId_single=$1
phyId=$(${scriptDir}/ANY2PHY $anyId_single)

if [[ ! -z phyId ]]; then
    PhyPathMapping="$(${scriptDir}/GetPhyPathMapping)"
    echo "$PhyPathMapping" | grep -E "PHY:$phyId " | grep -ocE "(AR93)|(AR95)"
fi