简体   繁体   English

在 Android 和 Raspberry Pi 3 Linux 之间建立 Wifi-Direct 连接

[英]Set up a Wifi-Direct connection between Android and Raspberry Pi 3 Linux

I want to connect two devices using Wifi-Direct.我想使用 Wifi-Direct 连接两个设备。 One is a RaspBerry PI 3 (with Raspbian Jessie), the other is an Android smartphone.一个是 RaspBerry PI 3(带有 Raspbian Jessie),另一个是 Android 智能手机。 Raspberry as server and Android as client. Raspberry 作为服务器,Android 作为客户端。

I decided to use wpa_supplicant in Raspbian and the WifiDirect example app for Android:我决定在 Raspbian 中使用 wpa_supplicant 和 Android 的 WifiDirect 示例应用程序:

https://developer.android.com/guide/topics/connectivity/wifip2p.html https://developer.android.com/guide/topics/connectivity/wifip2p.html

My wpa_supplicant.conf contains:我的 wpa_supplicant.conf 包含:

ctrl_interface=/var/run/wpa_supplicant
update_config=1 
device_name=raspberry
device_type=1-0050F204-1
driver_param=use_p2p_group_interface=1
p2p_go_intent=1
p2p_go_ht40=1

I am following this steps:我正在按照以下步骤操作:

1) In the raspberry pi: 1)在树莓派中:

sudo wpa_supplicant  -B -iwlan0 -Dnl80211 -c/etc/wpa_supplicant.conf
sudo wpa_cli -iwlan0 p2p_group_add
ifconfig p2p-wlan0-0 192.168.1.2
wpa_cli -ip2p-wlan0-0 wps_pbc

2) Then in the Android app, I can see the raspberry as a peer but I get a connection failure. 2)然后在Android应用程序中,我可以将树莓派视为对等点,但连接失败。 I try with the settings app ( Wifi => Advanced => Wifi Direct ) and I can see the raspberry as a peer too but the diference is that when I try to make the connection, the application request me a PIN code and I am able to make the connection if I introduce the pin returned by p2p_pin any in the raspberry.我尝试使用设置应用程序( Wifi => Advanced => Wifi Direct ),我也可以将覆盆子视为对等体,但不同之处在于,当我尝试建立连接时,应用程序会要求我输入 PIN 码,我可以如果我在树莓中引入 p2p_pin any 返回的引脚,则建立连接。

Im trying to understand this behavior:我试图理解这种行为:

Why is requesting me a PIN?为什么要我输入 PIN 码? This is the reason why I am not able to make the connection through the WifiDirect example app?这就是我无法通过 WifiDirect 示例应用程序建立连接的原因? Im missing something here?我在这里遗漏了什么?

Thank you.谢谢。

Where you have:你有:

wpa_cli -ip2p-wlan0-0 wps_pbc

use:用:

sudo wpa_cli -ip2p-wlan0-0 wps_pin any 12345670

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM