Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用dbus与Connman连接时出现问题,但这只是第一次_Python_Linux_Dbus_Connman - Fatal编程技术网

Python 使用dbus与Connman连接时出现问题,但这只是第一次

Python 使用dbus与Connman连接时出现问题,但这只是第一次,python,linux,dbus,connman,Python,Linux,Dbus,Connman,我一直在尝试使用各种Python库来处理Connman和dbus,特别是以下示例代码: 我遇到的问题是,当第一次连接到WPA2访问点时,我总是会收到一条超时消息。例如: CONN> list-services CONN> agent-start /test/agent ssid=myNetwork passphrase=myPassphrase CONN> service-connect /net/connman/service/wifi_xxxxx__managed_psk

我一直在尝试使用各种Python库来处理Connman和dbus,特别是以下示例代码:

我遇到的问题是,当第一次连接到WPA2访问点时,我总是会收到一条超时消息。例如:

CONN> list-services
CONN> agent-start /test/agent ssid=myNetwork passphrase=myPassphrase
CONN> service-connect /net/connman/service/wifi_xxxxx__managed_psk
最后,这是我从界面收到的消息:

没有收到答复。可能的原因包括:远程应用程序未发送回复,消息总线安全策略阻止了回复,回复超时已过期,或者网络连接已断开

我可以在这一点上确认康曼没有连接到wifi网络或获得IP地址。我唯一能做到这一点的方法是从Linux终端使用Connman应用程序本身:

connmanctl
connmanctl> agent on
connmanctl> connect wifi_xxxxx__managed_psk
Agent RequestInput wifi_xxxxx__managed_psk
    Passphrase = [ Type=psk, Requirement=mandatory ]
Passphrase? myPassword
connmanctl> Connected wifi_xxxxx__managed_psk
这将在/var/lib/connman下为wifi网络创建一个设置文件夹。我现在可以使用上面提到的demo.py脚本断开或重新连接


康曼在很多方面对我来说仍然有点神秘,我不知道为什么我第一次必须使用交互式shell连接到网络。有什么想法吗?

如果你还在寻找答案: 康曼需要一个代理来回答WPA2中的安全问题:这是密码。您可以运行代理并回答Connman的问题,也可以使用正确的密钥在/var/lib/Connman中创建一个文件。看见一旦文件被创建或删除,Connman将自动神奇地尝试连接或断开连接

基本文件如下所示:


谢谢,隐藏网络的解决方案是什么?只需添加到文件:hidden=true
[service_mywificonfig]
Type = wifi
Security = wpa2
Name = myssid
Passphrase = yourpass