summaryrefslogtreecommitdiffstats
path: root/meta-eca/recipes-connectivity/connman
diff options
context:
space:
mode:
Diffstat (limited to 'meta-eca/recipes-connectivity/connman')
-rw-r--r--meta-eca/recipes-connectivity/connman/connman-init-systemd.bb32
-rw-r--r--meta-eca/recipes-connectivity/connman/connman_git.bb51
-rw-r--r--meta-eca/recipes-connectivity/connman/files/0001-doc-Debugging-in-host-that-uses-systemd.patch44
-rw-r--r--meta-eca/recipes-connectivity/connman/files/0002-systemd-Use-environment-file-for-connmand-debug-opti.patch31
-rw-r--r--meta-eca/recipes-connectivity/connman/files/0003-systemd-Use-environment-file-for-connman-vpnd-debug-.patch32
-rw-r--r--meta-eca/recipes-connectivity/connman/files/add_xuser_dbus_permission.patch21
-rw-r--r--meta-eca/recipes-connectivity/connman/files/connman61
-rwxr-xr-xmeta-eca/recipes-connectivity/connman/files/connman-init-settings.sh96
-rw-r--r--meta-eca/recipes-connectivity/connman/files/connman-init.service13
9 files changed, 381 insertions, 0 deletions
diff --git a/meta-eca/recipes-connectivity/connman/connman-init-systemd.bb b/meta-eca/recipes-connectivity/connman/connman-init-systemd.bb
new file mode 100644
index 0000000..822a4a4
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/connman-init-systemd.bb
@@ -0,0 +1,32 @@
1SUMMARY = "Initialization service for ConnMan"
2DESCRIPTION = "Initializes necessary ConnMan services. This is \
3needed in headless system, otherwise we might not be able to \
4connect to device after installation. This service is only run \
5once in the first boot.\
6"
7LICENSE = "GPLv2"
8LIC_FILES_CHKSUM = "file://connman-init-settings.sh;beginline=7;endline=18;md5=95c5d66479370ef3964c4aef9255476f"
9
10SRC_URI = "\
11 file://connman-init-settings.sh \
12 file://connman-init.service \
13"
14
15S = "${WORKDIR}"
16PR = "r0"
17
18inherit systemd
19
20SYSTEMD_PACKAGES = "connman-init-systemd"
21
22SYSTEMD_SERVICE_${PN} = " connman-init.service"
23
24FILES_${PN} = " connman-init.service \
25 ${libdir}/connman/connman-init-settings.sh"
26
27do_install() {
28 install -d ${D}${libdir}/connman
29 install -d ${D}${nonarch_base_libdir}/systemd/system
30 install -m 0755 ${WORKDIR}/connman-init-settings.sh ${D}${libdir}/connman
31 install -m 0755 ${WORKDIR}/connman-init.service ${D}${nonarch_base_libdir}/systemd/system
32}
diff --git a/meta-eca/recipes-connectivity/connman/connman_git.bb b/meta-eca/recipes-connectivity/connman/connman_git.bb
new file mode 100644
index 0000000..0f4274c
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/connman_git.bb
@@ -0,0 +1,51 @@
1require recipes-connectivity/connman/connman.inc
2
3# We use a known good version instead of some buggy point version.
4SRCREV = "f5a441e9d636eefd98335322e79e71ca7e4f55cc"
5SRC_URI = "\
6 git://git.kernel.org/pub/scm/network/connman/connman.git \
7 file://add_xuser_dbus_permission.patch \
8"
9LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
10 file://src/main.c;beginline=1;endline=20;md5=486a279a6ab0c8d152bcda3a5b5edc36 \
11"
12
13# Enable debugging the easy way in systemd based distro.
14# See 0001-doc-Debugging-in-host-that-uses-systemd.patch for usage.
15SRC_URI += "\
16 file://0002-systemd-Use-environment-file-for-connmand-debug-opti.patch \
17 file://0003-systemd-Use-environment-file-for-connman-vpnd-debug-.patch \
18"
19
20S = "${WORKDIR}/git"
21PR = "${INC_PR}.0"
22PV = "1.23+git${SRCPV}"
23
24
25# Override some options from poky connman recipe
26EXTRA_OECONF += "\
27 --enable-loopback=builtin \
28 --enable-ethernet=builtin \
29 --enable-test \
30 --enable-client \
31 --enable-tools \
32 --disable-polkit \
33 --enable-pacrunner \
34 --enable-wispr \
35"
36
37
38# Make sure we will use bluez5 instead of older bluez4
39PACKAGECONFIG[bluetooth] = "--enable-bluetooth, --disable-bluetooth, bluez5"
40RDEPENDS_${PN} = "\
41 dbus \
42 ${@base_contains('PACKAGECONFIG', 'bluetooth', 'bluez5', '', d)} \
43 ${@base_contains('PACKAGECONFIG', 'wifi','wpa-supplicant', '', d)} \
44 ${@base_contains('PACKAGECONFIG', '3g','ofono', '', d)} \
45 "
46
47
48do_install_append() {
49 install -d ${D}${sysconfdir}/connman
50 install -m 0644 ${S}/src/main.conf ${D}${sysconfdir}/connman/main.conf.example
51}
diff --git a/meta-eca/recipes-connectivity/connman/files/0001-doc-Debugging-in-host-that-uses-systemd.patch b/meta-eca/recipes-connectivity/connman/files/0001-doc-Debugging-in-host-that-uses-systemd.patch
new file mode 100644
index 0000000..421beba
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/0001-doc-Debugging-in-host-that-uses-systemd.patch
@@ -0,0 +1,44 @@
1From 5365d78227f3c44338079e8c9c69494d038bfa6c Mon Sep 17 00:00:00 2001
2From: Jukka Rissanen <jukka.rissanen@linux.intel.com>
3Date: Wed, 13 Mar 2013 11:15:21 +0200
4Subject: [PATCH 1/3] doc: Debugging in host that uses systemd
5
6Upstream-Status: Denied
7
8Not accepted as distros can override the default ConnMan service file.
9
10Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
11---
12 README | 16 ++++++++++++++++
13 1 file changed, 16 insertions(+)
14
15diff --git a/README b/README
16index bfb246a..e97b536 100644
17--- a/README
18+++ b/README
19@@ -246,6 +246,22 @@ Following environment variables can be used:
20 Example:
21 CONNMAN_WEB_DEBUG=1 src/connmand -n
22
23+If the host is using systemd when starting ConnMan, then one can activate
24+debugging easily by creating /etc/connman/connmand.env file and setting
25+debug options there. By default the env file does not exist.
26+
27+The following example would activate debugging in src/s*.c files and
28+also turn on Internet connectivity check debugging if placed into
29+connmand.env file:
30+ DEBUG=-d src/s*.c
31+ CONNMAN_WEB_DEBUG=1
32+
33+Note that one should not use quotation marks in env file as the systemd
34+will not use shell to expand them.
35+
36+For connman-vpnd daemon debugging, a similiar /etc/connman/connman-vpnd.env
37+file can be created.
38+
39
40 Kernel configuration
41 ====================
42--
431.7.11.4
44
diff --git a/meta-eca/recipes-connectivity/connman/files/0002-systemd-Use-environment-file-for-connmand-debug-opti.patch b/meta-eca/recipes-connectivity/connman/files/0002-systemd-Use-environment-file-for-connmand-debug-opti.patch
new file mode 100644
index 0000000..8a683d6
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/0002-systemd-Use-environment-file-for-connmand-debug-opti.patch
@@ -0,0 +1,31 @@
1From 656ff42ff42da965865cc6e012404d820692cf71 Mon Sep 17 00:00:00 2001
2From: Jukka Rissanen <jukka.rissanen@linux.intel.com>
3Date: Wed, 13 Mar 2013 11:16:33 +0200
4Subject: [PATCH 2/3] systemd: Use environment file for connmand debug options
5
6Upstream-Status: Denied
7
8Not accepted as distros can override the default ConnMan service file.
9
10Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
11---
12 src/connman.service.in | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/src/connman.service.in b/src/connman.service.in
16index 2e9e4d5..fa57d4e 100644
17--- a/src/connman.service.in
18+++ b/src/connman.service.in
19@@ -6,7 +6,8 @@ After=syslog.target
20 Type=dbus
21 BusName=net.connman
22 Restart=on-failure
23-ExecStart=@prefix@/sbin/connmand -n
24+EnvironmentFile=-@sysconfdir@/connman/connmand.env
25+ExecStart=@prefix@/sbin/connmand -n $DEBUG
26 StandardOutput=null
27
28 [Install]
29--
301.7.11.4
31
diff --git a/meta-eca/recipes-connectivity/connman/files/0003-systemd-Use-environment-file-for-connman-vpnd-debug-.patch b/meta-eca/recipes-connectivity/connman/files/0003-systemd-Use-environment-file-for-connman-vpnd-debug-.patch
new file mode 100644
index 0000000..31d5bc8
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/0003-systemd-Use-environment-file-for-connman-vpnd-debug-.patch
@@ -0,0 +1,32 @@
1From 5fb01b667a56d65ccb2b1174df9fe7190a5349f2 Mon Sep 17 00:00:00 2001
2From: Jukka Rissanen <jukka.rissanen@linux.intel.com>
3Date: Wed, 13 Mar 2013 11:17:24 +0200
4Subject: [PATCH 3/3] systemd: Use environment file for connman-vpnd debug
5 options
6
7Upstream-Status: Denied
8
9Not accepted as distros can override the default ConnMan service file.
10
11Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
12---
13 vpn/connman-vpn.service.in | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-)
15
16diff --git a/vpn/connman-vpn.service.in b/vpn/connman-vpn.service.in
17index ec02a86..2472f00 100644
18--- a/vpn/connman-vpn.service.in
19+++ b/vpn/connman-vpn.service.in
20@@ -5,7 +5,8 @@ After=syslog.target
21 [Service]
22 Type=dbus
23 BusName=net.connman.vpn
24-ExecStart=@prefix@/sbin/connman-vpnd -n
25+EnvironmentFile=-@sysconfdir@/connman/connman-vpnd.env
26+ExecStart=@prefix@/sbin/connman-vpnd -n $DEBUG
27 StandardOutput=null
28
29 [Install]
30--
311.7.11.4
32
diff --git a/meta-eca/recipes-connectivity/connman/files/add_xuser_dbus_permission.patch b/meta-eca/recipes-connectivity/connman/files/add_xuser_dbus_permission.patch
new file mode 100644
index 0000000..707b3ca
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/add_xuser_dbus_permission.patch
@@ -0,0 +1,21 @@
1Because Poky doesn't support at_console we need to special-case the session
2user.
3
4Upstream-Status: Inappropriate [configuration]
5
6Signed-off-by: Ross Burton <ross.burton@intel.com>
7
8diff --git a/src/connman-dbus.conf b/src/connman-dbus.conf
9index 98a773e..466809c 100644
10--- a/src/connman-dbus.conf
11+++ b/src/connman-dbus.conf
12@@ -8,6 +8,9 @@
13 <allow send_interface="net.connman.Counter"/>
14 <allow send_interface="net.connman.Notification"/>
15 </policy>
16+ <policy user="xuser">
17+ <allow send_destination="net.connman"/>
18+ </policy>
19 <policy at_console="true">
20 <allow send_destination="net.connman"/>
21 </policy>
diff --git a/meta-eca/recipes-connectivity/connman/files/connman b/meta-eca/recipes-connectivity/connman/files/connman
new file mode 100644
index 0000000..4a0017f
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/connman
@@ -0,0 +1,61 @@
1#!/bin/sh
2
3DAEMON=/usr/sbin/connmand
4PIDFILE=/var/run/connmand.pid
5DESC="Connection Manager"
6
7if [ -f /etc/default/connman ] ; then
8 . /etc/default/connman
9fi
10
11set -e
12
13nfsroot=0
14
15exec 9<&0 < /proc/mounts
16while read dev mtpt fstype rest; do
17 if test $mtpt = "/" ; then
18 case $fstype in
19 nfs | nfs4)
20 nfsroot=1
21 break
22 ;;
23 *)
24 ;;
25 esac
26 fi
27done
28
29do_start() {
30 EXTRA_PARAM=""
31 if test $nfsroot -eq 0 ; then
32 $DAEMON $EXTRA_PARAM
33 fi
34}
35
36do_stop() {
37 start-stop-daemon --stop --name connmand --quiet
38}
39
40case "$1" in
41 start)
42 echo "Starting $DESC"
43 do_start
44 ;;
45 stop)
46 echo "Stopping $DESC"
47 do_stop
48 ;;
49 restart|force-reload)
50 echo "Restarting $DESC"
51 do_stop
52 sleep 1
53 do_start
54 ;;
55 *)
56 echo "Usage: $0 {start|stop|restart|force-reload}" >&2
57 exit 1
58 ;;
59esac
60
61exit 0
diff --git a/meta-eca/recipes-connectivity/connman/files/connman-init-settings.sh b/meta-eca/recipes-connectivity/connman/files/connman-init-settings.sh
new file mode 100755
index 0000000..9b4f040
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/connman-init-settings.sh
@@ -0,0 +1,96 @@
1#!/bin/sh
2#
3# Connection Manager Init Service
4#
5# Copyright (C) 2012 Intel Corporation. All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20
21CONNMAN_DIR=/var/lib/connman
22CONNMAN_SETTINGS=$CONNMAN_DIR/settings
23
24if [ -s $CONNMAN_SETTINGS ]; then
25 exit 0
26fi
27
28if [ ! -d $CONNMAN_DIR ]; then
29 mkdir -p $CONNMAN_DIR
30fi
31
32TETHERING="$1"
33TETHERING_AP_PASSPHRASE="$2"
34TETHERING_AP_SSID="$3"
35
36if [ -z "$TETHERING" ]; then
37 TETHERING="true"
38fi
39
40# Create main.conf with those values that we need
41MAINCONF=/etc/connman/main.conf
42cat > $MAINCONF <<EOF
43[General]
44TetheringTechnologies=wifi,bluetooth,gadget,ethernet
45PersistentTetheringMode=true
46EOF
47
48function get_mac
49{
50 # Get the mac address of the first network interface returned by kernel
51 IFACE=`head -n 3 /proc/net/dev|tail -n 1|awk '{ print $1 }'|sed 's/://'`
52 if [ -z "$IFACE" -o ! -d /sys/class/net/$IFACE ]; then
53 echo 010203040506
54 else
55 sed 's/://g' /sys/class/net/$IFACE/address
56 fi
57}
58
59if [ -z "$TETHERING_AP_SSID" ]; then
60 MAC=`get_mac`
61 TETHERING_AP_SSID=eca-$MAC
62fi
63
64if [ -z "$TETHERING_AP_PASSPHRASE" ]; then
65 if [ -z "$MAC" ]; then
66 MAC=`get_mac`
67 fi
68 TETHERING_AP_PASSPHRASE=$MAC
69fi
70
71cat > $CONNMAN_SETTINGS <<EOF
72[global]
73OfflineMode=false
74
75[Bluetooth]
76Enable=true
77
78[Cellular]
79Enable=true
80
81[WiFi]
82Enable=true
83Tethering=$TETHERING
84Tethering.Identifier=$TETHERING_AP_SSID
85Tethering.Passphrase=$TETHERING_AP_PASSPHRASE
86
87
88[Wired]
89Enable=true
90EOF
91
92if [ $? -eq 0 -a -f $CONNMAN_SETTINGS ]; then
93 chmod 0600 $CONNMAN_SETTINGS
94fi
95
96exit 0
diff --git a/meta-eca/recipes-connectivity/connman/files/connman-init.service b/meta-eca/recipes-connectivity/connman/files/connman-init.service
new file mode 100644
index 0000000..5b9b3f0
--- /dev/null
+++ b/meta-eca/recipes-connectivity/connman/files/connman-init.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Initialize ConnMan settings
3After=syslog.target
4ConditionFileNotEmpty=!/var/lib/connman/settings
5
6[Service]
7Type=oneshot
8EnvironmentFile=-/etc/connman/connmand.env
9ExecStart=-/usr/lib/connman/connman-init-settings.sh $TETHERING $AP_PASSPHRASE $AP_SSID
10StandardOutput=null
11
12[Install]
13WantedBy=connman.service