gpt4 book ai didi

android - JellyBean 上的 WiFi-Direct,WPA 请求者搞砸了

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:31:29 29 4
gpt4 key购买 nike

几个月前,我开始开发一些 WiFi-Direct 应用程序。几天前,我将我的两个 Galaxy Nexus 都更新为 Jelly Bean (4.1.x) 并测试了我的应用程序,但似乎又出现了问题。获得主要功能集已经很痛苦了在 ICS 上,但现在它不再工作了。

我得到的只是我的 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-intern 代码的专业人士,协商只是失败了,设备丢失了一小会儿,然后又被发现了,看起来有点乱。

我的邀请是这样发出来的:

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 上阅读了很多关于 wifi direct 的文章,在我将手机更新为 jelly bean 之前,它一直运行良好。任何人都知道,哪里出了问题?如果您需要更多代码示例或代码的任何特定部分,请告诉我,因为我不知道什么是可靠的。

感谢您的帮助。

编辑:

将 WifiP2pConfig.wps.setup 方法更改为“显示”,这导致设备 #1 显示 PIN 码,设备 #2 弹出带有输入字段的对话框 - 输入正确的 PIN 码后,这是 logcat 告诉我的:

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: 无法连接到内核驱动程序

我觉得。在我看来,这像是 Android 自己的 wifi-direct-framework 中的错误?

最佳答案

为了将此问题标记为已回答,我将复制我对此问题的“解决方案”:

似乎只有当你在另一个 wifi 网络中时,组形成才会失败,比如在你的家庭 wifi 中等等......所以 Android 无法禁用它 - 因此无法通过 WiFi Direct 连接。

我必须确保这些设备不在 wifi 网络中。

关于android - JellyBean 上的 WiFi-Direct,WPA 请求者搞砸了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12216085/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com