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:
parent
ce1cbba7d5
commit
1cbfa5b42a
2 changed files with 14 additions and 4 deletions
|
@ -52,7 +52,7 @@ function find_wireless_connected_network_interfaces {
|
||||||
#
|
#
|
||||||
function find_physical_for_network_interface {
|
function find_physical_for_network_interface {
|
||||||
PHY_INDEX=$(iw dev $1 info | grep wiphy | awk '{print $2}')
|
PHY_INDEX=$(iw dev $1 info | grep wiphy | awk '{print $2}')
|
||||||
if [ -n $PHY_INDEX ]
|
if [ -n "$PHY_INDEX" ]
|
||||||
then
|
then
|
||||||
echo phy$PHY_INDEX
|
echo phy$PHY_INDEX
|
||||||
fi
|
fi
|
||||||
|
@ -65,6 +65,12 @@ function search_p2p_capabilities {
|
||||||
WI_DEVICE=$1
|
WI_DEVICE=$1
|
||||||
PHY_DEVICE=$(find_physical_for_network_interface $WI_DEVICE)
|
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
|
if iw phy $PHY_DEVICE info | grep -Pzo "(?s)Supported interface modes.*Supported commands" | grep "P2P" &> /dev/null
|
||||||
then
|
then
|
||||||
echo $WI_DEVICE supports P2P
|
echo $WI_DEVICE supports P2P
|
||||||
|
|
|
@ -14,12 +14,16 @@ fi
|
||||||
|
|
||||||
. miracle-utils.sh
|
. miracle-utils.sh
|
||||||
|
|
||||||
WIFI_NAMES=$(find_wireless_network_interfaces)
|
WIFI_COUNT=0
|
||||||
WIFI_COUNT=$(echo "$WIFI_NAMES" | wc -l)
|
WIFI_NAMES="$(find_wireless_network_interfaces)"
|
||||||
|
if [ -n "$WIFI_NAMES" ]
|
||||||
|
then
|
||||||
|
WIFI_COUNT=$(echo "$WIFI_NAMES" | wc -l)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ 0 = $WIFI_COUNT ]
|
if [ 0 = $WIFI_COUNT ]
|
||||||
then
|
then
|
||||||
echo There is no wireless devices avaliable
|
echo There is no wireless devices available
|
||||||
exit 1
|
exit 1
|
||||||
elif [ 1 = $WIFI_COUNT ]
|
elif [ 1 = $WIFI_COUNT ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue