Miracast (讀作 mirror cast).

裝上 wireless-tools

$ sudo apt-get install wireless-tools

提供了以下幾個好用的命令

$ apt-file list wireless-tools | grep sbin
wireless-tools: /sbin/iwconfig
wireless-tools: /sbin/iwevent
wireless-tools: /sbin/iwgetid
wireless-tools: /sbin/iwlist
wireless-tools: /sbin/iwpriv
wireless-tools: /sbin/iwspy

For video, Miracast supports the ITU-T H.264 video codec (AKA Advanced Video Coding [AVC]) for high-definition video. It supports the Constrained Baseline Profile (CBP) and the Miracast-specific Constrained High Profile (CHP), at levels ranging from 3.1 to 4.2. Supported display resolutions include common Consumer Electronics Association (CEA) formats, Video Electronics Standards Association (VESA) formats, and handheld formats.

For audio, Miracast supports a number of Linear Pulse-Code Modulation (LPCM), Advanced Audio Coding (AAC), and Dolby Advanced Codec 3 (AC3) modes.

Hardware Requirements

摘自 Microsoft 網站

Miracast requires both WiFiDirect support in the WLAN Adapter and support in the Graphics driver. Miracast allows the user to extend their display to a Miracast supported sync device.

WiFi-Direct 術語

http://riya80211.blogspot.com/2013/07/p2p-configuration-of-wpasupplicant-in.html

In a typical Wi-Fi network, clients discover and associate to WLANs, which are created and announced by Access Points (APs). In this way, a device unambiguously behaves either as an AP or as a client, each of these roles involving a different set of functionality. A major novelty of Wi-Fi Direct is that these roles are specified as dynamic, and hence a Wi-Fi Direct device has to implement both the role of a client and the role of an AP.

The device implementing AP-like functionality in the P2P Group is referred to as the P2P Group Owner (P2P GO), and devices acting as clients are known as P2P
Clients.Legacy clients can also communicate with the P2P GO, as long as they are not 802.11b-only devices and support the required security mechanisms.

OS Supporting

Windows 8.1 之後, Android 4.2 之後, 但, 很可惜的, Google 決定 Android 6 之後不再支持 Miracast, 只支持自家的 Chromecast.

Projects

More Info

Discussion

Similar Techs

Driver

Intel iwlwifi

7260 and 7265 support

7260 and 7265 will not be supported by the newest firmware versions: the last firmware that was released for these devices is -17.ucode. Bug fixes will be ported to -17.ucode. Note that 7265D can run later firmware versions. In order to determine if your 7265 device is a 'D' version, you can check the dmesg output:

Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210
The revision number of a 7265D device is 0x210, if you see any other number, you have a 7265 device.

試過的組合

似乎跟 dongle 的連線不會一次就成功

第一次連不 OK, 第二次則 OK, 接著再 find 就不動了, 停掉 wpa_cli 沒用.

> status
wpa_state=DISCONNECTED
p2p_device_address=0c:8b:fd:09:10:82
address=0c:8b:fd:09:10:82
uuid=116fb791-645c-5cb8-b97c-37b5d38caa79
> p2p_find 
OK
<3>CTRL-EVENT-SCAN-STARTED 
<3>P2P-DEVICE-FOUND ac:a2:13:6e:f8:2f p2p_dev_addr=ac:a2:13:6e:f8:2f pri_dev_type=7-0050F204-1 name='DONGLE-ACA2136EF82F' config_methods=0x80 dev_capab=0x21 group_capab=0x0 wfd_dev_info=0x01111c440032
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED                                                    
<3>CTRL-EVENT-SCAN-STARTED tus                                                
<3>CTRL-EVENT-SCAN-STARTED 2p_stop_find                                       
> p2p_stop_find                                                               
OK
<3>P2P-FIND-STOPPED 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=15                              
OK
<3>P2P-GO-NEG-SUCCESS role=GO freq=2412 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=15
OK
<3>P2P-GO-NEG-SUCCESS role=GO freq=2412 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-SUCCESS 
<3>P2P-GROUP-STARTED p2p-wlan0-1 GO ssid="DIRECT-kB" freq=2412 passphrase="fgKioau8" go_dev_addr=0c:8b:fd:09:10:82
<3>AP-STA-CONNECTED ac:a2:13:6e:f8:2f p2p_dev_addr=ac:a2:13:6e:f8:2f
<3>AP-STA-DISCONNECTED ac:a2:13:6e:f8:2f p2p_dev_addr=ac:a2:13:6e:f8:2f
<3>P2P-DEVICE-LOST p2p_dev_addr=ac:a2:13:6e:f8:2f

停掉 wpa_supplicant 的話

> 'PING' command timed out.
Connection to wpa_supplicant lost - trying to reconnect
Warning: Failed to attach to wpa_supplicant.
Warning: Failed to attach to wpa_supplicant.
Connection to wpa_supplicant re-established
<3>P2P-GROUP-REMOVED p2p-wlan0-1 GO reason=REQUESTED
<3>CTRL-EVENT-TERMINATING 
Connection to wpa_supplicant lost - trying to reconnect

wpa_supplicant 的 log

wlan0: Control interface command 'P2P_CONNECT ac:a2:13:6e:f8:2f pbc go_intent=15'                                                                    [391/391]
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: Shared frequencies (len=0): valid for P2P
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: P2P: num_unused_channels: 2
P2P: Setup freqs: freq=0 num_MCC=2 shared_freqs=0 num_unused=2
P2P: Current operating channels are not available for P2P. Try to use another channel
P2P: Own frequency preference: 0 MHz
P2P: Create a new interface p2p-wlan0-0 for the group
nl80211: Create interface iftype 9 (P2P_GO)
nl80211: New interface p2p-wlan0-0 created: ifindex=27
nl80211: Set TX rates failed: ret=-100 (Network is down)
P2P: Created pending virtual interface p2p-wlan0-0 addr 0c:8b:fd:09:10:83
P2P: Request to start group negotiation - peer=ac:a2:13:6e:f8:2f  GO Intent=15  Intended Interface Address=0c:8b:fd:09:10:83 wps_method=3 persistent_group=0 p
d_before_go_neg=0 oob_pw_id=0
P2P: Prepare channel - force_freq=0 pref_freq=0 go=1
P2P: Prepare channel best
P2P: Select pre-configured channel as operating channel preference
P2P: prepared channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: after go/cli filter/add: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Own preference for operation channel: Operating Class 81 Channel 1
P2P: * Dialog Token: 1
P2P: * P2P IE header
P2P: * Capability dev=25 group=08
P2P: * GO Intent: Intent 15 Tie breaker 1
P2P: * Configuration Timeout: GO 255 (*10ms)  client 20 (*10ms)
P2P: * Listen Channel: Regulatory Class 81 Channel 1
P2P: * Intended P2P Interface Address 0c:8b:fd:09:10:83
P2P: * Channel List - hexdump(len=16): 43 4e 04 51 0b 01 02 03 04 05 06 07 08 09 0a 0b
P2P: * Device Info
P2P: * Operating Channel: Regulatory Class 81 Channel 1
WPS:  * Version (hardcoded 0x10)
P2P: WPS IE Device Password ID: 4
WPS:  * Version2 (0x20)
P2P: Sending GO Negotiation Request
P2P: State IDLE -> CONNECT
P2P: Schedule new radio work for Action frame TX (listen_freq=-1 send_freq=-1)
wlan0: Add radio work 'p2p-send-action'@0x5584d3297360
wlan0: First radio work item in the queue - schedule start immediately
wlan0: Starting radio work 'p2p-send-action'@0x5584d3297360 after 0.000021 second wait
Off-channel: Send action frame: freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f len=136
nl80211: Send Action frame (ifindex=3, freq=2437 MHz wait=500 ms no_cck=1)
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 27
nl80211: Drv Event 60 (NL80211_CMD_FRAME_TX_STATUS) received for wlan0
nl80211: Frame TX status event
nl80211: Action TX status: cookie=0187 (match) (ack=1)
wlan0: Event TX_STATUS (18) received
wlan0: EVENT_TX_STATUS dst=ac:a2:13:6e:f8:2f type=0 stype=13
Off-channel: Delete matching pending action frame
Off-channel: TX status result=0 cb=0x5584d263bc90
P2P: Action frame TX callback (state=1 freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f result=0
P2P: GO Negotiation Request TX callback: success=1
P2P: State CONNECT -> CONNECT
P2P: Set timeout (state=CONNECT): 0.500000 sec
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0
nl80211: RX frame sa=ac:a2:13:6e:f8:2f freq=2437 ssi_signal=-30 stype=13 (WLAN_FC_STYPE_ACTION) len=171
wlan0: Event RX_MGMT (20) received
wlan0: Received Action frame: SA=ac:a2:13:6e:f8:2f Category=4 DataLen=146 freq=2437 MHz
P2P: RX P2P Public Action from ac:a2:13:6e:f8:2f
P2P: Received GO Negotiation Response from ac:a2:13:6e:f8:2f (freq=2437)
P2P: Parsing the received message
P2P: * Dialog Token: 1
P2P: Parsing WPS IE
P2P: Device Password ID: 4
P2P: Parsing P2P IE
P2P: Attribute 0 length 1
P2P: * Status: 0
P2P: Attribute 2 length 2
P2P: * Device Capability 21 Group Capability 00
P2P: Attribute 4 length 1
P2P: * GO Intent: Intent 1 Tie breaker 0
P2P: Attribute 5 length 2
P2P: * Configuration Timeout
P2P: Attribute 9 length 6
P2P: * Intended P2P Interface Address: ac:a2:13:6e:f8:2f
P2P: Attribute 11 length 18
P2P: * Channel List: Country String 'XX(0x04)'
P2P: Attribute 13 length 40
P2P: * Device Info: addr ac:a2:13:6e:f8:2f primary device type 7-0050F204-1 device name 'DONGLE-ACA2136EF82F' config methods 0x80
P2P: Peer country - hexdump_ascii(len=3):
     58 58 04                                          XX_             
P2P: Own reg_classes 1 peer reg_classes 1 intersection reg_classes 1
P2P: Peer using pushbutton
P2P: own channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: peer channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13
P2P: intersection: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: intersection after no-GO removal: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: intersection with local channel list: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Try to optimize channel selection with peer information received; previously selected op_class 81 channel 1
P2P: Using original operating class and channel (op_class 81 channel 1) from intersection
P2P: State CONNECT -> GO_NEG
P2P: Clear timeout (state=GO_NEG)
P2P: GO Negotiation with ac:a2:13:6e:f8:2f
P2P: Building GO Negotiation Confirm
P2P: * Dialog Token: 1
P2P: * P2P IE header
P2P: * Status: 0
P2P: * Capability dev=25 group=00
P2P: * Operating Channel: Regulatory Class 81 Channel 1
P2P: * Channel List - hexdump(len=16): 43 4e 04 51 0b 01 02 03 04 05 06 07 08 09 0a 0b
P2P: * P2P Group ID 0c:8b:fd:09:10:82
P2P: P2P Group ID SSID - hexdump_ascii(len=9):
     44 49 52 45 43 54 2d 74 67                        DIRECT-tg       
P2P: Sending GO Negotiation Confirm
P2P: Use ongoing radio work for Action frame TX
Off-channel: Send action frame: freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f len=68
nl80211: Send Action frame (ifindex=3, freq=2437 MHz wait=200 ms no_cck=1)
nl80211: Drv Event 60 (NL80211_CMD_FRAME_TX_STATUS) received for wlan0
nl80211: Frame TX status event
nl80211: Action TX status: cookie=0188 (match) (ack=1)
wlan0: Event TX_STATUS (18) received
wlan0: EVENT_TX_STATUS dst=ac:a2:13:6e:f8:2f type=0 stype=13
Off-channel: Delete matching pending action frame
Off-channel: TX status result=0 cb=0x5584d263bc90
P2P: Action frame TX callback (state=4 freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f result=0
P2P: GO Negotiation Confirm TX callback: result=0
wlan0: Radio work 'p2p-send-action'@0x5584d3297360 done in 0.048715 seconds
Off-channel: Action frame sequence done notification
nl80211: Cancel TX frame wait: cookie=0x188
P2P: GO Negotiation with ac:a2:13:6e:f8:2f completed (local end will be GO)
P2P: own channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: peer channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13
P2P: intersection after no-GO removal: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Clear timeout (state=GO_NEG)
P2P: State GO_NEG -> PROVISIONING
P2P-GO-NEG-SUCCESS role=GO freq=2412 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5471-2\x00
Initializing interface 'p2p-wlan0-0' conf 'N/A' driver 'nl80211' ctrl_interface '/run/wpa_supplicant' bridge 'N/A'
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=2 op=0 soft=1 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: interface p2p-wlan0-0 in phy phy0
nl80211: Set mode ifindex 27 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0x5584d3291410
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d3291410 match=0a11
Could not set interface p2p-wlan0-0 flags (UP): Device or resource busy
nl80211: Could not set interface 'p2p-wlan0-0' UP
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=27 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 27 iftype 2 (STATION)
nl80211: Unsubscribe mgmt frames handle 0x8888dd0c5ba19c99 (mode change)
p2p-wlan0-0: Failed to initialize driver interface
Failed to add interface p2p-wlan0-0
p2p-wlan0-0: Cancelling scan request
p2p-wlan0-0: Cancelling authentication timeout
P2P: Failed to create new wpa_supplicant interface
P2P: Removing pending group interface p2p-wlan0-0
nl80211: wpa_driver_nl80211_if_remove(type=3 ifname=p2p-wlan0-0) ifindex=27 added_if=0
nl80211: Remove interface ifindex=27
nl80211: if_indices[16]:
P2P: Group Formation failed with ac:a2:13:6e:f8:2f
P2P: Clear timeout (state=PROVISIONING)
P2P: State PROVISIONING -> IDLE
P2P-GROUP-FORMATION-FAILURE 
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5471-2\x00
P2P: P2P group interface not found
nl80211: Ignore RTM_DELLINK event for foreign ifindex 27
wlan0: Control interface command 'P2P_CONNECT ac:a2:13:6e:f8:2f pbc go_intent=15'
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: Shared frequencies (len=0): valid for P2P
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: P2P: num_unused_channels: 2
P2P: Setup freqs: freq=0 num_MCC=2 shared_freqs=0 num_unused=2
P2P: Current operating channels are not available for P2P. Try to use another channel
P2P: Own frequency preference: 0 MHz
P2P: Create a new interface p2p-wlan0-1 for the group
nl80211: Create interface iftype 9 (P2P_GO)
nl80211: New interface p2p-wlan0-1 created: ifindex=28
nl80211: Set TX rates failed: ret=-100 (Network is down)
P2P: Created pending virtual interface p2p-wlan0-1 addr 0c:8b:fd:09:10:83
P2P: Request to start group negotiation - peer=ac:a2:13:6e:f8:2f  GO Intent=15  Intended Interface Address=0c:8b:fd:09:10:83 wps_method=3 persistent_group=0 p
d_before_go_neg=0 oob_pw_id=0
P2P: Prepare channel - force_freq=0 pref_freq=0 go=1
P2P: Prepare channel best
P2P: Select pre-configured channel as operating channel preference
P2P: prepared channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: after go/cli filter/add: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Own preference for operation channel: Operating Class 81 Channel 1
P2P: * Dialog Token: 2
P2P: * P2P IE header
P2P: * Capability dev=25 group=08
P2P: * GO Intent: Intent 15 Tie breaker 0
P2P: * Configuration Timeout: GO 255 (*10ms)  client 20 (*10ms)
P2P: * Listen Channel: Regulatory Class 81 Channel 1
P2P: * Intended P2P Interface Address 0c:8b:fd:09:10:83
P2P: * Channel List - hexdump(len=16): 43 4e 04 51 0b 01 02 03 04 05 06 07 08 09 0a 0b
P2P: * Device Info
P2P: * Operating Channel: Regulatory Class 81 Channel 1
WPS:  * Version (hardcoded 0x10)
P2P: WPS IE Device Password ID: 4
WPS:  * Version2 (0x20)
P2P: Sending GO Negotiation Request
P2P: State IDLE -> CONNECT
P2P: Schedule new radio work for Action frame TX (listen_freq=-1 send_freq=-1)
wlan0: Add radio work 'p2p-send-action'@0x5584d3297360
wlan0: First radio work item in the queue - schedule start immediately
wlan0: Starting radio work 'p2p-send-action'@0x5584d3297360 after 0.000018 second wait
Off-channel: Send action frame: freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f len=136
nl80211: Send Action frame (ifindex=3, freq=2437 MHz wait=500 ms no_cck=1)
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 28
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 28
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 28
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 28
nl80211: Drv Event 60 (NL80211_CMD_FRAME_TX_STATUS) received for wlan0
nl80211: Frame TX status event
nl80211: Action TX status: cookie=0189 (match) (ack=0)
wlan0: Event TX_STATUS (18) received
wlan0: EVENT_TX_STATUS dst=ac:a2:13:6e:f8:2f type=0 stype=13
Off-channel: Delete matching pending action frame
Off-channel: TX status result=1 cb=0x5584d263bc90
P2P: Action frame TX callback (state=1 freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f result=1
P2P: GO Negotiation Request TX callback: success=0
P2P: State CONNECT -> CONNECT
P2P: Set timeout (state=CONNECT): 0.100000 sec
P2P: Timeout (state=CONNECT)
wlan0: Radio work 'p2p-send-action'@0x5584d3297360 done in 0.118630 seconds
Off-channel: Action frame sequence done notification
nl80211: Cancel TX frame wait: cookie=0x189
P2P: State CONNECT -> CONNECT_LISTEN
P2P: Starting short listen state (state=CONNECT_LISTEN)
WPS:  * Version (hardcoded 0x10)
P2P: WPS IE Device Password ID: 4
WPS:  * UUID-E
WPS:  * Version2 (0x20)
P2P: * P2P IE header
P2P: * Capability dev=25 group=00
P2P: * Device Info
wlan0: Add radio work 'p2p-listen'@0x5584d3297360
wlan0: First radio work item in the queue - schedule start immediately
wlan0: Starting radio work 'p2p-listen'@0x5584d3297360 after 0.000014 second wait
nl80211: Enable Probe Request reporting nl_preq=0x5584d32904a0
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x5584d32904a0 match=
nl80211: Remain-on-channel cookie 0x18a for freq=2412 MHz duration=204
nl80211: Drv Event 55 (NL80211_CMD_REMAIN_ON_CHANNEL) received for wlan0
nl80211: Remain-on-channel event (cancel=0 freq=2412 channel_type=0 duration=204 cookie=0x18a (match))
wlan0: Event REMAIN_ON_CHANNEL (21) received
Off-channel: Send Action callback (without_roc=0 pending_action_tx=(nil) pending_action_tx_done=1)
P2P: Starting Listen timeout(0,204800) on freq=2412 based on callback
P2P: Set timeout (state=CONNECT_LISTEN): 0.224800 sec
nl80211: Drv Event 56 (NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL) received for wlan0
nl80211: Remain-on-channel event (cancel=1 freq=2412 channel_type=0 duration=0 cookie=0x18a (match))
wlan0: Event CANCEL_REMAIN_ON_CHANNEL (22) received
P2P: Cancel remain-on-channel callback (p2p_long_listen=0 ms pending_action_tx=(nil))
wlan0: Radio work 'p2p-listen'@0x5584d3297360 done in 0.204341 seconds
P2P: Driver ended Listen state (freq=2412)
P2P: Skip stop_listen since not in listen_only state.
P2P: Timeout (state=CONNECT_LISTEN)
P2P: State CONNECT_LISTEN -> CONNECT
P2P: * Dialog Token: 2
P2P: * P2P IE header
P2P: * Capability dev=25 group=08
P2P: * GO Intent: Intent 15 Tie breaker 0
P2P: * Configuration Timeout: GO 255 (*10ms)  client 20 (*10ms)
P2P: * Listen Channel: Regulatory Class 81 Channel 1
P2P: * Intended P2P Interface Address 0c:8b:fd:09:10:83
P2P: * Channel List - hexdump(len=16): 43 4e 04 51 0b 01 02 03 04 05 06 07 08 09 0a 0b
P2P: * Device Info
P2P: * Operating Channel: Regulatory Class 81 Channel 1
WPS:  * Version (hardcoded 0x10)
P2P: WPS IE Device Password ID: 4
WPS:  * Version2 (0x20)
P2P: Sending GO Negotiation Request
P2P: State CONNECT -> CONNECT
P2P: Schedule new radio work for Action frame TX (listen_freq=-1 send_freq=-1)
wlan0: Add radio work 'p2p-send-action'@0x5584d3297360
wlan0: First radio work item in the queue - schedule start immediately
wlan0: Starting radio work 'p2p-send-action'@0x5584d3297360 after 0.000010 second wait
Off-channel: Send action frame: freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f len=136
nl80211: Send Action frame (ifindex=3, freq=2437 MHz wait=500 ms no_cck=1)
nl80211: Drv Event 60 (NL80211_CMD_FRAME_TX_STATUS) received for wlan0
nl80211: Frame TX status event
nl80211: Action TX status: cookie=018b (match) (ack=1)
wlan0: Event TX_STATUS (18) received
wlan0: EVENT_TX_STATUS dst=ac:a2:13:6e:f8:2f type=0 stype=13
Off-channel: Delete matching pending action frame
Off-channel: TX status result=0 cb=0x5584d263bc90
P2P: Action frame TX callback (state=1 freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f result=0
P2P: GO Negotiation Request TX callback: success=1
P2P: State CONNECT -> CONNECT
P2P: Set timeout (state=CONNECT): 0.500000 sec
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0
nl80211: RX frame sa=ac:a2:13:6e:f8:2f freq=2437 ssi_signal=-29 stype=13 (WLAN_FC_STYPE_ACTION) len=171
wlan0: Event RX_MGMT (20) received
wlan0: Received Action frame: SA=ac:a2:13:6e:f8:2f Category=4 DataLen=146 freq=2437 MHz
P2P: RX P2P Public Action from ac:a2:13:6e:f8:2f
P2P: Received GO Negotiation Response from ac:a2:13:6e:f8:2f (freq=2437)
P2P: Parsing the received message
P2P: * Dialog Token: 2
P2P: Parsing WPS IE
P2P: Device Password ID: 4
P2P: Parsing P2P IE
P2P: Attribute 0 length 1
P2P: * Status: 0
P2P: Attribute 2 length 2
P2P: * Device Capability 21 Group Capability 00
P2P: Attribute 4 length 1
P2P: * GO Intent: Intent 1 Tie breaker 1
P2P: Attribute 5 length 2
P2P: * Configuration Timeout
P2P: Attribute 9 length 6
P2P: * Intended P2P Interface Address: ac:a2:13:6e:f8:2f
P2P: Attribute 11 length 18
P2P: * Channel List: Country String 'XX(0x04)'
P2P: Attribute 13 length 40
P2P: * Device Info: addr ac:a2:13:6e:f8:2f primary device type 7-0050F204-1 device name 'DONGLE-ACA2136EF82F' config methods 0x80
P2P: Peer country - hexdump_ascii(len=3):
     58 58 04                                          XX_             
P2P: Own reg_classes 1 peer reg_classes 1 intersection reg_classes 1
P2P: Peer using pushbutton
P2P: own channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: peer channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13
P2P: intersection: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: intersection after no-GO removal: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: intersection with local channel list: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Try to optimize channel selection with peer information received; previously selected op_class 81 channel 1
P2P: Using original operating class and channel (op_class 81 channel 1) from intersection
P2P: State CONNECT -> GO_NEG
P2P: Clear timeout (state=GO_NEG)
P2P: GO Negotiation with ac:a2:13:6e:f8:2f
P2P: Building GO Negotiation Confirm
P2P: * Dialog Token: 2
P2P: * P2P IE header
P2P: * Status: 0
P2P: * Capability dev=25 group=00
P2P: * Operating Channel: Regulatory Class 81 Channel 1
P2P: * Channel List - hexdump(len=16): 43 4e 04 51 0b 01 02 03 04 05 06 07 08 09 0a 0b
P2P: * P2P Group ID 0c:8b:fd:09:10:82
P2P: P2P Group ID SSID - hexdump_ascii(len=9):
     44 49 52 45 43 54 2d 79 31                        DIRECT-y1       
P2P: Sending GO Negotiation Confirm
P2P: Use ongoing radio work for Action frame TX
Off-channel: Send action frame: freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f len=68
nl80211: Send Action frame (ifindex=3, freq=2437 MHz wait=200 ms no_cck=1)
nl80211: Drv Event 60 (NL80211_CMD_FRAME_TX_STATUS) received for wlan0
nl80211: Frame TX status event
nl80211: Action TX status: cookie=018c (match) (ack=1)
wlan0: Event TX_STATUS (18) received
wlan0: EVENT_TX_STATUS dst=ac:a2:13:6e:f8:2f type=0 stype=13
Off-channel: Delete matching pending action frame
Off-channel: TX status result=0 cb=0x5584d263bc90
P2P: Action frame TX callback (state=4 freq=2437 dst=ac:a2:13:6e:f8:2f src=0c:8b:fd:09:10:82 bssid=ac:a2:13:6e:f8:2f result=0
P2P: GO Negotiation Confirm TX callback: result=0
wlan0: Radio work 'p2p-send-action'@0x5584d3297360 done in 0.246359 seconds
Off-channel: Action frame sequence done notification
nl80211: Cancel TX frame wait: cookie=0x18c
P2P: GO Negotiation with ac:a2:13:6e:f8:2f completed (local end will be GO)
P2P: own channels: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: peer channels: 81:1,2,3,4,5,6,7,8,9,10,11,12,13
P2P: intersection after no-GO removal: 81:1,2,3,4,5,6,7,8,9,10,11
P2P: Clear timeout (state=GO_NEG)
P2P: State GO_NEG -> PROVISIONING
P2P-GO-NEG-SUCCESS role=GO freq=2412 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5471-2\x00
Initializing interface 'p2p-wlan0-1' conf 'N/A' driver 'nl80211' ctrl_interface '/run/wpa_supplicant' bridge 'N/A'
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=2 op=0 soft=1 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: interface p2p-wlan0-1 in phy phy0
nl80211: Set mode ifindex 28 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0x5584d32730a0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=0801
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x5584d32730a0 match=0a11
Could not set interface p2p-wlan0-1 flags (UP): Device or resource busy
nl80211: Could not set interface 'p2p-wlan0-1' UP
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=28 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 28 iftype 2 (STATION)
nl80211: Unsubscribe mgmt frames handle 0x8888dd0c5bafb829 (mode change)
p2p-wlan0-1: Failed to initialize driver interface
Failed to add interface p2p-wlan0-1
p2p-wlan0-1: Cancelling scan request
p2p-wlan0-1: Cancelling authentication timeout
P2P: Failed to create new wpa_supplicant interface
P2P: Removing pending group interface p2p-wlan0-1
nl80211: wpa_driver_nl80211_if_remove(type=3 ifname=p2p-wlan0-1) ifindex=28 added_if=0
nl80211: Remove interface ifindex=28
nl80211: if_indices[16]:
P2P: Group Formation failed with ac:a2:13:6e:f8:2f
P2P: Clear timeout (state=PROVISIONING)
P2P: State PROVISIONING -> IDLE
P2P-GROUP-FORMATION-FAILURE 
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_5471-2\x00
P2P: P2P group interface not found
nl80211: Ignore RTM_DELLINK event for foreign ifindex 28

也會有 wpa_supplicant & wpa_cli 亂搞一陣以後, 就算停掉再啟動也還是有一樣的問題, 例如 p2p_find 不 work 或是找到一個 device 後就停下來的問題.

將 iwlmvm 這個 kernel module 重新載入後, 很明顯的行為就正常了.

直接建立 p2p group 失敗

wlan0: Control interface command 'P2P_GROUP_ADD'                                                                                                     [283/283]
P2P: Stop any on-going P2P FIND
P2P: Stopping find
P2P: Clear timeout (state=IDLE)
P2P: State IDLE -> IDLE
P2P: Set GO freq 2462 MHz (no preference known)
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: Shared frequencies (len=0): valid for P2P
wlan0: Determining shared radio frequencies (max len 2)
wlan0: Shared frequencies (len=0): completed iteration
wlan0: P2P: num_unused_channels: 2
P2P: Cannot force GO on any of the channels we are already using. Use one of the free channels
P2P: Create a new interface p2p-wlan0-0 for the group
nl80211: Create interface iftype 9 (P2P_GO)
nl80211: New interface p2p-wlan0-0 created: ifindex=17
nl80211: Set TX rates failed: ret=-100 (Network is down)
P2P: Created pending virtual interface p2p-wlan0-0 addr 0c:8b:fd:09:10:83
Initializing interface 'p2p-wlan0-0' conf 'N/A' driver 'nl80211' ctrl_interface '/run/wpa_supplicant' bridge 'N/A'
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=2 type=2 op=0 soft=1 hard=0
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:6
nl80211: Using driver-based off-channel TX
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: interface p2p-wlan0-0 in phy phy0
nl80211: Set mode ifindex 17 iftype 9 (P2P_GO)
nl80211: Set TX rates failed: ret=-100 (Network is down)
nl80211: Setup AP(p2p-wlan0-0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x556067f240a0
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x556067f240a0 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x556067f240a0 match=
netlink: Operstate: ifindex=17 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
nl80211: driver param='use_multi_chan_concurrent=1 use_p2p_group_interface=1'
nl80211: Use separate P2P group interface
Add interface p2p-wlan0-0 to existing radio phy0
nl80211: Regulatory information - country=CN (DFS-FCC)
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 23 mBm
nl80211: 5250-5330 @ 80 MHz 23 mBm (DFS)
nl80211: 5735-5835 @ 80 MHz 30 mBm
nl80211: 57240-59400 @ 2160 MHz 28 mBm
nl80211: 59400-63720 @ 2160 MHz 44 mBm
nl80211: 63720-65880 @ 2160 MHz 28 mBm
nl80211: Added 802.11b mode based on 802.11g information
nl80211: Do not indicate P2P_DEVICE support (p2p_device=1 driver param not specified)
p2p-wlan0-0: Own MAC address: 0c:8b:fd:09:10:83
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=4 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
p2p-wlan0-0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
p2p-wlan0-0: State: DISCONNECTED -> INACTIVE
TDLS: TDLS operation not supported by driver
TDLS: Driver uses internal link setup
p2p-wlan0-0: WPS: UUID from the first interface: 116fb791-645c-5cb8-b97c-37b5d38caa79
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
Using existing control interface directory.
p2p-wlan0-0: Added interface p2p-wlan0-0
p2p-wlan0-0: State: INACTIVE -> DISCONNECTED
nl80211: Set p2p-wlan0-0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=17 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
wlan0: P2P: Use separate group interface p2p-wlan0-0
p2p-wlan0-0: P2P: Starting GO
p2p-wlan0-0: P2P: Request scan (that will be skipped) to start GO)
p2p-wlan0-0: Setting scan request: 0.000000 sec
p2p-wlan0-0: State: DISCONNECTED -> SCANNING
Start a pre-selected network without scan step
Setting up AP (SSID='DIRECT-DP')
nl80211: Setup AP operations for P2P group (GO)
nl80211: Set mode ifindex 17 iftype 9 (P2P_GO)
nl80211: Set TX rates failed: ret=-100 (Network is down)
nl80211: Unsubscribe mgmt frames handle 0x8888dde8ef7ac829 (start AP)
nl80211: Setup AP(p2p-wlan0-0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x556067f48db0
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x556067f48db0 match=
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x556067f48db0 match=
nl80211: Set freq 2462 (ht_enabled=0, vht_enabled=0, bandwidth=0 MHz, cf1=0 MHz, cf2=0 MHz)
P2P: * Capability dev=25 group=c9
P2P: * Device Info
P2P: * P2P IE header
P2P: * Capability dev=25 group=c9
P2P: * Device ID: 0c:8b:fd:09:10:82
P2P: GO - group idle
P2P: * Capability dev=25 group=89
P2P: * Device Info
P2P: * P2P IE header
P2P: * Capability dev=25 group=89
P2P: * Device ID: 0c:8b:fd:09:10:82
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Regulatory information - country=CN (DFS-FCC)
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 23 mBm
nl80211: 5250-5330 @ 80 MHz 23 mBm (DFS)
nl80211: 5735-5835 @ 80 MHz 30 mBm
nl80211: 57240-59400 @ 2160 MHz 28 mBm
nl80211: 59400-63720 @ 2160 MHz 44 mBm
nl80211: 63720-65880 @ 2160 MHz 28 mBm
nl80211: Added 802.11b mode based on 802.11g information
hw vht capab: 0x0, conf vht capab: 0x0
Completing interface initialization
Mode: IEEE 802.11g  Channel: 11  Frequency: 2462 MHz
DFS 0 channels required radar detection
nl80211: Set freq 2462 (ht_enabled=1, vht_enabled=0, bandwidth=20 MHz, cf1=2462 MHz, cf2=0 MHz)
RATE[0] rate=60 flags=0x1
RATE[1] rate=90 flags=0x0
RATE[2] rate=120 flags=0x1
RATE[3] rate=180 flags=0x0
RATE[4] rate=240 flags=0x1
RATE[5] rate=360 flags=0x0
RATE[6] rate=480 flags=0x0
RATE[7] rate=540 flags=0x0
hostapd_setup_bss(hapd=0x556067f48e50 (p2p-wlan0-0), first=1)
p2p-wlan0-0: Flushing old station entries
nl80211: flush -> DEL_STATION p2p-wlan0-0 (all)
nl80211: Station flush failed: ret=-100 (Network is down)
p2p-wlan0-0: Could not connect to kernel driver
p2p-wlan0-0: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=9
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2462
nl80211: send_frame -> send_frame_cmd
nl80211: Frame command failed: ret=-100 (Network is down) (freq=2462 wait=0)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=0)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=1)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=2)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=3)
Using interface p2p-wlan0-0 with hwaddr 0c:8b:fd:09:10:83 and ssid "DIRECT-DP"
WPS: Use configured UUID - hexdump(len=16): 11 6f b7 91 64 5c 5c b8 b9 7c 37 b5 d3 8c aa 79
WPS: Build Beacon IEs
WPS:  * Version (hardcoded 0x10)
WPS:  * Wi-Fi Protected Setup State (2)
WPS:  * Version2 (0x20)
WPS:  * Device Name
WPS:  * Primary Device Type
WPS: Build Probe Response IEs
WPS:  * Version (hardcoded 0x10)
WPS:  * Wi-Fi Protected Setup State (2)
WPS:  * Response Type (3)
WPS:  * UUID-E
WPS:  * Manufacturer
WPS:  * Model Name
WPS:  * Model Number
WPS:  * Serial Number
WPS:  * Primary Device Type
WPS:  * Device Name
WPS:  * Config Methods (2148)
WPS:  * Version2 (0x20)
GMK - hexdump(len=32): [REMOVED]
Key Counter - hexdump(len=32): [REMOVED]
WPA: Delay group state machine start until Beacon frames have been configured
WPS: Building WPS IE for (Re)Association Response
WPS:  * Version (hardcoded 0x10)
WPS:  * Response Type (3)
WPS:  * Version2 (0x20)
P2P: * P2P IE header
nl80211: Set beacon (beacon_set=0)
nl80211: Beacon head - hexdump(len=60): 80 00 00 00 ff ff ff ff ff ff 0c 8b fd 09 10 83 0c 8b fd 09 10 83 00 00 00 00 00 00 00 00 00 00 64 00 11 04 00 09 44 4
9 52 45 43 54 2d 44 50 01 08 8c 12 98 24 b0 48 60 6c 03 01 0b
nl80211: Beacon tail - hexdump(len=188): 2a 01 04 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00 2d 1a 6c 01 17 ff ff 00 00 00 00 00 00 00
00 2c 01 01 00 00 00 00 00 00 00 00 00 00 3d 16 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7f 08 04 00 00 02 00 00 00 40 dd 18 00 50 f2
 02 01 01 80 00 03 a4 00 00 27 a4 00 00 42 43 5d 00 62 32 2e 00 dd 35 00 50 f2 04 10 4a 00 01 10 10 44 00 01 02 10 49 00 06 00 37 2a 00 01 20 10 11 00 0d 54 4
9 2d 53 49 54 41 52 41 2d 50 32 50 10 54 00 08 00 01 00 50 f2 04 00 01 dd 12 50 6f 9a 09 02 02 00 25 89 03 06 00 0c 8b fd 09 10 82
nl80211: ifindex=17
nl80211: beacon_int=100
nl80211: dtim_period=2
nl80211: ssid - hexdump_ascii(len=9):
     44 49 52 45 43 54 2d 44 50                        DIRECT-DP
nl80211: hidden SSID not in use
nl80211: privacy=1
nl80211: auth_algs=0x1
nl80211: wpa_version=0x2
nl80211: key_mgmt_suites=0x2
nl80211: pairwise_ciphers=0x10
nl80211: group_cipher=0x10
nl80211: beacon_ies - hexdump(len=85): 7f 08 04 00 00 02 00 00 00 40 dd 35 00 50 f2 04 10 4a 00 01 10 10 44 00 01 02 10 49 00 06 00 37 2a 00 01 20 10 11 00 0d
 54 49 2d 53 49 54 41 52 41 2d 50 32 50 10 54 00 08 00 01 00 50 f2 04 00 01 dd 12 50 6f 9a 09 02 02 00 25 89 03 06 00 0c 8b fd 09 10 82
nl80211: proberesp_ies - hexdump(len=164): 7f 08 04 00 00 02 00 00 00 40 dd 68 00 50 f2 04 10 4a 00 01 10 10 44 00 01 02 10 3b 00 01 03 10 47 00 10 11 6f b7 9
1 64 5c 5c b8 b9 7c 37 b5 d3 8c aa 79 10 21 00 01 20 10 23 00 01 20 10 24 00 01 20 10 42 00 01 20 10 54 00 08 00 01 00 50 f2 04 00 01 10 11 00 0d 54 49 2d 53
49 54 41 52 41 2d 50 32 50 10 08 00 02 21 48 10 49 00 06 00 37 2a 00 01 20 dd 2e 50 6f 9a 09 02 02 00 25 89 0d 22 00 0c 8b fd 09 10 82 01 08 00 01 00 50 f2 04
 00 01 00 10 11 00 0d 54 49 2d 53 49 54 41 52 41 2d 50 32 50
nl80211: assocresp_ies - hexdump(len=42): 7f 08 04 00 00 02 00 00 00 40 dd 18 00 50 f2 04 10 4a 00 01 10 10 3b 00 01 03 10 49 00 06 00 37 2a 00 01 20 dd 04 50
 6f 9a 09
nl80211: Beacon set failed: -100 (Network is down)
Failed to set beacon parameters
p2p-wlan0-0: Flushing old station entries
nl80211: flush -> DEL_STATION p2p-wlan0-0 (all)
nl80211: Station flush failed: ret=-100 (Network is down)
p2p-wlan0-0: Could not connect to kernel driver
p2p-wlan0-0: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=9
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2462
nl80211: send_frame -> send_frame_cmd
nl80211: Frame command failed: ret=-100 (Network is down) (freq=2462 wait=0)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=0)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=1)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=2)
wpa_driver_nl80211_set_key: ifindex=17 (p2p-wlan0-0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-100 Network is down)
Failed to clear default encryption keys (ifname=p2p-wlan0-0 keyidx=3)
hostapd_free_hapd_data(p2p-wlan0-0)
WPS: Clear NFC Tag context 0x556067f49ba0
Interface initialization failed
p2p-wlan0-0: interface state UNINITIALIZED->DISABLED
p2p-wlan0-0: AP-DISABLED
p2p-wlan0-0: Unable to setup interface.
Failed to initialize AP interface
hostapd_interface_deinit(0x556067f48050)
hostapd_bss_deinit: deinit bss p2p-wlan0-0
p2p-wlan0-0: Deauthenticate all stations
nl80211: send_mlme - da= ff:ff:ff:ff:ff:ff noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=9
nl80211: send_mlme -> send_frame
nl80211: send_frame - Use bss->freq=2462
nl80211: send_frame -> send_frame_cmd
nl80211: Frame command failed: ret=-100 (Network is down) (freq=2462 wait=0)
hostapd_cleanup(hapd=0x556067f48e50 (p2p-wlan0-0))
hostapd_free_hapd_data: Interface p2p-wlan0-0 wasn't started
hostapd_interface_free(0x556067f48050)
hostapd_interface_free: free hapd 0x556067f48e50
hostapd_cleanup_iface(0x556067f48050)
hostapd_cleanup_iface_partial(0x556067f48050)
hostapd_cleanup_iface: free iface=0x556067f48050
nl80211: Remove beacon (ifindex=17)
p2p-wlan0-0: State: SCANNING -> DISCONNECTED
nl80211: Set p2p-wlan0-0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=17 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
RTM_NEWLINK: ifi_index=17 ifname=p2p-wlan0-0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 ()
nl80211: Interface down
p2p-wlan0-0: Event INTERFACE_DISABLED (29) received
p2p-wlan0-0: Interface was disabled
P2P-GROUP-REMOVED p2p-wlan0-0 GO reason=REQUESTED
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_3055-2\x00
P2P: Remove group interface p2p-wlan0-0
p2p-wlan0-0: Removing interface p2p-wlan0-0
p2p-wlan0-0: Request to deauthenticate - bssid=0c:8b:fd:09:10:83 pending_bssid=00:00:00:00:00:00 reason=3 state=DISCONNECTED
TDLS: Tear down peers
wpa_driver_nl80211_deauthenticate(addr=0c:8b:fd:09:10:83 reason_code=3)
p2p-wlan0-0: nl80211: MLME command failed: reason=3 ret=-100 (Network is down)
p2p-wlan0-0: Event DEAUTH (12) received
p2p-wlan0-0: Deauthentication notification
p2p-wlan0-0:  * reason 3 (locally generated)
Deauthentication frame IE(s) - hexdump(len=0): [NULL]
p2p-wlan0-0: CTRL-EVENT-DISCONNECTED bssid=0c:8b:fd:09:10:83 reason=3 locally_generated=1
p2p-wlan0-0: Auto connect disabled: do not try to re-connect
TDLS: Remove peers on disassociation
p2p-wlan0-0: Disconnect event - remove keys
p2p-wlan0-0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set p2p-wlan0-0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=17 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
EAPOL: External notification - EAP success=0
p2p-wlan0-0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set p2p-wlan0-0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=17 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
p2p-wlan0-0: Cancelling delayed sched scan
p2p-wlan0-0: Cancelling scan request
p2p-wlan0-0: Cancelling authentication timeout
Remove interface p2p-wlan0-0 from radio phy0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=17)
netlink: Operstate: ifindex=17 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 17 iftype 2 (STATION)
nl80211: Teardown AP(p2p-wlan0-0) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0x8888dde8ef7c0539 (AP teardown)
Control interface directory not empty - leaving it behind
nl80211: wpa_driver_nl80211_if_remove(type=3 ifname=p2p-wlan0-0) ifindex=17 added_if=0
nl80211: Remove interface ifindex=17
nl80211: if_indices[16]:
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 17
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 17
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 17
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 17
nl80211: Ignore RTM_NEWLINK event for foreign ifindex 17
nl80211: Ignore RTM_DELLINK event for foreign ifindex 17

Dongle 似乎不想當 go

> p2p_find 
OK
<3>CTRL-EVENT-SCAN-STARTED 
<3>P2P-DEVICE-FOUND ac:a2:13:6e:f8:2f p2p_dev_addr=ac:a2:13:6e:f8:2f pri_dev_type=7-0050F204-1 name='DONGLE-ACA2136EF82F' config_methods=0x80 dev_capab=0x21 group_capab=0x0 wfd_dev_info=0x01111c440032
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED                                                    
<3>CTRL-EVENT-SCAN-STARTED p_stop_find                                        
> p2p_stop_find                                                               
OK
<3>P2P-FIND-STOPPED 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=0
OK
<3>P2P-GO-NEG-SUCCESS role=client freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=0
OK
<3>P2P-GO-NEG-SUCCESS role=client freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=0
OK
> status 
wpa_state=DISCONNECTED
p2p_device_address=0c:8b:fd:09:10:82
address=0c:8b:fd:09:10:82
uuid=116fb791-645c-5cb8-b97c-37b5d38caa79
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=0
OK
<3>P2P-GO-NEG-SUCCESS role=client freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=0
OK
<3>P2P-GO-NEG-SUCCESS role=client freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC

在 go_intent<15 的情況似乎都連不上 dongle

> p2p_find 
OK
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>P2P-DEVICE-FOUND ac:a2:13:6e:f8:2f p2p_dev_addr=ac:a2:13:6e:f8:2f pri_dev_type=7-0050F204-1 name='DONGLE-ACA2136EF82F' config_methods=0x80 dev_capab=0x21 group_capab=0x0 wfd_dev_info=0x01111c440032
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED 
<3>CTRL-EVENT-SCAN-STARTED us                                                 
<3>CTRL-EVENT-SCAN-STARTED p_stop_find                                        
<3>CTRL-EVENT-SCAN-STARTED p_stop_find 
> p2p_stop_find                                                               
OK
<3>P2P-FIND-STOPPED 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=7
OK
<3>P2P-GO-NEG-SUCCESS role=GO freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=7
OK
<3>P2P-GO-NEG-SUCCESS role=GO freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 
> p2p_connect ac:a2:13:6e:f8:2f pbc go_intent=7
OK
<3>P2P-GO-NEG-SUCCESS role=GO freq=2462 ht40=1 peer_dev=ac:a2:13:6e:f8:2f peer_iface=ac:a2:13:6e:f8:2f wps_method=PBC
<3>P2P-GROUP-FORMATION-FAILURE 

額外建立一個 p2p0, 配合二個 config file

# wpa.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=0
device_name=TI-SITARA-P2P
device_type=1-0050F204-1
config_methods=virtual_push_button physical_display keypad
p2p_go_intent=0
country=CN
driver_param=use_multi_chan_concurrent=1 use_p2p_group_interface=1
p2p_go_max_inactivity=60
p2p_go_ht40=1
disassoc_low_ack=1
#p2p_multi_chan=1
#concurrent_sched_scan=1
# p2p.conf
ctrl_interface=/run/wpa_supplicant2
update_config=1

p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1

p2p_go_ht40=1
$ sudo rfkill list
[sudo] password for derekdai: 
0: acer-wireless: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
1: acer-bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: no
2: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: yes
derekdai at dd-laptop in ~
$ sudo rfkill unblock 0
derekdai at dd-laptop in ~
$ sudo rfkill unblock 2
$ sudo wpa_supplicant -ddt -ip2p0 -Dnl80211 -cp2p.conf -N -iwlan0 -Dnl80211 -cwpa.conf
$ sudo wpa_cli -ip2p0
> p2p_group_add 
OK
<3>P2P-GROUP-REMOVED p2p-p2p0-0 GO reason=REQUESTED
1469520462.196455: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.197849: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.197956: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.197962: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.198605: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.208679: nl80211: Ignore RTM_NEWLINK event for foreign ifindex 12
1469520462.323877: nl80211: Ignore RTM_DELLINK event for foreign ifindex 12

完整連線流程

hostapd

Issues

Links

WiFi-Direct

WLAN tracing

$ sudo systemctl stop wpa_supplicant
$ sudo rfkill list
0: phy0: Wireless LAN
	Soft blocked: yes
	Hard blocked: yes
1: acer-wireless: Wireless LAN
	Soft blocked: yes
	Hard blocked: no
2: acer-bluetooth: Bluetooth
	Soft blocked: yes
	Hard blocked: no
$ sudo rfkill unblock 0
$ sudo rfkill unblock 1
$ sudo iw phy phy0 interface add wmon0 type monitor flags none
# change the MAC address of wmon0 or kernel will report error below while bringing up wmon0 or other dev(s) which are runing on the same phy
# RTNETLINK answers: Name not unique on network
$ sudo ip link set wmon0 address 0c:8b:fd:09:10:91
$ sudo ip link set wmon0 up
$ sudo iw dev wmon0 del

不知從哪來的 wpa_supplicant -m 參數

例如這頁
https://github.com/avrahamcohen/WiFi-Direct-Configuration-for-Linux/blob/master/start.sh

通常用在手工建了 p2p0 時指定第二個 config 給 wpa_supplicant 時用.

WiFi Direct 跟 Ad Hoc 的差異在哪?

前者能跟 Station mode 共存, 後者與 AP 的連線會終止.