【问题标题】:Trouble connecting with Connman using dbus, but only the first time使用 dbus 连接 Connman 时遇到问题,但只是第一次
【发布时间】:2017-09-26 22:36:54
【问题描述】:

我一直在尝试使用各种 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

最终这是我从界面收到的消息:

没有收到回复。可能的原因包括:远程应用未发送回复、消息总线安全策略阻止回复、回复超时或网络连接中断

此时我可以确认 Connman 没有连接到 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 脚本来断开或重新连接。

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

【问题讨论】:

    标签: python linux dbus connman


    【解决方案1】:

    如果您仍在寻找答案: Connman 需要一个代理来回答安全问题(在 WPA2 中:它是密码)。您可以运行代理并回复 Connman 问题,也可以使用正确的键在 /var/lib/connman 中创建文件。见here。一旦创建或删除文件,Connman 将自动做出相应的神奇动作(尝试连接或断开连接。

    基本文件如下所示:

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

    【讨论】:

    • 谢谢 隐藏网络的解决方案是什么?
    • 只需添加到文件中:Hidden=true
    猜你喜欢
    • 1970-01-01
    • 2022-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    • 2020-04-25
    • 1970-01-01
    • 2017-03-11
    相关资源
    最近更新 更多