1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

Fix hardware tester when no devices available

This commit is contained in:
albfan 2016-02-20 11:06:45 +01:00
parent ce1cbba7d5
commit 1cbfa5b42a
2 changed files with 14 additions and 4 deletions

View file

@ -52,7 +52,7 @@ function find_wireless_connected_network_interfaces {
#
function find_physical_for_network_interface {
PHY_INDEX=$(iw dev $1 info | grep wiphy | awk '{print $2}')
if [ -n $PHY_INDEX ]
if [ -n "$PHY_INDEX" ]
then
echo phy$PHY_INDEX
fi
@ -65,6 +65,12 @@ function search_p2p_capabilities {
WI_DEVICE=$1
PHY_DEVICE=$(find_physical_for_network_interface $WI_DEVICE)
if [ -z "$PHY_DEVICE" ]
then
echo "cannot find physical device for $WI_DEVICE"
return
fi
if iw phy $PHY_DEVICE info | grep -Pzo "(?s)Supported interface modes.*Supported commands" | grep "P2P" &> /dev/null
then
echo $WI_DEVICE supports P2P

View file

@ -14,12 +14,16 @@ fi
. miracle-utils.sh
WIFI_NAMES=$(find_wireless_network_interfaces)
WIFI_COUNT=$(echo "$WIFI_NAMES" | wc -l)
WIFI_COUNT=0
WIFI_NAMES="$(find_wireless_network_interfaces)"
if [ -n "$WIFI_NAMES" ]
then
WIFI_COUNT=$(echo "$WIFI_NAMES" | wc -l)
fi
if [ 0 = $WIFI_COUNT ]
then
echo There is no wireless devices avaliable
echo There is no wireless devices available
exit 1
elif [ 1 = $WIFI_COUNT ]
then