使用dbus与Connman连接有问题,但只有第一个tim

2024-06-25 23:00:19 发布

您现在位置:Python中文网/ 问答频道 /正文

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

https://github.com/liamw9534/pyconnman/blob/master/demo/demo.py

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

CONN> list-services
CONN> agent-start /test/agent ssid=myNetwork passphrase=myPassphrase
CONN> service-connect /net/connman/service/wifi_xxxxx__managed_psk

最终,我从界面收到的信息是:

Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken

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

^{pr2}$

这将在/var/lib/connman下为wifi网络创建一个settings文件夹。我现在可以使用演示.py上面提到的脚本可以断开连接或重新连接。在

Connman在很多方面对我来说还是一个谜,我不知道为什么我必须第一次使用交互式shell连接到网络。有什么想法吗?在


Tags: the代码py网络示例demoservicenot
1条回答
网友
1楼 · 发布于 2024-06-25 23:00:19

如果你还在寻找答案: Connman需要一个代理来回答安全问题(在WPA2中:这是密码)。你可以在文件中创建一个回答问题的人。见here。一旦一个文件被创建或删除,康曼将自动神奇地采取相应的行动(尝试连接或断开。在

基本文件如下所示:

[service_mywificonfig]
Type = wifi
Security = wpa2
Name = myssid
Passphrase = yourpass

相关问题 更多 >