ConnMan连接管理守护进程

连接管理器(ConnMan)是一个连接管理守护进程(connmand),用于管理运行Linux操作系统的设备中的Internet连接。它提供低内存消耗,并对网络条件变化进行快速,连贯,同步的反应。

ConnMan有各种插件,是一个完全模块化的系统,可以扩展以支持各种有线或无线技术.插件方法可以轻松适应和修改各种用例。诸如DHCP和域名解析之类的配置方法是使用插件实现的。

所有应用程序都应该使用D-Bus与ConnMan进行通信。它与嵌入式Yocto构建系统一起使用,是GENIVI车载信息娱乐规范的一部分。

ConnMan根据GPL v2.0许可证分发。英特尔是ConnMan项目的主要贡献者。

ConnMan体系结构

image

ConnMan内部基础设施

image

功能和特点

以下功能内置于连接管理器中:

  • 通用插件基础结构
  • 设备和网络抽象(具有基本的存储支持)
  • IPv4,IPv4-LL(链路本地)和DHCP - IPv6,DHCPv6和6to4隧道
  • 高级路由和DNS配置
  • 内置DNS代理和智能缓存
  • 内置WISPr热点登录和门户检测
  • 时间和时区配置(使用NTP进行手动和自动)
  • 代理处理(手动和自动使用WPAD)
  • 共享支持(USB,蓝牙和WiFi AP模式)
  • 详细的统计处理(家庭和漫游)

各种插件可以启用网络支持:

  • 以太网插件
  • WiFi插件与WEP40 / WEP128和WPA / WPA2(个人和企业)
  • 蓝牙插件(使用BlueZ)
  • 2G /3G / 4G插件(使用oFono)

Pugins还提供其他功能:

  • 环回接口设置
  • PACrunner代理处理
  • PolicyKit授权支持

Connman D-BUS接口

D-Bus interfaces

  • 应用程序应该使用D-Bus与ConnMan进行通信。
  • 主要入口点是通过管理器对象。
  • Manager对象包含对服务对象的引用(接口)。
  • 其他接口包括VPN,时钟,任务,技术,会话,通知,对等,代理和计数器。

itemeditorimage_59ee6627ea6f6.png

管理D-BUS接口

  • 应用程序入口点是管理器对象
  • 所有的方法和属性都有解释

itemeditorimage_59ee666c6571e.png

管理属性

检索所有全局属性的简单方法如下所示:

  • bus = dbus.SystemBus()
  • manager = dbus.Interface(bus.get_object("net.connman", "/"), "net.connman.Manager")
  • properties = manager.GetProperties()

更改全局属性也很简单。例如,启用所谓的离线模式(AKA飞行模式)就足以设置该属性: manager.SetProperty("OfflineMode", dbus.Boolean(1)).

itemeditorimage_59ee66d54b14f.png

服务界面

先进的界面使用户界面可以轻松访问网络细节和用户选择的偏好。这是服务列表和界面。ConnMan维护一个单一的平面和所有可用服务的排序列表。

image

服务顺序

image

服务状态

  • 每项服务的基本状态都是“闲置”。这意味着此服务目前尚未使用。它也不是试图连接或做任何事情。
  • “关联”状态表示该服务试图建立与网络的低级连接 - 例如,与WiFi接入点关联/连接。
  • 在“配置”状态下,该服务表明它正在尝试检索/配置IP设置。
  • “就绪”状态表示成功连接的设备。这并不意味着它具有默认路由,但基本的IP操作将会成功。
  • 在“断开”状态下,服务指示它将要终止当前连接并返回到“空闲”状态。
  • 另外,“失败”状态表示错误的行为。由于服务未连接,因此与“空闲”状态类似。

image

服务D-Bus接口

以下是如何获取服务对象:

-properties = manager.GetProperties()
-for path in properties["Services"]:
service = dbus.Interface(bus.get_object("net.connman", path), "net.connman.Service")

它还包含连接或断开特定服务的方法。ConnMan还可以根据他的策略或通过外部事件(如插入以太网电缆)自动连接服务。手动连接(或断开)特定服务就像告诉它一样简单。

connect: service.Connect() or service.Disconnect()

image

服务属性

image

技术接口

基本的设备配置任务由技术接口完成。例如,打开和关闭设备(例如通过RFKILL)应通过技术接口完成。

image

技术属性

用户可以通过Manager OfflineMode属性激活离线(飞行)模式。在离线模式下,包括以太网在内的所有技术均关闭。在离线模式下,用户可以使用rfkill命令或某些笔记本电脑中的Fn-Fx组合键,通过Technology Powered属性临时激活单个技术。

image

Connman内部

启动connmand

选项:

-c, --config=FILE             Load the specified configuration file instead of /usr/local/etc/connman/main.conf
-d, --debug=DEBUG             Specify debug options to enable
-i, --device=DEV              Specify networking device or interface
-I, --nodevice=DEV            Specify networking interface to ignore
-p, --plugin=NAME,...         Specify plugins to load
-P, --noplugin=NAME,...       Specify plugins not to load
-W, --wifi=NAME               Specify driver for WiFi/Supplicant
-n, --nodaemon                Don't fork daemon to background
-r, --nodnsproxy              Don't enable DNS Proxy
--nobacktrace                 Don't print out backtrace information

用法示例:

# CONNMAN_SUPPLICANT_DEBUG=1 connmand -n -d &> connman.log
#connmand -i wlan0 -I eth0 --nodnsproxy --nodaemon >& connman.log

主要配置文件

main.conf

InputRequestTimeout = 120 (default)---------> input request ( ex. passphrase) timeout
BrowserLaunchTimeout = 300 ( default) -----> The request for launching a browser for portal pages
BackgroundScanning = true --------------------> option for background scanning
FallbackTimeservers = --------------------------> List of fallback timeservers ( used by NTP sync) separated by ","
FallbackNameservers = -------------------------> List of fallback nameservers
DefaultAutoConnectTechnologies = -----------> List of technologies that are marked autoconnectable by default.
PreferredTechnologies = ------------------------> List of preferred technologies from - most preferred one to least preferred
NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-   ---> List of blacklisted network interfaces 
AllowHostnameUpdates = true -----------------> Allow connman to change the system hostname ( ex. dhcp hostname option)
SingleConnectedTechnology = false -----------> Keep only a single connected technology at any time
TetheringTechnologies = wifi,bluetooth,gadget
PersistentTetheringMode = false --------------> Restore earlier tethering status when returning from offline mode
Enable6to4 = false ------------------------------> Automatically enable Anycast 6to4 if possible (not recommended. see RFC6343 )
EnableOnlineCheck = false --------------------> Enable use of http get as on online status check
AlwaysConnectedTechnologies = -------------> List of technologies with AutoConnect = true which are always connected regardless of PreferredTechnologies setting

Connman配置文件

Connman使用配置文件来调配现有服务。Connman将在/ var / lib / connman /下查找它的配置文件。配置文件名称不得包含除字母或数字之外的其他字符,并且必须具有.config后缀。

Ex.      #cat /var/lib/connman/example.config
[global]
Name = Example
Description = Example network configuration

[service_home_ethernet]
Type = ethernet
IPv4 = 192.168.1.42/255.255.255.0/192.168.1.1
IPv6 = 2001:db8::42/64/2001:db8::1
MAC = 01:02:03:04:05:06
Nameservers = 10.2.3.4,192.168.1.99
SearchDomains = my.home,isp.net
Timeservers = 10.172.2.1,ntp.my.isp.net
Domain = my.home

[service_home_wifi]
Type = wifi
Name = my_home_wifi
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1
MAC = 06:05:04:03:02:01Ex.      #cat /var/lib/connman/example.config
[global]
Name = Example
Description = Example network configuration

[service_home_ethernet]
Type = ethernet
IPv4 = 192.168.1.42/255.255.255.0/192.168.1.1
IPv6 = 2001:db8::42/64/2001:db8::1
MAC = 01:02:03:04:05:06
Nameservers = 10.2.3.4,192.168.1.99
SearchDomains = my.home,isp.net
Timeservers = 10.172.2.1,ntp.my.isp.net
Domain = my.home

[service_home_wifi]
Type = wifi
Name = my_home_wifi
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1
MAC = 06:05:04:03:02:01

设置

设置和配置文件会自动为用户经常连接的网络创建。

# cat /var/lib/connman/settings 

[global]

OfflineMode=false

[WiFi]

Enable=true

Tethering=false

[Bluetooth]

Enable=false

Tethering=false

配置文件设置存储在/ var / lib / connman /目录下的服务名称下。VPN设置可以在/ var / lib / connman-vpn /中找到。

编写插件

基本插件包含通过CONNMAN_PLUGIN_DEFINE的插件描述以及通过该描述定义的init / exit回调。

#include <connman/plugin.h>

static int example_init(void)
{
    return 0;
}

static void example_exit(void)
{
}

CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
                        example_init, example_exit)

插件使用技术,网络和设备以及其他基础设施与ConnMan的核心功能进行交互。这里是技术基础设施:

ex. bluetooth plugin
    static struct connman_technology_driver tech_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_SERVICE_TYPE_BLUETOOTH,
        .probe          = bluetooth_tech_probe,
        .remove         = bluetooth_tech_remove,
        .set_tethering  = bluetooth_tech_set_tethering,
    };

为了使Connection Manager知道新的Technology插件,我们需要通过调用connman_technology_driver_register()来注册它的驱动程序。

connman_technology_driver_register(&tech_driver);

设备基础设施

设备代表给定技术的真实设备。每种技术可能有很多设备。

static struct connman_device_driver device_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_DEVICE_TYPE_BLUETOOTH,
        .probe          = bluetooth_device_probe,
        .remove         = bluetooth_device_remove,
        .enable         = bluetooth_device_enable,
        .disable        = bluetooth_device_disable,
    };

要注册驱动程序:

connman_device_driver_register(&device_driver);

此外,需要为每个插件编写处理新设备检测的代码;蓝牙插件通过注册BlueZ D-Bus接口的观察器来实现。一旦出现新的蓝牙设备,插件需要通过调用connman_device_create()来通知ConnMan核心。对于蓝牙插件,通话将是:

struct connman_device *device;
 device = connman_device_create("bluetooth", CONNMAN_DEVICE_TYPE_BLUETOOTH)

网络基础设施

连接管理器提供了一种插件来处理为每种类型的技术建立/处理连接的细节。对于蓝牙插件,需要注册connman_network_driver:

    static struct connman_network_driver network_driver = {
        .name           = "bluetooth",
        .type           = CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN,
        .probe          = bluetooth_pan_probe,
        .remove         = bluetooth_pan_remove,
        .connect        = bluetooth_pan_connect,
        .disconnect     = bluetooth_pan_disconnect,
    };

然后,调用注册函数:

 connman_network_driver_register(&network_driver);

Connman源文件/基础设施

在运行主循环之前,init函数将在src / main.c中调用。

src/util.c - /dev/urandom support
src/inotify.c - used by the core (config.c) and the session policy plugin
src/technology.c – used for technology interface
src/notifier.c – basic notifier infrastructure
src/agent.c – agent interface
src/service.c – used for service interface
src/peer_service.c – p2p peer service API
src/peer.c – p2p peer object’s core logic
src/provider.c – provider infrastructure
src/network.c – network infrastructure used by plug-ins
src/config.c – framework for configuration files
src/device.c – device infrastructure used by plug-ins
src/iptables.c – iptables support (netfilter chains and rules)
src/firewall-iptables.c, nftables.c (older firewall.c) – firewall infrastructure.
src/nat.c – used for NAT
src/tethering.c  – tethering infrastructure
src/manager.c – Manager interface
src/stats.c – used for storing service stats ( mmaped into memory)
src/ipconfig.c – IP configuration framework
src/rtnl.c – netlink support
src/session.c – Allows 3rd party applications to request a network session 
src/resolver.c – resolver framework
src/dhcp.c, dhcpv6.c – dhcp framework
src/rfkill.c – rfkill interface support
src/machine.c -  basic systemd-hostnamed ( machine-type- “chassis”) support

Connmanctl

ConnMan有一个标准的命令行客户端connmanctl。它可以运行在两种模式下:

  • 在命令模式下,命令作为connmanctl命令的参数输入,就像systemctl一样。
  • 通过输入不带参数的connmanctl来启动交互模式。提示将变为connmanctl>,表示它正在等待用户命令,就像python交互模式一样。

Connmanctl例子

示例1. 启用和禁用WiFi

$ connmanctl technologies - check for the line that says Powered: True/False. 
$ connmanctl enable wifi - To power the wifi on.
$ connmanctl disable wifi – To power off the wifi.

其他启用wifi的方式可能包括 - ip link set <interface>向上。ConnMan将自动处理有线连接。

示例2. 连接到一个开放的接入点

本节中的命令显示如何在命令模式下运行connmanctl。扫描网络connmanctl接受称为技术的简单名称。扫描附近的WiFi网络:

$ connmanctl scan wifi To list the available networks found after a scan run (example output): 
$ connmanctl services 
*AO MyNetwork wifi_dc85de828967_68756773616d_managed_psk OtherNET wifi_dc85de828967_38303944616e69656c73_managed_psk AnotherOne wifi_dc85de828967_3257495245363836_managed_wep FourthNetwork wifi_dc85de828967_4d7572706879_managed_wep AnO6penNetwork wifi_dc85de828967_4d6568657272696e_managed_none 
$ connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none

您现在应该连接到网络。使用ip addr或connmanctl状态进行检查。

示例3. 连接到受保护的接入点
对于受保护的访问点,向ConnMan守护进程提供一些信息,至少一个密码。

$ connmanctl
connmanctl> scan wifi ----- To list services: 
connmanctl> services 
connmanctl> agent on --- register the agent to handle user requests.
connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk 

代理程序要求获取更多信息,具体取决于您要连接的网络类型。该代理还将打印有关其所需信息的其他数据,如以下示例中所示。

Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase?

提供请求的信息(在本例中为密码),然后键入:

connmanctl> quit

如果您提供的信息是正确的,您现在应该连接到受保护的接入点。

Connmanctl其他用法

ConnMan将各种硬件接口称为Technologies。要列出可用技术,请运行:

$ connmanctl technologies

技术可以通过以下方式打开/关闭:

$ connmanctl enable technology_type

$ connmanctl disable technology_type 

例如,要关闭WiFi:

$ connmanctl disable wifi

ConnMan测试脚本

Connman还提供了基本的Python脚本(例如test-connman,list-services等)。诸如连接,断开连接,自动连接,服务,扫描,启用,禁用,脱机模式,状态等基本操作均通过这些脚本得到支持。

ConnMan 调试

激活调试

我们可以使用-d命令行选项在ConnMan中激活调试打印。

-d Activate all normal debug prints 
-d src/service.c This prints debugging info from src/service.c file only
-d src/network.c:src/ipconfig.c This activates debug prints in src/network.c and src/ipconfig.c files. 
-d 'src/n*.c' This would activate debug print from all the C source files starting with letter 'n' in src directory. Note the quotation marks around option, that is to prevent shell expansion. 
-d '*/n*.c:*/i*.c' Activate debug prints for all C source files starting with letters 'n' or 'i' in any sub-directory. 

子组件调试

ConnMan的某些组件具有环境变量激活的调试打印。如果设置了环境变量,那么相应的组件会打印一些额外的调试信息。

可以使用以下环境变量:

  • CONNMAN_DHCP_DEBUG:与DHCPv4相关的调试信息
  • CONNMAN_DHCPV6_DEBUG:与DHCPv6相关的调试信息
  • CONNMAN_IPTABLES_DEBUG:使用iptables时的额外信息
  • CONNMAN_RESOLV_DEBUG:名称解析器调试打印。当ConnMan解析自己使用的主机名时使用这些调试打印。请注意,DNS代理调试打印不使用此环境变量。为此,可以使用“-d src / dnsproxy.c”命令行选项。
  • CONNMAN_SUPPLICANT_DEBUG:调试connmand和wpa_supplicant进程之间的通信打印。
  • CONNMAN_WEB_DEBUG:ConnMan在Wispr和6to4组件中进行Internet连接检查时的调试信息。

例如:

CONNMAN_SUPPLICANT_DEBUG=1 src/connmand -n

示例:获取CONNMAN_IPTABLES_DEBUG日志

确保在内核中启用iptables支持:

#zcat /proc/config.gz | grep "CONFIG_IP_NF_IPTABLES"

在内核中必须启用Iptables:

CONFIG_IP_NF_IPTABLES=m or CONFIG_IP_NF_IPTABLES=y

清除所有iptable过滤器:

# iptables –F

在iptable规则下面设置以过滤ICMP数据包(输入,输出和转发数据包):

# iptables -t filter -A INPUT -p icmp --icmp-type echo-request -j LOG --log-prefix="filter INPUT:"

# iptables -t filter -A INPUT -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter INPUT:“

# iptables -t filter -A OUTPUT -p icmp --icmp-type echo-request -j LOG --log-prefix="filter OUTPUT:“

# iptables -t filter -A OUTPUT -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter OUTPUT:“

# iptables -t filter -A FORWARD -p icmp --icmp-type echo-request -j LOG --log-prefix="filter FORWARD:“

# iptables -t filter -A FORWARD -p icmp --icmp-type echo-reply -j LOG --log-prefix="filter FORWARD:"

导出下面的环境变量来启用ConnMan的iptables调试:

# export CONNMAN_IPTABLES_DEBUG=1

Start Connmand Connection Manager with debug option enabled:

# /usr/sbin/connmand -d -n -I eth0 

ConnMan守护进程消息日志应该在涉及ICMP数据包时显示。

ConnMan

   Connection Manager简称connman,connman是使用d-bus做为进程间通信机制来管理Linux网络链接的一种软件。在connman的d-bus接口中,有一个接口叫做service。该接口的全称为:net.connman.Service,自然是挂在net.connman上面的。做为net.connman.Service接口,它可以访问到network的细节以及用户偏好使用什么类型的网络(比如3g、wifi、wimax等等)。外部的程序就通过net.connman.Service的一堆Properties和Methods来实现它基本的功能。(可能诠释的不对,可能是整体的connman的功能)
        核心的逻辑如下:connman维护一个信号标记并且将所有可能连接上的网络服务建成一个列表(分类成普通网络、用户喜欢的以及上次使用的网络)。做为网络服务,它可以是以太网设备,WIFI,WIMAX,或者是远程蓝牙设备(比如手机)。

        这个列表的分类和排序是由connman内部实现,没必要由使用它的用户来决定怎么去将网络排序之类的。用户的决定(比如链接WIFI、关闭以太网等等)会通过connman实现,与此同时connman会重新对列表中的网络服务进行排序。

Related articles

ConnMan is a command-line network manager designed for use with embedded devices and fast resolve times. It is modular through a plugin architecture, but has native DHCP and NTP support.

Contents

Installation

Install the connman package. wpa_supplicant and bluez are optional dependencies required for Wi-Fi and Bluetooth functionality respectively.

Before enabling connman.service, ensure any existing network configuration is disabled.

Desktop clients

  • cmst — Qt GUI for ConnMan.

https://github.com/andrew-bibb/cmst || cmstAUR

  • connman-ncurses — Simple ncurses UI for ConnMan; not all of connman functionality is implemented, but usable (with X or from terminal without X), see the wiki.

https://github.com/eurogiciel-oss/connman-json-client || connman-ncurses-gitAUR

  • connman-notify — Connman event notification client

https://github.com/wavexx/connman-notify || connman-notifyAUR[broken link: archived in aur-mirror]

  • ConnMan-UI — GTK3 client applet.

https://github.com/tbursztyka/connman-ui || connman-ui-gitAUR

  • connman_dmenu — Client/frontend for dmenu.

https://github.com/taylorchu/connman_dmenu || connman_dmenu-gitAUR

  • Econnman — Enlightenment desktop panel applet.

http://www.enlightenment.org || econnmanAUR

  • LXQt-Connman-Applet — LXQt desktop panel applet.

https://github.com/surlykke/lxqt-connman-applet || lxqt-connman-applet-gitAUR

  • qconnman-ui — Qt management interface used on O.S. Systems products

https://github.com/OSSystems/qconnman-ui || qconnman-ui-gitAUR[broken link: archived in aur-mirror]

  • connman-gtk — GTK client.

https://github.com/jgke/connman-gtk || connman-gtkAUR

  • gnome-extension-connman — Gnome3 extension for connman; it contains only some of the functionality without installing connman-gtk.

https://github.com/jgke/gnome-extension-connman || https://extensions.gnome.org/extension/981/connman-extension/

Usage

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Only Wired and Wi-Fi plugins are described. (Discuss in Talk:ConnMan#)

ConnMan has a standard command line client connmanctl. It can run in 2 modes:

  • In command mode commands are entered as arguments to connmanctl command, just like systemctl.
  • Interactive mode is started by typing connmanctl without arguments. Prompt will change to connmanctl> to indicate it is waiting for user commands, just like python interactive mode. The interactive mode supports tab completion, which makes finding the correct connection easy.

Wired

ConnMan will automatically handle wired connections.

Wi-Fi

Enabling and disabling wifi

To check if wifi is enabled you can run connmanctl technologies and check for the line that says Powered: True/False. To power the wifi on you can run connmanctl enable wifi or if you need to disable it you can run connmanctl disable wifi. Other ways to enable wifi could include using the Fn keys on the laptop to turn it on or running ip link set <interface> up.

Connecting to an open access point

The commands in this section show how to run connmanctl in command mode.

To scan the network connmanctl accepts simple names called technologies. To scan for nearby Wi-Fi networks:

$ connmanctl scan wifi

To list the available networks found after a scan run (example output):

$ connmanctl services
*AO MyNetwork               wifi_dc85de828967_68756773616d_managed_psk
    OtherNET                wifi_dc85de828967_38303944616e69656c73_managed_psk 
    AnotherOne              wifi_dc85de828967_3257495245363836_managed_wep
    FourthNetwork           wifi_dc85de828967_4d7572706879_managed_wep
    AnOpenNetwork           wifi_dc85de828967_4d6568657272696e_managed_none

To connect to an open network, use the second field beginning with wifi_:

$ connmanctl connect wifi_dc85de828967_4d6568657272696e_managed_none

Tip: Network names can be tab-completed.

You should now be connected to the network. Check using ip addr or connmanctl state.

Connecting to a protected access point

For protected access points you will need to provide some information to the ConnMan daemon, at the very least a password or a passphrase.

The commands in this section show how to run connmanctl in interactive mode, it is required for running the agentcommand. To start interactive mode simply type:

$ connmanctl

You then proceed almost as above, first scan for any Wi-Fi technologies:

connmanctl> scan wifi

To list services:

connmanctl> services

Now you need to register the agent to handle user requests. The command is:

connmanctl> agent on

You now need to connect to one of the protected services. To do this easily, just use tab completion for the wifi_ service. If you were connecting to OtherNET in the example above you would type:

connmanctl> connect wifi_dc85de828967_38303944616e69656c73_managed_psk

The agent will then ask you to provide any information the daemon needs to complete the connection. The information requested will vary depending on the type of network you are connecting to. The agent will also print additional data about the information it needs as shown in the example below.

Agent RequestInput wifi_dc85de828967_38303944616e69656c73_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory ]
  Passphrase?  

Provide the information requested, in this example the passphrase, and then type:

connmanctl> quit

If the information you provided is correct you should now be connected to the protected access point.

Settings

Settings and profiles are automatically created for networks the user connects to often. They contain fields for the passphrase, essid and other information. Profile settings are stored in directories under /var/lib/connman/ by their service name. To view all network profiles run this command from root shell:

# cat /var/lib/connman/*/settings

Note: VPN settings can be found in /var/lib/connman-vpn/.

Technologies

Various hardware interfaces are referred to as Technologies by ConnMan.

To list available technologies run:

$ connmanctl technologies

To get just the types by their name one can use this one liner:

$ connmanctl technologies | awk '/Type/ { print $NF }'

Note: The field Type = tech_name provides the technology type used with connmanctl commands

To interact with them one must refer to the technology by type. Technologies can be toggled on/off with:

$ connmanctl enable technology_type

and:

$ connmanctl disable technology_type

For example to toggle off wifi:

$ connmanctl disable wifi

Warning: connman grabs rfkill events. It is most likely impossible to use rfkill or bluetoothctl to (un)block devices, yet hardware keys may still work.[1] Always use connmanctl enable|disable

Email:[email protected]


作者:程序手艺人
链接:https://www.jianshu.com/p/63a3f9841702
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/kyopeng123/article/details/84891462