diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:29:32 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 13:29:32 +0200 |
commit | 6b4c82f4657bdb56e6b7a56651d6d4bb91a35b8f (patch) | |
tree | 814ad3da280833de03535ca04cf5068da1d31822 /meta-eca/recipes-connectivity/connman | |
download | meta-eca-daisy-enea.tar.gz |
initial commit for Enea Linux 4.0daisy-enea
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta-eca/recipes-connectivity/connman')
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 @@ | |||
1 | SUMMARY = "Initialization service for ConnMan" | ||
2 | DESCRIPTION = "Initializes necessary ConnMan services. This is \ | ||
3 | needed in headless system, otherwise we might not be able to \ | ||
4 | connect to device after installation. This service is only run \ | ||
5 | once in the first boot.\ | ||
6 | " | ||
7 | LICENSE = "GPLv2" | ||
8 | LIC_FILES_CHKSUM = "file://connman-init-settings.sh;beginline=7;endline=18;md5=95c5d66479370ef3964c4aef9255476f" | ||
9 | |||
10 | SRC_URI = "\ | ||
11 | file://connman-init-settings.sh \ | ||
12 | file://connman-init.service \ | ||
13 | " | ||
14 | |||
15 | S = "${WORKDIR}" | ||
16 | PR = "r0" | ||
17 | |||
18 | inherit systemd | ||
19 | |||
20 | SYSTEMD_PACKAGES = "connman-init-systemd" | ||
21 | |||
22 | SYSTEMD_SERVICE_${PN} = " connman-init.service" | ||
23 | |||
24 | FILES_${PN} = " connman-init.service \ | ||
25 | ${libdir}/connman/connman-init-settings.sh" | ||
26 | |||
27 | do_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 @@ | |||
1 | require recipes-connectivity/connman/connman.inc | ||
2 | |||
3 | # We use a known good version instead of some buggy point version. | ||
4 | SRCREV = "f5a441e9d636eefd98335322e79e71ca7e4f55cc" | ||
5 | SRC_URI = "\ | ||
6 | git://git.kernel.org/pub/scm/network/connman/connman.git \ | ||
7 | file://add_xuser_dbus_permission.patch \ | ||
8 | " | ||
9 | LIC_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. | ||
15 | SRC_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 | |||
20 | S = "${WORKDIR}/git" | ||
21 | PR = "${INC_PR}.0" | ||
22 | PV = "1.23+git${SRCPV}" | ||
23 | |||
24 | |||
25 | # Override some options from poky connman recipe | ||
26 | EXTRA_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 | ||
39 | PACKAGECONFIG[bluetooth] = "--enable-bluetooth, --disable-bluetooth, bluez5" | ||
40 | RDEPENDS_${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 | |||
48 | do_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 @@ | |||
1 | From 5365d78227f3c44338079e8c9c69494d038bfa6c Mon Sep 17 00:00:00 2001 | ||
2 | From: Jukka Rissanen <jukka.rissanen@linux.intel.com> | ||
3 | Date: Wed, 13 Mar 2013 11:15:21 +0200 | ||
4 | Subject: [PATCH 1/3] doc: Debugging in host that uses systemd | ||
5 | |||
6 | Upstream-Status: Denied | ||
7 | |||
8 | Not accepted as distros can override the default ConnMan service file. | ||
9 | |||
10 | Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> | ||
11 | --- | ||
12 | README | 16 ++++++++++++++++ | ||
13 | 1 file changed, 16 insertions(+) | ||
14 | |||
15 | diff --git a/README b/README | ||
16 | index 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 | -- | ||
43 | 1.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 @@ | |||
1 | From 656ff42ff42da965865cc6e012404d820692cf71 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jukka Rissanen <jukka.rissanen@linux.intel.com> | ||
3 | Date: Wed, 13 Mar 2013 11:16:33 +0200 | ||
4 | Subject: [PATCH 2/3] systemd: Use environment file for connmand debug options | ||
5 | |||
6 | Upstream-Status: Denied | ||
7 | |||
8 | Not accepted as distros can override the default ConnMan service file. | ||
9 | |||
10 | Signed-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 | |||
15 | diff --git a/src/connman.service.in b/src/connman.service.in | ||
16 | index 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 | -- | ||
30 | 1.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 @@ | |||
1 | From 5fb01b667a56d65ccb2b1174df9fe7190a5349f2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jukka Rissanen <jukka.rissanen@linux.intel.com> | ||
3 | Date: Wed, 13 Mar 2013 11:17:24 +0200 | ||
4 | Subject: [PATCH 3/3] systemd: Use environment file for connman-vpnd debug | ||
5 | options | ||
6 | |||
7 | Upstream-Status: Denied | ||
8 | |||
9 | Not accepted as distros can override the default ConnMan service file. | ||
10 | |||
11 | Signed-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 | |||
16 | diff --git a/vpn/connman-vpn.service.in b/vpn/connman-vpn.service.in | ||
17 | index 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 | -- | ||
31 | 1.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 @@ | |||
1 | Because Poky doesn't support at_console we need to special-case the session | ||
2 | user. | ||
3 | |||
4 | Upstream-Status: Inappropriate [configuration] | ||
5 | |||
6 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
7 | |||
8 | diff --git a/src/connman-dbus.conf b/src/connman-dbus.conf | ||
9 | index 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 | |||
3 | DAEMON=/usr/sbin/connmand | ||
4 | PIDFILE=/var/run/connmand.pid | ||
5 | DESC="Connection Manager" | ||
6 | |||
7 | if [ -f /etc/default/connman ] ; then | ||
8 | . /etc/default/connman | ||
9 | fi | ||
10 | |||
11 | set -e | ||
12 | |||
13 | nfsroot=0 | ||
14 | |||
15 | exec 9<&0 < /proc/mounts | ||
16 | while 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 | ||
27 | done | ||
28 | |||
29 | do_start() { | ||
30 | EXTRA_PARAM="" | ||
31 | if test $nfsroot -eq 0 ; then | ||
32 | $DAEMON $EXTRA_PARAM | ||
33 | fi | ||
34 | } | ||
35 | |||
36 | do_stop() { | ||
37 | start-stop-daemon --stop --name connmand --quiet | ||
38 | } | ||
39 | |||
40 | case "$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 | ;; | ||
59 | esac | ||
60 | |||
61 | exit 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 | |||
21 | CONNMAN_DIR=/var/lib/connman | ||
22 | CONNMAN_SETTINGS=$CONNMAN_DIR/settings | ||
23 | |||
24 | if [ -s $CONNMAN_SETTINGS ]; then | ||
25 | exit 0 | ||
26 | fi | ||
27 | |||
28 | if [ ! -d $CONNMAN_DIR ]; then | ||
29 | mkdir -p $CONNMAN_DIR | ||
30 | fi | ||
31 | |||
32 | TETHERING="$1" | ||
33 | TETHERING_AP_PASSPHRASE="$2" | ||
34 | TETHERING_AP_SSID="$3" | ||
35 | |||
36 | if [ -z "$TETHERING" ]; then | ||
37 | TETHERING="true" | ||
38 | fi | ||
39 | |||
40 | # Create main.conf with those values that we need | ||
41 | MAINCONF=/etc/connman/main.conf | ||
42 | cat > $MAINCONF <<EOF | ||
43 | [General] | ||
44 | TetheringTechnologies=wifi,bluetooth,gadget,ethernet | ||
45 | PersistentTetheringMode=true | ||
46 | EOF | ||
47 | |||
48 | function 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 | |||
59 | if [ -z "$TETHERING_AP_SSID" ]; then | ||
60 | MAC=`get_mac` | ||
61 | TETHERING_AP_SSID=eca-$MAC | ||
62 | fi | ||
63 | |||
64 | if [ -z "$TETHERING_AP_PASSPHRASE" ]; then | ||
65 | if [ -z "$MAC" ]; then | ||
66 | MAC=`get_mac` | ||
67 | fi | ||
68 | TETHERING_AP_PASSPHRASE=$MAC | ||
69 | fi | ||
70 | |||
71 | cat > $CONNMAN_SETTINGS <<EOF | ||
72 | [global] | ||
73 | OfflineMode=false | ||
74 | |||
75 | [Bluetooth] | ||
76 | Enable=true | ||
77 | |||
78 | [Cellular] | ||
79 | Enable=true | ||
80 | |||
81 | [WiFi] | ||
82 | Enable=true | ||
83 | Tethering=$TETHERING | ||
84 | Tethering.Identifier=$TETHERING_AP_SSID | ||
85 | Tethering.Passphrase=$TETHERING_AP_PASSPHRASE | ||
86 | |||
87 | |||
88 | [Wired] | ||
89 | Enable=true | ||
90 | EOF | ||
91 | |||
92 | if [ $? -eq 0 -a -f $CONNMAN_SETTINGS ]; then | ||
93 | chmod 0600 $CONNMAN_SETTINGS | ||
94 | fi | ||
95 | |||
96 | exit 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] | ||
2 | Description=Initialize ConnMan settings | ||
3 | After=syslog.target | ||
4 | ConditionFileNotEmpty=!/var/lib/connman/settings | ||
5 | |||
6 | [Service] | ||
7 | Type=oneshot | ||
8 | EnvironmentFile=-/etc/connman/connmand.env | ||
9 | ExecStart=-/usr/lib/connman/connman-init-settings.sh $TETHERING $AP_PASSPHRASE $AP_SSID | ||
10 | StandardOutput=null | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=connman.service | ||