wifi p2p 调试

调试p2p功能之前,需要驱动打开p2p的支持,可以用ifconfig -a指令查看是否存在p2p网络节点

1、查看网络节点

341.68< ifconfig -a

341.71> ifconfig -a

341.95> carplay0 Link encap:Ethernet HWaddr DE:8A:1E:E6:91:9F

341.95> BROADCAST MULTICAST MTU:1500 Metric:1

341.95> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.95> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.95> collisions:0 txqueuelen:1000

341.95> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

341.95>

341.95> eth0 Link encap:Ethernet HWaddr DE:F0:8D:8F:D1:B1

341.95> BROADCAST MULTICAST MTU:1500 Metric:1

341.95> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.95> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.96> collisions:0 txqueuelen:1000

341.96> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

341.96> Interrupt:114

341.96>

341.96> lo Link encap:Local Loopback

341.96> inet addr:127.0.0.1 Mask:255.0.0.0

341.96> inet6 addr: ::1%4812464/128 Scope:Host

341.96> UP LOOPBACK RUNNING MTU:65536 Metric:1

341.96> RX packets:21 errors:0 dropped:0 overruns:0 frame:0

341.96> TX packets:21 errors:0 dropped:0 overruns:0 carrier:0

341.96> collisions:0 txqueuelen:1000

341.96> RX bytes:1747 (1.7 KiB) TX bytes:1747 (1.7 KiB)

341.96>

341.96> mlan0 Link encap:Ethernet HWaddr 8C:45:00:04:02:93

341.96> inet addr:192.168.0.22 Bcast:192.168.0.255 Mask:255.255.255.0

341.96> UP BROADCAST MULTICAST MTU:1500 Metric:1

341.96> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.96> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.96> collisions:0 txqueuelen:1000

341.96> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

341.96>

341.96> uap0 Link encap:Ethernet HWaddr 8C:45:00:04:03:93

341.96> BROADCAST MULTICAST MTU:1500 Metric:1

341.96> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.96> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.96> collisions:0 txqueuelen:1000

341.96> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

341.96>

341.96> uap1 Link encap:Ethernet HWaddr 8C:45:00:04:04:93

341.96> BROADCAST MULTICAST MTU:1500 Metric:1

341.96> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.96> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.96> collisions:0 txqueuelen:1000

341.96> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

341.96>

341.96> wfd0 Link encap:Ethernet HWaddr 8E:45:00:04:02:93

341.98> BROADCAST MULTICAST MTU:1500 Metric:1

341.98> RX packets:0 errors:0 dropped:0 overruns:0 frame:0

341.98> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

341.98> collisions:0 txqueuelen:1000

341.98> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

2、启动wpa_supplicant (同时启动wifi p2p和sta)

448.95< wpa_supplicant -iwfd0 -Dnl80211 -c/home/root/p2p.conf -N -imlan0 -c/home/root/test.conf -B

448.98> wpa_supplicant -iwfd0 -Dnl80211 -c/home/root/p2p.conf -N -imlan0 -c/home/root/test.conf -B

449.07> Successfully initialized wpa_supplicant

449.07> [ 96.835531] get_channel when STA is not connected

449.07> [ 96.841396] get_channel when STA is not connected

449.09> [ 96.847810] cyttsp6_i2c_adapter 2-0024: _cyttsp6_watchdog_work: device found in bootloader mode

449.09> [ 96.857353] get_channel when STA is not connected

449.09> [ 96.862738] get_channel when STA is not connected

449.09> [ 96.870589] get_channel when STA is not connected

449.15> [ 96.915558] get_channel when STA is not connected

449.15> [ 96.922189] get_channel when STA is not connected

449.15> [ 96.928465] get_channel when STA is not connected

449.15> [ 96.933730] get_channel when STA is not connected

449.15> [ 96.940273] get_channel when STA is not connected

3、启动wap_cli工具

541.56< wpa_cli -iwfd0

541.59> wpa_cli -iwfd0

541.62> wpa_cli v2.6

541.64> Copyright (c) 2004-2016, Jouni Malinen and contributors

541.64> This software may be distributed under the terms of the BSD license.

541.64> See README for more details.

541.64> Interactive mode

4、p2p测试

625.60< p2p_find 10

625.62> p2p_find 10

625.62> > OK

625.64> > > [ 273.425512] wlan: wfd0 START SCAN

2265.62> > <3>P2P-DEVICE-FOUND b6:c4:fc:e0:bf:d0 p2p_dev_addr=b6:c4:fc:e0:bf:d0 pri_dev_type=10-0050F204-5 name='Redmi' config_methods=0x188 dev_capab=0x25 group_capab=0x0 new=1

2446.48< p2p_peers

2446.50> p2p_peers

2446.50> b6:c4:fc:e0:bf:d0

2767.07< p2p_connect b6:c4:fc:e0:bf:d0 pbc (需要打开车机的热点)

2459.18< p2p_connect 2e:0e:3d:4d:90:e7 pbc

2459.21> p2p_connect 2e:0e:3d:4d:90:e7 pbc

2459.23> OK

2459.23> > > [ 124.596059] wlan: TX P2P Group Owner Negotiation Req Frame, channel=1

2459.65> [ 125.033239] wlan: TX P2P Group Owner Negotiation Req Frame, channel=1

...

2464.21> [ 129.588162] wlan: RX P2P Group Owner Negotiation Req Frame, channel=1

...

2464.60> > <3>CTRL-EVENT-CONNECTED - Connection to 8e:45:00:04:02:93 completed [id=0 id_str=]

2464.60> > <3>WPS-PBC-ACTIVE

2464.26> [ 129.595560] wlan: TX P2P Group Owner Negotiation Rsp Frame, channel=1

...

2465.81> > <3>WPS-REG-SUCCESS 2e:0e:3d:4d:10:e7 70fe8410-3499-5d77-9007-86190cba6220

2465.84> > <3>P2P-GROUP-FORMATION-SUCCESS

2465.84> > <3>P2P-GROUP-STARTED wfd0 GO ssid="DIRECT-J4" freq=5240 passphrase="gHyeDd38" go_dev_addr=8e:45:00:04:02:93

2465.84> > <3>WPS-PBC-DISABLE

2465.84> > <3>WPS-SUCCESS