Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hardware capability test fails #312

Closed
visbs opened this issue Nov 28, 2018 · 15 comments
Closed

hardware capability test fails #312

visbs opened this issue Nov 28, 2018 · 15 comments

Comments

@visbs
Copy link

visbs commented Nov 28, 2018

~/miraclecast/res$ ./test-hardware-capabilities.sh 
command failed: No such device (-19)
cannot find physical device for wlan0

I use a usb wifi adapter

~  $ lsusb
Bus 002 Device 005: ID 0b05:17d2 ASUSTek Computer, Inc.  
~/ iwpriv

wlan0     Available private ioctls :
          write            (8BE0) : set 2047 char  & get   0      
          read             (8BE1) : set 2047 char  & get  16 char 
          driver_ext       (8BE2) : set   0       & get   0      
          mp_ioctl         (8BE3) : set   0       & get   0      
          apinfo           (8BE4) : set   1 int   & get   0      
          setpid           (8BE5) : set   2 int   & get   0      
          wps_start        (8BE6) : set   1 int   & get   0      
          get_sensitivity  (8BE7) : set   1 int   & get   0      
          wps_prob_req_ie  (8BE8) : set   1 int   & get   0      
          wps_assoc_req_ie (8BE9) : set   1 int   & get   0      
          channel_plan     (8BEA) : set   1 int   & get   0      
          dbg              (8BEB) : set   2 int   & get   0      
          rfw              (8BEC) : set   3 int   & get   0      
          rfr              (8BED) : set   2 int   & get  16 char 
          p2p_set          (8BF0) : set  64 char  & get   0      
          p2p_get          (8BF1) : set 1024 char  & get 2047 char 
          NULL             (8BF2) : set   0       & get   0      
          p2p_get2         (8BF3) : set  64 char  & get  64 char 
          tdls             (8BF4) : set  64 char  & get   0      
          tdls_get         (8BF5) : set  64 char  & get  64 char 
          pm_set           (8BF6) : set  64 char  & get   0      
          rereg_nd_name    (8BF8) : set  16 char  & get   0      
          efuse_set        (8BFA) : set 1024 char  & get   0      
          efuse_get        (8BFB) : set 128 char  & get 2047 char 
          test             (8BFD) : set  40 char  & get 2047 char 
          mp_start         (0005) : set 1024 char  & get   0      
          mp_phypara       (0018) : set 1024 char  & get 2047 char 
          mp_stop          (0006) : set 1024 char  & get   0      
          mp_channel       (0008) : set 1024 char  & get 2047 char 
          mp_bandwidth     (0009) : set 1024 char  & get   0      
          mp_rate          (0007) : set 1024 char  & get 2047 char 
          mp_reset_stats   (0016) : set 1024 char  & get   0      
          mp_query         (000E) : set 1024 char  & get 2047 char 
          read_reg         (0002) : set 1024 char  & get 2047 char 
          mp_rate          (0007) : set 1024 char  & get 2047 char 
          read_rf          (0004) : set 1024 char  & get 2047 char 
          mp_psd           (0010) : set 1024 char  & get 2047 char 
          mp_dump          (0017) : set 1024 char  & get 2047 char 
          mp_txpower       (000A) : set 1024 char  & get 2047 char 
          mp_ant_tx        (000B) : set 1024 char  & get 2047 char 
          mp_ant_rx        (000C) : set 1024 char  & get 2047 char 
          write_reg        (0001) : set 1024 char  & get 2047 char 
          write_rf         (0003) : set 1024 char  & get 2047 char 
          mp_ctx           (000D) : set 1024 char  & get 2047 char 
          mp_arx           (000F) : set 1024 char  & get 2047 char 
          mp_ther          (0012) : set 1024 char  & get 2047 char 
          efuse_set        (0015) : set 1024 char  & get 2047 char 
          efuse_get        (0014) : set 1024 char  & get 2047 char 
          mp_pwrtrk        (0011) : set 1024 char  & get   0      
          mp_drvquery      (001A) : set 1024 char  & get 2047 char 
          mp_ioctl         (0013) : set 1024 char  & get   0      
          mp_setrfpath     (0019) : set 1024 char  & get   0      
          mp_get_txpower   (001E) : set 1024 char  & get 2047 char 
          cta_test         (001C) : set 1024 char  & get   0      

any help appreciated :)

@albfan
Copy link
Owner

albfan commented Nov 28, 2018

That script make some assumptions about where to find your network interface and its name

run with

$ test_hardware_capabilities_DEBUG=10 ./test-hardware-capabilities.sh

and paste exact output here

@visbs
Copy link
Author

visbs commented Nov 28, 2018

this was the output of the given

$ test_hardware_capabilities_DEBUG=10 ./test-hardware-capabilities.sh 
+ '[' 10 -ge 10 ']'
+ set -v

. miracle-utils.sh
+ . miracle-utils.sh
#http://lxr.linux.no/linux+v3.0/include/linux/if_arp.h#L67
ARPHRD_LOOPBACK=772
++ ARPHRD_LOOPBACK=772

#
# Find all interfaces except loopback one
#
function find_choosable_networknames {
   for i in $( ls /sys/class/net )
   do 
      if [ $( cat /sys/class/net/$i/type ) != $ARPHRD_LOOPBACK ] 
      then
         echo $i
      fi
   done
}

#
# find wireless interfaces
#
function find_wireless_network_interfaces {
   for i in $( find_choosable_networknames )
   do 
      if [ -d /sys/class/net/$i/wireless ]
      then
         echo $i
      fi
   done
}

#
# show pci slot
#
function show_pci_slot {
   basename $(readlink /sys/class/net/$1/device) | cut -d: -f2 | sed 's/^0*//'
}

#
# test if interface is connected
#
function is_interface_connected {
   test x$( cat /sys/class/net/$1/carrier 2>/dev/null) = x1
}

#
# find wireless pci slot
#
function find_wireless_pci_slot {
   for i in $( find_wireless_network_interfaces )
   do
      show_pci_slot $i
   done
}

#
# find wireless pci slot
#
function find_wireless_ifindex {
   for i in $( find_wireless_network_interfaces )
   do
      show_ifindex $i
   done
}

#
# find wireless connected interfaces
#
function find_wireless_connected_network_interfaces {
   for i in $( find_wireless_network_interfaces )
   do 
      if is_interface_connected $i
      then
         echo $i
      fi
   done
}

#
# find physical for interface if exists
#
function find_physical_for_network_interface {
   PHY_INDEX=$(iw dev $1 info | grep wiphy | awk '{print $2}')
   if [ -n "$PHY_INDEX" ]
   then
      echo phy$PHY_INDEX
   fi
}

#
# find interface index for interface
#
function show_ifindex {
   IF_INDEX=$(iw dev $1 info | grep ifindex | awk '{print $2}')
   if [ -n "$IF_INDEX" ]
   then
      echo $IF_INDEX
   fi
}

#
# Check interface for P2P capabilities
#
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
   else
      echo Sorry, $WI_DEVICE do not support P2P
      exit 1
   fi
}

#
# show wpa_supplicant command
#
function show_wpa_supplicant_process {
   ps -ef | grep "wpa_supplican[t] "
}

#
# show wpa_supplicant command
#
function show_wpa_supplicant_command {
   show_wpa_supplicant_process | awk '{print substr($0, index($0,$8))}'
}

#
# find wpa_supplicant pid
#
function find_wpa_supplicant_pid {
   show_wpa_supplicant_process | awk '{print $2}'
}

#
# checking if distro is archlinux
#
function check_archlinux_distro {
   test -f "/etc/arch-release"
}
#
# checking if distro is ubuntu
#
function check_ubuntu_distro {
   cat /proc/version | grep -i ubuntu
}
#
# checking if distro is debian
#
function check_debian_distro {
   cat /proc/version | grep -i debian
}

#
# ubuntu manager restarts automatically wpa_supplicant
#
function kill_ubuntu_network_manager {
   if check_ubuntu_distro || check_debian_distro
   then
      echo stopping NetworkManager
      sudo service NetworkManager stop
   fi
}

#
# arch linux manager restarts automatically wpa_supplicant
#
function kill_archlinux_network_manager {
   if check_ubuntu_distro
   then
      echo stopping NetworkManager
      sudo systemctl stop Network.service
   fi
}

#
# start ubuntu manager
#
function start_ubuntu_network_manager {
   if check_ubuntu_distro || check_debian_distro
   then
      echo starting NetworkManager
      sudo service NetworkManager start
   fi
}

#
# start arch linux manager
#
function start_archlinux_network_manager {
   if check_archlinux_distro
   then
      echo starting NetworkManager
      sudo systemctl start Network.service
   fi
}

WIFI_COUNT=0
+ WIFI_COUNT=0
WIFI_NAMES="$(find_wireless_network_interfaces)"
++ find_wireless_network_interfaces
+++ find_choosable_networknames
++++ ls /sys/class/net
+++ for i in $( ls /sys/class/net )
++++ cat /sys/class/net/enp2s0/type
+++ '[' 1 '!=' 772 ']'
+++ echo enp2s0
+++ for i in $( ls /sys/class/net )
++++ cat /sys/class/net/lo/type
+++ '[' 772 '!=' 772 ']'
+++ for i in $( ls /sys/class/net )
++++ cat /sys/class/net/wlan0/type
+++ '[' 1 '!=' 772 ']'
+++ echo wlan0
++ for i in $( find_choosable_networknames )
++ '[' -d /sys/class/net/enp2s0/wireless ']'
++ for i in $( find_choosable_networknames )
++ '[' -d /sys/class/net/wlan0/wireless ']'
++ echo wlan0
+ WIFI_NAMES=wlan0
if [ -n "$WIFI_NAMES" ]
then
  WIFI_COUNT=$(echo "$WIFI_NAMES" | wc -l)
fi
+ '[' -n wlan0 ']'
++ echo wlan0
++ wc -l
+ WIFI_COUNT=1

if [ 0 = $WIFI_COUNT ]
then
   echo There is no wireless devices available
   exit 1
elif [ 1 = $WIFI_COUNT ]
then
   WIFI_NAME="$WIFI_NAMES"
elif [ 2 -ge $WIFI_COUNT ]
then
   echo Choose wireless device:
   PS3="device: "
   QUIT="exit"
   select wi_name in $WIFI_NAMES $QUIT
   do
      case $wi_name
      in
      "$QUIT")
         exit
         ;;
      "")
         if [ "$REPLY" = $QUIT ]
         then
            exit
         else
            echo unknow $REPLY
         fi
         ;;
      *)
         WIFI_NAME=$wi_name
         break
         ;;
      esac
   done
fi
+ '[' 0 = 1 ']'
+ '[' 1 = 1 ']'
+ WIFI_NAME=wlan0

search_p2p_capabilities $WIFI_NAME
+ search_p2p_capabilities wlan0
+ WI_DEVICE=wlan0
++ find_physical_for_network_interface wlan0
+++ grep wiphy
+++ awk '{print $2}'
+++ iw dev wlan0 info
command failed: No such device (-19)
++ PHY_INDEX=
++ '[' -n '' ']'
+ PHY_DEVICE=
+ '[' -z '' ']'
+ echo 'cannot find physical device for wlan0'
cannot find physical device for wlan0
+ return

@albfan
Copy link
Owner

albfan commented Nov 28, 2018

Seems it finds you have an wlan interface in /sys/class/net/wlan0but this command is failing:

$ iw dev wlan0 info

check you have iw installed and paste here output for:

$ iw dev
$ iw phy

NOTE: Remember to put output into three ` at beginning and at the end

@visbs
Copy link
Author

visbs commented Nov 29, 2018

visbs@visbs-Vostro-260:~$ iw dev
visbs@visbs-Vostro-260:~$ iw phy

didn't give any output

but iw is installed  as it shows 
$sudo apt-get install iw
Reading package lists... Done
Building dependency tree       
Reading state information... Done
iw is already the newest version (4.14-0.1).

@albfan
Copy link
Owner

albfan commented Nov 29, 2018

I think you could need to install more packages to make it work. See https://superuser.com/q/1049960

I can add a check about this problem to be sure is is working.

Anyway this is only a check. If you suppose your dongle supports WiFi direct just try with miraclecast

@visbs
Copy link
Author

visbs commented Nov 29, 2018

i did try that mentioned in that site but still i am not able to get the hardware-capability , why i need to see this badly is that i am not able to go further after

visbs@visbs-Vostro-260:~/miraclecast$ systemctl stop NetworkManager.service 
visbs@visbs-Vostro-260:~/miraclecast$ systemctl stop wpa_supplicant.service 
visbs@visbs-Vostro-260:~/miraclecast$ sudo miracle-wifid &
[2] 13686
visbs@visbs-Vostro-260:~/miraclecast$ sudo miracle-wifictl 
[sudo] password for vishal: 
ERROR: cannot retrieve objects: The name org.freedesktop.miracle.wifi was not provided by any .service files (ctl_wifi_fetch() in ctl-wifi.c:1172)
[miraclectl] # 

[2]+  Stopped                 sudo miracle-wifid

so as i have followed all the steps give in README.md i dono still why am not able to start off....
/ I know that this going off topic but any help would be appreciated

@albfan
Copy link
Owner

albfan commented Nov 29, 2018

Provide logs for support as said in wiki faq. But see miracle-sinkctl is not working right now. See #4 and #172

@visbs
Copy link
Author

visbs commented Nov 29, 2018

logs.zip

@albfan
Copy link
Owner

albfan commented Nov 29, 2018

You need to run with miracle-wifid and miracle-sinkctl with --log-level trace to see more details on captured logs. Remember to start journalctl -f prior to all them (in other terminal) to catch all the setup miracle-wifid do and the communication when miracle-sinkctl tries to connect

@visbs
Copy link
Author

visbs commented Nov 29, 2018

thank u my problem was solved i may need some more assistance regarding the next steps will look into the repository, thanks again @albfan

@visbs visbs closed this as completed Nov 29, 2018
@albfan
Copy link
Owner

albfan commented Nov 29, 2018

Would be great to document what was the error, to help others in same situation, the whole idea, is to create know-how with all these issues

Feel free to open more issues with specific errors

@visbs
Copy link
Author

visbs commented Nov 29, 2018

  1. make distclean
    2.make
    3.sudo make install
    did the trick for me
    now i am able to get the p2p_support msg
visbs@visbs-Vostro-260:~/miraclecast/res$ ./test-hardware-capabilities.sh 
wlan0 supports P2P

thanks for the support

@albfan
Copy link
Owner

albfan commented Nov 29, 2018

What source code are those commands building?. Is impossible that miraclecast fix iw for you.

You had installed some firmware that make it work

@visbs
Copy link
Author

visbs commented Nov 29, 2018

i think after following these steps and a reboot made it possible

I think you could need to install more packages to make it work. See https://superuser.com/q/1049960

@albfan
Copy link
Owner

albfan commented Nov 29, 2018

Yes, I think so. Anyway have to protect iw from fail there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants