Connman introduction

Connman是一款由Intel和Nokia于2009年创建的轻量级连接管理器,专为嵌入式系统如MID、手机和平板电脑设计。它隐藏了网络管理中的复杂性,提供更快更小的服务进程。Connman已集成到多个操作系统中,如Meego、Google Chrome OS等,并支持多种网络连接方式,包括以太网、Wi-Fi、蓝牙PANU、WiMax、3G数据连接和VPN等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Btw: I decide to write my techinical blog in English to save up my time. I always need to ‘translate’ them back to Chinese word in my brain. ;-). There’re too many things that I can write related with oFono/Connman/BlueZ…

Connman is a lightweight connection manager that target in the Embedded system like MID (mobile internet device), handset and tablet. It is created by Intel&Nokia in 2009. The latest release of connman is 0.60 and it has been adopted into Meego, Google Chrome OS, Ubuntu 10.10 Netbook edition and other distribution.

Why Connman is better than Network-manager?

There’re lots of legacy components in network manager. NM is heavy weight and exposes some unnessary interface to the end user. Connman is designed to hide those complexies and be a light weight, faster, smaller daemon for the embedded market.

Build & Install connman

git clone git://git.kernel.org/pub/scm/network/connman/connman.git

./bootstrap && /
    ./configure --enable-ethernet=builtin /
        --enable-wifi=builtin /
        --enable-dhclient=builtin /
        --enable-bluetooth=builtin /
        --enable-loopback=builtin /
        --enable-dnsproxy=builtin /
        --enable-ofono=builtin /
        --enable-openconnect=builtin /
        --enable-threads /
        --localstatedir=/var /
        --prefix=/usr /
        --with-openconnect=/usr/bin/openconnect /
        --enable-tools /
        CFLAGS='-Werror -Wall'

make; sudo make install

or you can install connman directly from respository. E.g., from my Ubuntu 9.10, I can install connman:

sudo apt-get install –y connman connman-dev connman-gnome

What does Connman have?

As a network manager, it supports ethernet, wifi, Bluetooth PANU, WiMax, 3G data connection, VPN and other various connection methods.

image

Connman can be divided into three parts: core, plugins and libs. Plugins implement various plugin for different device, like wifi, ethernet etc. Libs provide extra/common functionality that requires for specific connections, like Wifi, DHCP etc.

 

Device

Connman is based on device mode, which means it replies on udev to detect and create device instance at runtime. Meanwhile, it loads all supported device driver at start up. Once a new device is detected, it tries to scan the device tree to find a matchable driver and invoke probe(), enable(), disable() method to complete operations on different devices.

Device->Network->Service

image

Device: A physical device that is detected by kernel and recognized by udev

Network: A network instance from this device. It could be 1:N relationship. For instance, a wifi device could detect many available wireless gateway.

Service: An active network that provide connected service.

struct connman_device_driver {
    name;
    type;
    probe();
    remove();
    enable();
    disable();
}

struct connman_network_driver {
    name;
    type;
    probe();
    remove();
    connect();
    disconnect();
    setup();
}

Service manage

image

 

Summary

Connman is working closely with oFono/BlueZ and other Linux component to provide connection service. It supports IPv4, IPv6, VPN, multiconnections and lots of other features. It is a promosing project that still under heavy development.

 

Reference

[1] http://connman.net/

[2] git://git.kernel.org/pub/scm/network/connman/connman.git

[3] https://wiki.ubuntu.com/ConnMan

<think>好的,我现在需要帮助用户了解如何使用Connman连接到WiFi。用户提到了一个引用内容,看起来是他们在尝试连接时使用的命令和输出。首先,我得回忆一下Connman的基本用法,确保步骤正确。 首先,Connman是嵌入式系统中常用的网络管理工具,尤其是在Linux设备上。用户可能需要先启动Connman服务,但根据引用中的路径,看起来服务已经在运行了。用户已经进入了Connmanctl的交互式界面,或者直接在命令行中执行了connect命令。 接下来,用户需要扫描可用的WiFi网络。通常步骤是启动connmanctl,然后执行scan wifi来搜索网络。但用户可能已经知道目标网络的名字,所以可能需要先启用wifi,如果无线接口未启用的话。不过引用中的示例直接使用了connect命令,后面跟着一个复杂的网络ID,这可能是扫描后得到的。 然后,用户需要知道如何获取网络ID。通常在connmanctl中,使用services命令可以列出所有可用的网络,每个网络都有一个唯一的标识符,比如wifi_后面跟着的字符串。用户需要找到自己想要的SSID对应的ID,然后执行connect命令加上这个ID。 另外,如果网络需要密码,用户可能需要先配置密码。这可以通过在connmanctl中设置代理,或者在服务的设置文件中预先配置。例如,在/var/lib/connman/目录下创建网络配置文件,设置SSID和PSK。但用户示例中直接使用了connect命令,可能已经配置好了或者网络是开放的。 现在,我需要整理这些步骤,确保语法正确,尤其是命令行部分。用户提供的示例中已经成功连接,所以可能需要强调扫描、列出服务、连接这三个主要步骤。同时,需要注意权限问题,可能需要root权限执行这些命令。 还有可能遇到的问题,比如服务未启动,接口未启用,或者密码错误。用户可能需要检查connman的状态,确保wifi设备被识别。此外,Connman的日志可能在/var/log/下,帮助诊断问题。 最后,生成相关问题时要考虑用户可能进一步的需求,比如断开连接、查看状态、配置静态IP等。这些都是常见的后续操作,用户可能会感兴趣。</think>### Connman连接WiFi配置方法 1. **启动Connman服务** 确保Connman服务已运行,嵌入式Linux系统通常已内置服务。使用root权限执行命令: ```bash systemctl start connman ``` 2. **扫描可用WiFi网络** 进入`connmanctl`交互模式: ```bash connmanctl ``` 执行扫描命令(若需指定接口,如`wifi`): ```bash enable wifi # 启用无线网卡(若未激活) scan wifi # 扫描WiFi网络 ``` 3. **列出可连接网络** 查看扫描结果: ```bash services ``` 输出示例: ``` wifi_203233bd58b8_54502d4c094e4b5f37393832_managed_psk MyWiFiSSID ``` 4. **连接目标网络** 使用唯一标识符连接(注意替换实际ID): ```bash connect wifi_203233bd58b8_54502d4c094e4b5f37393832_managed_psk ``` 若需输入密码,系统会提示`Agent RequestInput`,按交互提示输入PSK密钥[^1]。 5. **验证连接状态** 退出交互模式后检查IP地址: ```bash ifconfig wlan0 # 无线网卡名称可能不同 ``` ### 配置文件预定义网络(可选) 在`/var/lib/connman/`目录创建配置文件`wifi.config`: ``` [service_MyWiFi] Type=wifi SSID=MyWiFiSSID Passphrase=mypassword IPv4=dhcp ``` ---
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值