Wi-Fi direct 连接步骤

Wi-Fi direct

Wi-Fi direct is a wireless standard that allows devices to connect with each other without requiring a wireless access point. Wi-Fi Direct negotiates the link with a Wi-Fi Protected Setup (WPS) system that assigns each device a limited wireless access point.

Establishing a peer-to-peer (P2P) link has the following phases:

  • P2P discovery, which allows to search for P2P devices in the vicinity
  • P2P group formation, a P2P group is formed with the identification of one of the devices as group owner. A device can either become group owner (GO) autonomously if configured to do so or it can be negotiated between devices with the exchange of GO intents.
  • P2P provisioning, which authenticates the link by using either Push Button Configuration (PBC) or PIN authentication.
  • P2P connection, when the connection between a Group Owner (GO) and a Group Client (GC) is actually established.

The QCA6564 driver on load creates a p2p0 interface that is used by the wpa supplicant for P2P group formation. Once a group is formed, virtual p2p-p2p0-N interfaces are created, where N is an index starting at 0. These virtual interfaces are then used for provisioning.

Note Remember:

  • Group additions, find and connect operations happen on the p2p0 interface
  • Provisioning happens on the virtual p2p-p2p0-N interfaces

By default the Wi-Fi Direct functionality in the ConnectCore 6UL is disabled. To enable it, configure your Digi Embedded Yocto project by adding the following lines to your conf/local.conf file:

WLAN_P2P_INTERFACE = "p2p0"                                                        
WLAN_P2P_AUTO = "1" 

The above will configure the /etc/network/interfaces file with a p2p0 interface and will start a wpa-supplicant instance with a default /etc/wpa_supplicant_p2p.conf configuration file.

ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=ccimx6ul-p2p
manufacturer=QCA
model_name=McK
device_type=1-0050F204-1
config_methods=display keypad push_button
persistent_reconnect=1

The following examples will use two ConnectCore 6UL devices to establish P2P connections. For more information about the wpa-supplicant P2P specific commands refer to this document.

Autonomous GO creation

Create Autonomous Group Owner (GO) and join using PBC method

Peer (GO) ---- PBC --- Peer (GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_group_add

3

p2p_find

4

p2p_connect <CC6UL1_go_mac_addr> pbc join

5

Ctrl-c to exit

Ctrl-c to exit

6

wpa_cli -i p2p-p2p0-0 wps_pbc

7

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

8

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

Create Autonomous GO and join using PIN from GO

Peer (GO) ---- PIN --- Peer (GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_group_add

3

p2p_find

4

Ctrl-c to exit

5

wpa_cli -ip2p-p2p0-0 wps_pin any (shows <pin>)

6

p2p_connect <cc6ul_go_mac_addr> <pin> join

7

Ctrl-c to exit

8

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

9

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

Create Autonomous GO and join using PIN from GC

Peer (GO) ---- PIN --- Peer (GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_group_add

3

p2p_find

4

p2p_connect <cc6ul_go_mac_addr> pin join (shows <pin>)

5

Ctrl-c to exit

Ctrl-c to exit

6

wpa_cli -ip2p-p2p0-0 wps_pin any <pin>

7

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

8

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

Create Autonomous GO and invite GC using PBC

Peer (GO) ---- PBC --- Peer (GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_group_add

3

p2p_find

4

p2p_invite group=p2p-p2p0-0 peer=<CC6UL2_mac_addr>

5

p2p_connect <CC6UL1_go_mac_addr> pbc join

6

Ctrl-c to exit

Ctrl-c to exit

7

wpa_cli -i p2p-p2p0-0 wps_pbc

8

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

9

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

Negotiated GO

Negotiate GO and join using PIN

Peer (GO | GC) ---- PIN --- Peer (GO | GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_find

3

p2p_find

4

p2p_connect <CC6UL2_go_mac_addr> pin go_intent=1

5

p2p_connect <CC6UL1_go_mac_addr> <pin> go_intent=15

6

Ctrl-c to exit

Ctrl-c to exit

7

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

8

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

Negotiate GO and join using PBC

Peer (GO | GC) ---- PBC --- Peer (GO | GC)

Steps

Peer 1

Peer 2

1

wpa_cli -ip2p0

wpa_cli -ip2p0

2

p2p_find

3

p2p_find

4

p2p_connect <CC6UL2_go_mac_addr> pbc go_intent=1

5

p2p_connect <CC6UL1_go_mac_addr> pbc go_intent=14

6

Ctrl-c to exit

Ctrl-c to exit

7

ifconfig p2p-p2p0-0 <CC6UL1_ip_addr>

ifconfig p2p-p2p0-0 <CC6UL2_ip_addr>

8

ping <CC6UL2_ip_addr>

ping <CC6UL1_ip_addr>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值