Christian, Jouni,
I have tracked this down as far as I can get without some help.
It would be nice if you could take a closer look at the results - see
questions below.
Am 29.04.20 um 18:22 schrieb Frank Schäfer:
Am 27.04.20 um 18:53 schrieb Frank Schäfer:
Am 18.04.20 um 13:20 schrieb Frank Schäfer:
Hi,
I'm currently testing Miraclecast
(https://github.com/albfan/miraclecast), an open source
Wifi-Display/Miracast implementation.
In one of my setups, I'm using a carl9170 device as sink, which
fails with the following debugging output:
...
TRACE: wpa: raw message: IFNAME=wlp0s2f1u8 <3>CTRL-EVENT-SCAN-STARTED
TRACE: wpa: raw message: <3>P2P-PROV-DISC-PBC-REQ 8e:79:67:11:22:33
p2p_dev_addr=8e:79:67:11:22:33 pri_dev_type=10-0050F204-5 name='MY
DEVICE' config_methods=0x188 dev_capab=0x25 group_capab=0x0
TRACE: wpa: raw message: <3>P2P-GO-NEG-REQUEST 8e:79:67:11:22:33
dev_passwd_id=4 go_intent=0
DEBUG: supplicant: GO Negotiation Request from 8e:79:67:11:22:33
(supplicant_event_p2p_go_neg_request() in
../../../src/wifi/wifid-supplicant.c:1065)
DEBUG: supplicant: connect to 8e:79:67:11:22:33 via pbc/(null)
(supplicant_peer_connect() in ../../../src/wifi/wifid-supplicant.c:739)
TRACE: wpa: raw message: <3>P2P-FIND-STOPPED
DEBUG: supplicant: p2p-scanning stopped on wlp0s2f1u8
(supplicant_event_p2p_find_stopped() in
../../../src/wifi/wifid-supplicant.c:904)
TRACE: wpa: raw message: OK
TRACE: wpa: raw message: <3>P2P-GO-NEG-SUCCESS role=GO freq=2462
ht40=0 peer_dev=8e:79:67:11:22:33 peer_iface=8e:79:67:11:22:33
wps_method=PBC
DEBUG: supplicant: set STA-MAC for 8e:79:67:11:22:33 from <none> to
8e:79:67:11:22:33 (via GO-NEG-SUCCESS)
(supplicant_event_p2p_go_neg_success() in
../../../src/wifi/wifid-supplicant.c:1194)
TRACE: wpa: raw message: IFNAME=p2p-0 <3>Failed to start AP
functionality
DEBUG: supplicant: unhandled wpas-event: IFNAME=p2p-0 <3>Failed to
start AP functionality (supplicant_event() in
../../../src/wifi/wifid-supplicant.c:1498)
TRACE: wpa: raw message: <3>P2P-GROUP-FORMATION-FAILURE
DEBUG: supplicant: peer MY DEVICE connection failed
(supplicant_event_p2p_group_formation_failure() in
../../../src/wifi/wifid-supplicant.c:1318)
TRACE: wpa: raw message: <3>P2P-GROUP-REMOVED p2p-0 GO
reason=FORMATION_FAILED
DEBUG: supplicant: stray P2P-GROUP-REMOVED: <3>P2P-GROUP-REMOVED
p2p-0 GO reason=FORMATION_FAILED
(supplicant_event_p2p_group_removed() in
../../../src/wifi/wifid-supplicant.c:1286)
DEBUG: supplicant: sent P2P_FIND to wpas on wlp0s2f1u8
(supplicant_p2p_start_scan() in
../../../src/wifi/wifid-supplicant.c:2036)
TRACE: wpa: raw message: OK
DEBUG: supplicant: p2p-scanning now active on wlp0s2f1u8
(supplicant_p2p_find_fn() in ../../../src/wifi/wifid-supplicant.c:1917)
TRACE: wpa: raw message: IFNAME=wlp0s2f1u8 <3>CTRL-EVENT-SCAN-STARTED
...
Searching the web for similar problems leads to the following thread:
https://marc.info/?l=hostap&m=135336063022534
As suggested there, I have patched the Miraclecast sources to use
the wpa_supplicant configuration parameter p2p_no_group_iface=1.
So far, this works fine.
Regards,
Frank Schäfer
I finally managed to create extended logs and to compare the working
("GOOD") and non-working ("BAD") case.
See attachment.
If anything is missing, please let me know.
Hth,
Frank
Ok, this is what I can see happening in carl9170 with regards to the
interfaces:
1) 1 interface is added+initialized: NL80211_IFTYPE_STATION, p2p=false
(when miracle-wifid is started)
Non-working case (p2p_no_group_iface=0=default):
2a) 1 interface is added: NL80211_IFTYPE_STATION, p2p=true (apparently
the p2p group interface)
2b) 1 interface is removed: NL80211_IFTYPE_STATION, p2p=true
(apparently because setting of the interface flags failed with -EBUSY)
3) 1 interface is added+initialized: NL80211_IFTYPE_AP, p2p=true
=> fails with -EBUSY, because main_vif->p2p is false (main.c, line
656)
Working case (p2p_no_group_iface=1):
2) 1 interface is removed: NL80211_IFTYPE_STATION, p2p=false
3) 1 interface is added+initialized: NL80211_IFTYPE_AP, p2p=true
UPDATE (removed some confusion due to async output to the log, added
disconnection/exit):
1) STA non-p2p interface is added+initialized (miracle-wifid start)
Connection attempt:
BAD case (p2p_no_group_iface=0=default):
2a) STA p2p interface is added (p2p group interface)
2b) STA p2p interface is removed (p2p group interface)
3) AP p2p interface is added: fails with -EBUSY (carl9170 main.c, line
654), because main_vif->p2p is false in line 648
=> connection fails
GOOD case (p2p_no_group_iface=1):
2) STA non-p2p interface is removed
3) AP p2p interface is added+initialized
=> connection established, streaming
Disconnection (GOOD case (p2p_no_group_iface=1)):
4) AP p2p interface is removed
5) STA non-p2p interface is added+initialized
miracle-wifid exit:
6) STA non-p2p is interface is removed
So there are two things to investigate further: BAD 3) and GOOD 2)
@Christian:
Can you please check if the behavior of carl9170 (BAD 3)) is correct ?
Reading the comments and the rest of the code in the switch
(main_vif->type) {} section, I wonder if the main_vif->p2p check in line
654 is correct/required.
Isn't all we have to make sure, that the AP interface always becomes the
main interface ? Why does main_vif->p2p matter here ?
A few lines below (660/661), STA interfaces are always added if the main
interface is a AP interface, no matter if any of them is p2p or not.
@Jouni:
Why does wpa_supplicant remove the STA non-p2p interface before creating
the AP p2p interface if p2p_no_group_iface=1, but not if
p2p_no_group_iface=0 ?
That seems to be inconsistent.
In case the driver doesn't support concurrent interfaces, the behavior
of p2p_no_group_iface=1 seems to make things work.
But I don't know if there might be any disadvantages.
In my case, the removed interface is added again later (5)) and
everything works fine.
Regards,
Frank