支持WiFi直接在软糖,WPA请求者搞砸 [英] WiFi-Direct on JellyBean, WPA Supplicant messed up

查看:1963
本文介绍了支持WiFi直接在软糖,WPA请求者搞砸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以几个月前我已经开始开发一些WiFi的直接应用。前几天,我更新了我的两个Galaxy Nexus的到果冻豆(4.1.x版)和测试我的应用程序,但似乎有什么东西搞砸了一次。它已经在一个痛苦的屁股让主功能集上ICS,但现在它不再工作了。

so a couple of months ago I've started developing some WiFi-Direct applications. A few days ago, I updated both of my Galaxy Nexus to Jelly Bean (4.1.x) and tested my applications, but it seems like there's something messed up again.. It was already a pain in the ass to get the main functionality set up on ICS, but now it does not work anymore.

我得到的是这样的事情在我的logcat:

All i get is something like this in my logcat:

/wpa_supplicant(  392): p2p0: P2P-PROV-DISC-PBC-REQ a2:0b:ba:xy:zz:xx p2p_dev_addr=a2:0b:ba:xy:zz:xx pri_dev_type=10-0050F204-x name='Android_e9f0' config_methods=0x188 dev_capab=0x27 group_capab=0x0
I/wpa_supplicant(  392): p2p0: P2P-DEVICE-FOUND a2:0b:ba:xy:zz:xx p2p_dev_addr=a2:0b:ba:xy:zz:xx pri_dev_type=10-0050F204-5 name='Android_e9f0' config_methods=0x188 dev_capab=0x27 group_capab=0x0
I/wpa_supplicant(  392): p2p0: P2P-GO-NEG-REQUEST a2:0b:ba:xx:zz:xy dev_passwd_id=4
I/wpa_supplicant(  392): p2p0: P2P-FIND-STOPPED 
I/wpa_supplicant(  392): p2p0: P2P-GO-NEG-FAILURE status=7
W/Netd    (  120): No subsystem found in netlink event
D/NetlinkEvent(  120): Unexpected netlink message. type=0x11
I/wpa_supplicant(  392): p2p0: P2P-DEVICE-LOST p2p_dev_addr=a2:0b:ba:xx:zz:xy
I/wpa_supplicant(  392): p2p0: P2P-DEVICE-FOUND a2:0b:ba:xx:zz:xy p2p_dev_addr=a2:0b:ba:xx:zz:xy pri_dev_type=10-0050F204-5 name='Android_e9f0' config_methods=0x188 dev_capab=0x27 group_capab=0x0

在邀请对话正确弹出的第二个电话,和有时(随机),它甚至可以,但只能在每个第五次尝试什么的。所以logcat的告诉我,因为我不是专业人士,Android的实习生codeS,那只是谈判失败,该设备会丢失了片刻,然后被再次发现,似乎都有点乱了。

The "Invitation dialog" pops up correctly at the second phone, and "sometimes" (random) it even works, but only in every fifth try or something. So the logcat tells me, as I'm no professional with android-intern codes, that the negotiation simply fails, the device gets lost for a brief moment, and is then discovered again, seems all kinda messed up.

我的邀请被发送出去这样的:

My invitation is sent out like this:

public void onPeersAvailable(WifiP2pDeviceList peers) {
    if (isInvitationSent)
        return;
    for (WifiP2pDevice dev : peers.getDeviceList()) {
        WifiP2pConfig c = new WifiP2pConfig();
        c.deviceAddress = dev.deviceAddress;
        c.wps.setup = WpsInfo.PBC;

        if (initiator
                && !isInvitationSent
                && WiFiSupport.compareMacAddressesInsensitive(MAC_ADDRESS,
                        dev.deviceAddress)) {
            isInvitationSent = true;
            sendInvitation(c);
        }
    }
}

private void sendInvitation(final WifiP2pConfig config) {
    log("Sending invitation to " + config.deviceAddress);
    mWifiManager.connect(mChannel, config, new ActionListener() {
        @Override
        public void onSuccess() {
            log("Invitation sent!");
        }

        @Override
        public void onFailure(int reason) {
            log("Invitation failed!");
            Toast.makeText(getApplicationContext(), "Could not connect to peer, reason:"+reason, Toast.LENGTH_LONG).show();
            if (!retryChannel) {
                log("Retrying to send invitation.");
                retryChannel = true;
                sendInvitation(config);
            }
        }
    });
}

很多的无线直接在Android上我已经知道,它一直工作正常,直到我更新了手机的果冻豆..任何人都知道,这可能是错的?如果您需要更多code样品或的code任何特定的部分,只是告诉我,因为我不知道这可能是可靠的这一点。

I've read a lot on wifi direct on android, and it's been working fine until I updated the phones to jelly bean.. anyone knows, what could be wrong? If you need more code samples or any specific part of the code, just tell me, as I don't know what could be reliable for this.

感谢您的帮助。

编辑:

改变了WifiP2pConfig.wps.setup法显示,这就造成了设备#1显示PIN code,设备#2弹出一个对话框,输入字段 - 输入正确的PIN后,这就是logcat的告诉我:

Changed the WifiP2pConfig.wps.setup method to "display", which resulted in device #1 displaying a PIN code, device #2 popping up a dialog with an input field - after entering the correct pin this is what logcat told me:

08-31 15:13:28.241: I/wpa_supplicant(384): p2p0: P2P-GO-NEG-SUCCESS 
08-31 15:13:28.241: I/wpa_supplicant(384): rfkill: Cannot open RFKILL control device
08-31 15:13:29.850: W/wpa_supplicant(384): p2p-p2p0-3: Could not connect to kernel driver
08-31 15:13:30.264: E/wpa_supplicant(384): Using interface p2p-p2p0-3 with hwaddr a2:0b:ba:x:y:z and ssid 'DIRECT-ps-Android_e9f0'
08-31 15:13:30.491: I/wpa_supplicant(384): p2p-p2p0-3: CTRL-EVENT-CONNECTED - Connection to a2:0b:ba:x:y:z completed (auth) [id=0 id_str=]
08-31 15:13:43.491: I/wpa_supplicant(384): p2p0: P2P-GROUP-FORMATION-FAILURE 
08-31 15:13:43.491: I/wpa_supplicant(384): p2p0: P2P-GROUP-REMOVED p2p-p2p0-3 GO
08-31 15:13:43.491: W/wpa_supplicant(384): p2p-p2p0-3: Could not connect to kernel driver
08-31 15:13:44.061: E/wpa_supplicant(384): Failed to remove interface (ifidx=15)
08-31 15:13:44.178: W/Netd(120): No subsystem found in netlink event
08-31 15:13:44.178: D/NetlinkEvent(120): Unexpected netlink message. type=0x11
08-31 15:13:44.248: W/Netd(120): No subsystem found in netlink event
08-31 15:13:44.248: D/NetlinkEvent(120): Unexpected netlink message. type=0x11
08-31 15:13:44.280: I/wpa_supplicant(384): p2p0: P2P-DEVICE-LOST p2p_dev_addr=a2:0b:ba:x:y:z
08-31 15:13:46.155: I/wpa_supplicant(384): p2p0: P2P-DEVICE-FOUND a2:0b:ba:x:y:z p2p_dev_addr=a2:0b:ba:x:y:z pri_dev_type=10-0050F204-5 name='Android_755f' config_methods=0x188 dev_capab=0x27 group_capab=0x0

有趣将是:     08-31 15:13:43.491:W /的wpa_supplicant(384):P2P-p2p0-3:无法连接到内核驱动程序

Interesting would be: 08-31 15:13:43.491: W/wpa_supplicant(384): p2p-p2p0-3: Could not connect to kernel driver

我想。看起来像Android的自身WiFi的直框架中的错误给我?

I think. Looks like a bug in Android's own wifi-direct-framework to me?

推荐答案

为了纪念这个问题的回答,我就复制我的解决方案,这一问题:

To mark this question as answered, I'll just copy my "solution" to this problem:

好像集团的形成只有当你在另外一个wifi网络出现故障时,就像在你的家庭WiFi或如..因此Android无法禁用它 - 因此无法通过WiFi直接连接

Seems like group formation only fails if you're in another wifi network, like in your home wifi or such.. so Android fails to disable it - thus fails to connect via WiFi Direct.

我必须确保这些设备都不在一个wifi网络。

I had to make sure the devices were not in a wifi network.

这篇关于支持WiFi直接在软糖,WPA请求者搞砸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆