IVI/ConnMan Tips & Tricks

From Tizen Wiki
Jump to: navigation, search

ConnMan Overview

The ConnMan project provides a daemon for managing internet connections within embedded devices running the Linux operating system. The Connection Manager is designed to be slim and to use as few resources as possible, so it can be easily integrated. It is a fully modular system that can be extended, through plug-ins, to support all kinds of wired or wireless technologies. Also, configuration methods, like DHCP and domain name resolving, are implemented using plug-ins. The plug-in approach allows for easy adaption and modification for various use cases.

ConnMan is one of the key components at the heart of the Network and Connectivity domain in Tizen.

While it is always easiest to manage network connections through a Settings GUI application of some sort, it is not always available especially to those doing advanced development. This page describes a few tips and tricks for managing ConnMan when a Settings GUI is not available or does not offer enough flexibility.

ConnMan Tools

There are a couple of command-line tools you can use to manage ConnMan:

  1. Newly-introduced connmanctl utility
  2. Python scripts under /usr/lib/connman/test

The python scripts are typically not installed by default in a Tizen IVI image... which may give you a bit of a chicken-and-egg challenge in that you need a connection to set-up your network connection! The good news is that a connmanctl utility has been developed to help manage ConnMan and is installed by default along with the connman package.

For the sake of completeness, there is also an EFL-based GUI available in the Tizen IVI repository called EConnMan. It hasn't been extensively tested but seems to work rather well.

Here is how you can install the various tools:

Built-in tool: connmanctl

As mentioned above, connmanctl is installed by default on the image so nothing to be done here :-)

ConnMan test scripts

$su (passowrd is 'tizen')
#zypper in connman-test

Et voila... all Python test scripts are now located under /usr/lib/connman/test/ for you to play with. The main ones are test-connman and simple-agent

EFL-based ConnMan GUI

$su (password is 'tizen')
#zypper in econnman

Note: You must run EConnMan as a normal user or else it will fail.

We will see in the next few sections how to perform some basic configurations of your network using either of the command-line tools. Using EConnMan is pretty straightforward so we won't cover it here.

Networking configuration

Setting up a static IP address

Although most networks provide a DHCP service, there are still various reasons why one would want to assign a static IP address to his system. Here is how you can easily achieve this:

1. Using connmanctl (preferred):

$connmanctl services   # Take note of the interface you want to modify, the general format for a wired connection is ethernet_<MAC_ADDR>_cable
$connmanctl config <service> --ipv4 manual  <ip address> <netmask> <gateway>

For more help/options: connmanctl -h

2. Using the set-ipv4-method script:

#zypper in connman-test   # if not already installed
$/usr/lib/connman/test/set-ipv4-method <service> manual <ip address> <netmask> <gateway>

Connecting to a secure Wi-Fi network

More often than not, Wi-Fi networks are secured and require a passphrase to connect. Here is how you can set up your system to connect to such a network:

1. Using connmanctl:

Enter the interactive mode of connmanctl:

connmanctl> technologies # Make sure that WiFi is enabled (i.e. that Powered = True)
connmanctl> enable wifi # Only needed if not enabled obviously.
connmanctl> scan wifi # Wait for the Scan completed for wifi message to appear
connmanctl> services # Take note of the interface you want to modify, the general format for a wireless network service is something like wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk
connmanctl> agent on
connmanctl> connect wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk

The agent will then prompt you to enter the passphrase:

Agent RequestInput wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk
 Passphrase = [ Type=psk, Requirement=mandatory ]

For more help/options: connmanctl -h

2. Using the connman-test scripts:

#zypper in connman-test   # if not already installed

You will need two terminal windows for this, follow these steps in this order: Terminal window #1:

$/usr/lib/connman/test/test-connman enable wifi
$/usr/lib/connman/test/test-connman scan wifi
$/usr/lib/connman/test/test-connman services # Take note of the interface you want to modify, the general format for a wireless network service is something like wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk

Terminal window #2:

$/usr/lib/connman/test/simple-agent Identity=wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk Passphrase="wifi_passphrase"

Back to Terminal window #1:

$/usr/lib/connman/test/test-connman connect wifi_<MAC_ADDR>_<SSID_HEX>_managed_psk

Setting up a proxy

To Do


If you're using NetworkManager on your system (probably not Tizen) you can blacklist interface or it :