本文主要是介绍Miracast(二)wpa_supplicant的移植和使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、libnl移植
1、tar zxvf libnl-1.1.4.tar.gz
2、cd libnl-1.1.4
3、mkdir install
4、./configure --prefix=$(pwd)/install --enable-shared --enable-static
5、make CC=/opt/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
6、make install
二、openssl移植
1、cd openssl-1.1.0j
2、mkdir install
3、./config no-asm shared --prefix=$(pwd)/install
4、修改Makefile:
CC= /home/public/zx902/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc
删除 CFLAG= 中的-m64
删除 LIB_LDFLAGS= 中的-m64
AR= /home/public/zx902/arm-linux-gnueabi/bin/arm-linux-gnueabi-ar $(ARFLAGS) r
RANLIB= /home/public/zx902/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib
NM= /home/public/zx902/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm
SHARED_LDFLAGS=
5、make
6、make install
三、wpa_supplicant移植
1、tar -zxvf wpa_supplicant-2.6.tar.gz
2、cd wpa_supplicant-2.6/wpa_supplicant/
3、cp defconfig .config
4、修改.config
增加
CONFIG_P2P=y
CONFIG_WIFI_DISPLAY=y
5、修改Makefile
增加下面4项
6、make CC=/opt/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
提示错误:
方法:修改.config
CONFIG_NO_WPA_PASSPHRASE=y
Wpa_supplicant说明:
一、两个p2p设备,互相没有连接记录:
1、启动wpa_cli---------./wpa_cli -ip2p-dev-wlan0,注意p2p-dev-wlan0在/var/run/wpa_supplicant/下
2、设置wifi p2p
set config_methods 80 设置wps模式为pushbutton
3、搜索设备,手机端也要进行搜索:
p2p_find
搜索结果:
<3>P2P-DEVICE-FOUND 3e:cd:5d:eb:4a:ab p2p_dev_addr=3e:cd:5d:eb:4a:ab pri_dev_type=10-0050F204-5 name='HUAWEI Mate 10' config_methods=0x188 dev_capab=0x25 group_capab=0x0 vendor_elems=1 new=0
4、(1)开发板连接手机:
p2p_connect 3e:cd:5d:eb:4a:ab pbc
手机端跳出是否连接,选择连接
<3>P2P-GO-NEG-SUCCESS role=client freq=5765 ht40=0 peer_dev=3e:cd:5d:eb:4a:ab peer_iface=3e:cd:5d:eb:ca:ab wps_method=PBC
<3>P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-STARTED p2p-wlan0-0 client ssid="DIRECT-YG-HUAWEI Mate 10 " freq=5765 psk=1bba787373289e71faf7a73a03bc85bef3839eb6f1432be3761ddd307eb75fda go_dev_addr=3e:cd:5d:eb:4a:ab [PERSISTENT]
(2)手机连接开发板
wps_pbc 3e:cd:5d:eb:4a:ab
p2p_connect 3e:cd:5d:eb:4a:ab pbc
<3>P2P-GO-NEG-SUCCESS role=client freq=5765 ht40=0 peer_dev=3e:cd:5d:eb:4a:ab peer_iface=3e:cd:5d:eb:ca:ab wps_method=PBC
<3>P2P-GROUP-FORMATION-SUCCESS
<3>P2P-GROUP-STARTED p2p-wlan0-0 client ssid="DIRECT-f4-HUAWEI Mate 10 " freq=5765 psk=47bf878f77f8ab01beb9583d7272f0c43b79b80aeeaa8d4440260cb67a945578 go_dev_addr=3e:cd:5d:eb:4a:ab [PERSISTENT]
5、断开连接
(1)手机断开连接
<3>P2P-GROUP-REMOVED p2p-wlan0-0 client reason=GO_ENDING_SESSION
(2)开发板断开连接
p2p_group_remove p2p-wlan0-0
<3>P2P-GROUP-REMOVED p2p-wlan0-0 client reason=REQUESTED
二、手机和开发板都有连接记录
1、检测是否存在连接记录
List_network
2、收到连接请求时,直接调用
p2p_invite persistent=1 peer=3e:cd:5d:eb:4a:ab
log:
<3>P2P-INVITATION-RESULT status=0 3e:cd:5d:eb:ca:ab
<3>P2P-GROUP-STARTED p2p-wlan0-7 client ssid="DIRECT-sJ-HUAWEI Mate 10 " freq=5785 psk=572a48088ce2453edbe0ba5672187f954ac2eb6b64e459b15d7490deaef7c36f go_dev_addr=3e:cd:5d:eb:4a:ab [PERSISTENT]
这篇关于Miracast(二)wpa_supplicant的移植和使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!