albfan / miraclecast

Connect external monitors to your system via Wifi-Display specification also known as Miracast
Other
3.81k stars 411 forks source link

res/test-hardware-capabilities.sh reports wrong result #61

Closed phistep closed 8 years ago

phistep commented 8 years ago

I am using Arch Linux

% uname -a
Linux rechenschieber 4.3.3-2-ARCH #1 SMP PREEMPT Wed Dec 23 20:09:18 CET 2015 x86_64 GNU/Linux

and have a ThinkPad T430. The Chipset is Intel Corporation Centrino Ultimate-N 6300

% lspci | grep "Network controller"
03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 3e)

which the the Intel website (linked above) claims to have support for Intel Wireless Display which uses Miracast.

I ran the Intel WiDi Compatibility Tool which reported that my graphics card was not capable of running WiDi. My Laptop features the Nvidia Optimus technology. I have two graphics cards. One integrated Intel and a dedicated Nvidia, which is used on demand depending on work load. Unfortunately the Linux support for this hybrid mode is quite bad and because I need the power of the Nvidia card, I disabled the Intel card in BIOS. When I turn on Optimus in BIOS the tool reports success, and I can connect to my TV. Could this be the problem on Linux, too?

The Linux Kernel Wireless Wiki lists "P2P" on the feature list of the iwlwifi driver page, where my card is explicitly listed as supported. I have this driver installed for my device:

% readlink /sys/class/net/wlp3s0/device/driver
../../../../bus/pci/drivers/iwlwifi

% lspic -vv
[…]
03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 3e)
    Subsystem: Intel Corporation Centrino Ultimate-N 6300 3x3 AGN
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 29
    Region 0: Memory at f4900000 (64-bit, non-prefetchable) [size=8K]
    Capabilities: <access denied>
    Kernel driver in use: iwlwifi
    Kernel modules: iwlwifi

The res/test-hardware-capabilities.sh script reports

Sorry, wlp3s0 do not support P2P

but when I check the output of iw manually I find

% iw phy phy0 info | grep -C 5 -i p2p
Supported commands:
    […]
    * set_channel
    * set_wds_peer
    * probe_client
    * set_noack_map
    * register_beacons
    * start_p2p_device
    * set_mcast_rate
    * set_qos_map
    * connect
    * disconnect
Supported TX frame types:
    * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
Supported RX frame types:
    * IBSS: 0x40 0xb0 0xc0 0xd0
    * managed: 0x40 0xd0
    * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
    * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
    * mesh point: 0xb0 0xc0 0xd0
    * P2P-client: 0x40 0xd0
    * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
    * P2P-device: 0x40 0xd0
software interface modes (can always be added):
    * monitor
interface combinations are not supported
HT Capability overrides:
    * MCS: ff ff ff ff ff ff ff ff ff ff

[ellipses mine]

Full output of wi here.

Which to me, having no knowledge in the field though, suggests that my card is indeed capable of at least some kind of P2P connectivity.

More info about my system:

% systemctl --version
systemd 228
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN

% modinfo kdbus
filename:       /lib/modules/4.3.3-2-ARCH/extramodules/kdbus.ko
alias:          fs-kdbusfs
description:    D-Bus, powerful, easy to use interprocess communication
license:        GPL
depends:        
vermagic:       4.3.3-2-ARCH SMP preempt mod_unload modversions 

% lsmod | grep kdbus
kdbus                  90112  0

I installed miraclecast from the AUR but removed the systemd-kdbus dependancy, because I figured that I should not downgrade my systemd. The kdbus-Website says I need a systemd > 223, which I have and the kdbus kernel module, which seems to be loaded already. (Maybe my problems lies here?)

I shut down NetworkManger using systemctl stop NetworkManager and killed wpa_supplicant both using the res/kill-wba.sh script and manually using kill -9 until ps -ef | grep wpa_supplican did not report a running instance anymore. When I run miracle-wifid now, I get an

# sudo miracle-wifid
ERROR: dbus: cannot claim org.freedesktop.miracle.wifi bus-name: -13 (manager_dbus_connect() in wifid-dbus.c:898)

ps assures me that there is no other instance of miracle-wifid running. Of course I cannot run miraclectl successfully now (just adding this here for sake of completion)

% miracle-sinkctl
ERROR: cannot retrieve objects: The name org.freedesktop.miracle.wifi was not provided by any .service files (ctl_wifi_fetch() in ctl-wifi.c:1103)
[miraclectl] # 

In other issues (#20) I read I somehow have to run wpa_supplicant in ap mode, but the link to the script referenced there is dead, and frankly I have no idea how to do it. Couldn't find anything helpful in the manpage either.

albfan commented 8 years ago

If you use arch linux you can compile systemd with kdbus easiky from PKGBUILD. I can go in detail if you need this.

Systemd with kdbus is a must, because miraclecast listen to system events through dbus.

You can check if that fixes your problem, but without p2p on supported interface mode section from iw I'm sure your software do not support wifi display. We can go deeply on iw code to see how it outputs that capabilities and maybe create a robust tester even inside miraclecast (what would be desired)

phistep commented 8 years ago

So I've built systemd manually with --enable-kdbus and installed it. miracle-wifid runs, but tells me explicitly, that my driver or wpa_supplicant doesn't support P2P

albfan commented 8 years ago

Some reference info:

http://askubuntu.com/a/618293/89479 http://riya80211.blogspot.com.es/2013/07/p2p-configuration-of-wpasupplicant-in.html

For intro of what show what interface modes:

https://github.com/cozybit/iw/blob/master/util.c#L124 https://github.com/cozybit/iw/blob/master/info.c#L276

I have contact iw maintainer for a better way to check p2p-client and p2p-go supported interface modes and where is the faulty piece (hardware, kernel, modules, driver)

See at this point is not an miraclecast issue, just a faulty prerrequisite. I will try to improve info about hardware and driver imcompatibilities, but as a different issue based on iw maintainer answer.

albfan commented 8 years ago

Finally it was iwlwifi using iwldvm instead of iwlmvm module, no?

About checking hardware from miraclecast, this is the answer from iw maintainer

http://www.spinics.net/lists/linux-wireless/msg146044.html

I will create an issue related to that. Anyone interested on this enhancement that can provide PR.

shemgp commented 8 years ago

The command /sbin/iw phy wlan0 info in Ubuntu 16.04 displays command failed: No such file or directory (-2) so test-hardware-capabilities.sh shows my device doesn't support p2p. But when I run iw list (as per http://riya80211.blogspot.com/2013/07/p2p-configuration-of-wpasupplicant-in.html) the output is:

Wiphy phy0
    max # scan SSIDs: 20
    max scan IEs length: 195 bytes
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports RSN-IBSS.
    Supported Ciphers:
        * WEP40 (00-0f-ac:1)
        * WEP104 (00-0f-ac:5)
        * TKIP (00-0f-ac:2)
        * CCMP (00-0f-ac:4)
        * 00-0f-ac:10
        * GCMP (00-0f-ac:8)
        * 00-0f-ac:9
    Available Antennas: TX 0 RX 0
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
    Band 1:
        Capabilities: 0x1072
            HT20/HT40
            Static SM Power Save
            RX Greenfield
            RX HT20 SGI
            RX HT40 SGI
            No RX STBC
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 4 usec (0x05)
        HT TX/RX MCS rate indexes supported: 0-15
        Bitrates (non-HT):
            * 1.0 Mbps
            * 2.0 Mbps (short preamble supported)
            * 5.5 Mbps (short preamble supported)
            * 11.0 Mbps (short preamble supported)
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps
        Frequencies:
            * 2412 MHz [1] (15.0 dBm)
            * 2417 MHz [2] (15.0 dBm)
            * 2422 MHz [3] (15.0 dBm)
            * 2427 MHz [4] (15.0 dBm)
            * 2432 MHz [5] (15.0 dBm)
            * 2437 MHz [6] (15.0 dBm)
            * 2442 MHz [7] (15.0 dBm)
            * 2447 MHz [8] (15.0 dBm)
            * 2452 MHz [9] (15.0 dBm)
            * 2457 MHz [10] (15.0 dBm)
            * 2462 MHz [11] (15.0 dBm)
            * 2467 MHz [12] (15.0 dBm) (no IR)
            * 2472 MHz [13] (15.0 dBm) (no IR)
    Band 2:
        Capabilities: 0x1072
            HT20/HT40
            Static SM Power Save
            RX Greenfield
            RX HT20 SGI
            RX HT40 SGI
            No RX STBC
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 4 usec (0x05)
        HT TX/RX MCS rate indexes supported: 0-15
        Bitrates (non-HT):
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps
        Frequencies:
            * 5180 MHz [36] (15.0 dBm) (no IR)
            * 5200 MHz [40] (15.0 dBm) (no IR)
            * 5220 MHz [44] (15.0 dBm) (no IR)
            * 5240 MHz [48] (15.0 dBm) (no IR)
            * 5260 MHz [52] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5280 MHz [56] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5300 MHz [60] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5320 MHz [64] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5500 MHz [100] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5520 MHz [104] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5540 MHz [108] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5560 MHz [112] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5580 MHz [116] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5600 MHz [120] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5620 MHz [124] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5640 MHz [128] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5660 MHz [132] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5680 MHz [136] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5700 MHz [140] (15.0 dBm) (no IR, radar detection)
              DFS state: usable (for 429604 sec)
              DFS CAC time: 0 ms
            * 5745 MHz [149] (15.0 dBm) (no IR)
            * 5765 MHz [153] (15.0 dBm) (no IR)
            * 5785 MHz [157] (15.0 dBm) (no IR)
            * 5805 MHz [161] (15.0 dBm) (no IR)
            * 5825 MHz [165] (15.0 dBm) (no IR)
    Supported commands:
         * new_interface
         * set_interface
         * new_key
         * start_ap
         * new_station
         * new_mpath
         * set_mesh_config
         * set_bss
         * authenticate
         * associate
         * deauthenticate
         * disassociate
         * join_ibss
         * join_mesh
         * set_tx_bitrate_mask
         * frame
         * frame_wait_cancel
         * set_wiphy_netns
         * set_channel
         * set_wds_peer
         * probe_client
         * set_noack_map
         * register_beacons
         * start_p2p_device
         * set_mcast_rate
         * Unknown command (104)
         * connect
         * disconnect
    Supported TX frame types:
         * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    Supported RX frame types:
         * IBSS: 0x40 0xb0 0xc0 0xd0
         * managed: 0x40 0xd0
         * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * mesh point: 0xb0 0xc0 0xd0
         * P2P-client: 0x40 0xd0
         * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * P2P-device: 0x40 0xd0
    WoWLAN support:
         * wake up on disconnect
         * wake up on magic packet
         * wake up on pattern match, up to 20 patterns of 16-128 bytes,
           maximum packet offset 0 bytes
         * can do GTK rekeying
         * wake up on GTK rekey failure
         * wake up on EAP identity request
         * wake up on rfkill release
    software interface modes (can always be added):
         * AP/VLAN
         * monitor
    valid interface combinations:
         * #{ managed } <= 1, #{ AP } <= 1,
           total <= 2, #channels <= 1, STA/AP BI must match
         * #{ managed } <= 2,
           total <= 2, #channels <= 1
    HT Capability overrides:
         * MCS: ff ff ff ff ff ff ff ff ff ff
         * maximum A-MSDU length
         * supported channel width
         * short GI for 40 MHz
         * max A-MPDU length exponent
         * min MPDU start spacing
    Device supports TX status socket option.
    Device supports HT-IBSS.
    Device supports SAE with AUTHENTICATE command
    Device supports scan flush.
    Device supports per-vif TX power setting
    Driver supports a userspace MPM
    Device supports static SMPS
    Device supports dynamic SMPS

And it has P2P in it. However I can't seem to make sudo miracle-wifid to run. It errors out as:

ERROR: dbus: cannot claim org.freedesktop.miracle.wifi bus-name: -13 (manager_dbus_connect() in ../../../src/wifi/wifid-dbus.c:898)

but that's for another bug report.

Thanks for your help.

shemgp commented 8 years ago

I guess it's not supported. In the driver side at least (https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi)-- only shows it's working for iwlmvm. Thanks.

shemgp commented 8 years ago

On second look: http://lxr.free-electrons.com/source/drivers/net/wireless/iwlwifi/Kconfig?v=3.10 says its support is experimental. Haven't gotten to compiling my own kernel yet. Guess I have to try.

albfan commented 8 years ago

@shemgp is better to open different issues for different question, it's cheap and easy to follow.

For first issue I guess your dev is not called wlan0 (that's why you get a "no such fike or dir" /sys/class/net/wlan0 does not exist.

Anyway your driver do not support p2p see what is looking on test script is

https://github.com/albfan/miraclecast/blob/master/res/miracle-utils.sh#L74

Some p2p on "supported interface modes"

For second issue you need yo install dbus policy ( see README.md) but it will keep on failing as long as your device do not support p2p