diff options
Diffstat (limited to 'meta-ivi/recipes-connectivity')
12 files changed, 877 insertions, 6 deletions
diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0001-plugins-Add-initial-code-for-service-plugin.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0001-plugins-Add-initial-code-for-service-plugin.patch new file mode 100644 index 0000000..9affbbe --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0001-plugins-Add-initial-code-for-service-plugin.patch @@ -0,0 +1,97 @@ +From 5b444f8930a2635d52a676f0600e80828cc876c9 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Sun, 5 Jan 2014 18:02:56 +0200 +Subject: [PATCH 01/12] plugins: Add initial code for service plugin + +This plugin will be used to control services individually. +--- + Makefile.plugins | 8 ++++++++ + configure.ac | 4 ++++ + plugins/service.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 56 insertions(+) + create mode 100644 plugins/service.c + +diff --git a/Makefile.plugins b/Makefile.plugins +index f0eada9..3ab27e2 100644 +--- a/Makefile.plugins ++++ b/Makefile.plugins +@@ -119,3 +119,11 @@ plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ + -no-undefined @UDEV_LIBS@ + plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@ + endif ++ ++if SERVICE ++plugin_LTLIBRARIES += plugins/service.la ++plugins_service_la_SOURCES = plugins/service.c ++plugins_service_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ ++ -no-undefined ++plugins_service_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden ++endif +diff --git a/configure.ac b/configure.ac +index d858ff6..6d31dd3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -221,6 +221,10 @@ AC_ARG_ENABLE(sixaxis, AC_HELP_STRING([--enable-sixaxis], + AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" && + test "${enable_udev}" != "no") + ++AC_ARG_ENABLE(service, AC_HELP_STRING([--enable-service], ++ [enable service plugin]), [enable_service=${enableval}]) ++AM_CONDITIONAL(SERVICE, test "${enable_service}" = "yes") ++ + if (test "${prefix}" = "NONE"); then + dnl no prefix and no localstatedir, so default to /var + if (test "$localstatedir" = '${prefix}/var'); then +diff --git a/plugins/service.c b/plugins/service.c +new file mode 100644 +index 0000000..e63d8a8 +--- /dev/null ++++ b/plugins/service.c +@@ -0,0 +1,44 @@ ++/* ++ * ++ * BlueZ - Bluetooth protocol stack for Linux ++ * ++ * Copyright (C) 2014 Intel Corporation. ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include "src/plugin.h" ++#include "src/log.h" ++ ++static int service_init(void) ++{ ++ DBG(""); ++ ++ return 0; ++} ++ ++static void service_exit(void) ++{ ++ DBG(""); ++} ++ ++BLUETOOTH_PLUGIN_DEFINE(service, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, ++ service_init, service_exit) +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0002-plugins-service-Add-initial-code.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0002-plugins-service-Add-initial-code.patch new file mode 100644 index 0000000..bbb6fef --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0002-plugins-service-Add-initial-code.patch @@ -0,0 +1,168 @@ +From 7ddb6d998cf56da8e3d21c4c879cfdb0b4b20150 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Sun, 5 Jan 2014 19:08:29 +0200 +Subject: [PATCH 02/12] plugins/service: Add initial code + +Add initial code that creates service objects data. +--- + plugins/service.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 131 insertions(+), 1 deletion(-) + +diff --git a/plugins/service.c b/plugins/service.c +index e63d8a8..0c22d79 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -25,19 +25,149 @@ + #include <config.h> + #endif + +-#include "src/plugin.h" ++#include <stdio.h> ++#include <errno.h> ++#include <unistd.h> ++ ++#include <glib.h> ++#include <gdbus/gdbus.h> ++ ++#include "lib/uuid.h" + #include "src/log.h" ++#include "src/plugin.h" ++#include "src/dbus-common.h" ++#include "src/error.h" ++#include "src/adapter.h" ++#include "src/device.h" ++#include "src/service.h" ++#include "src/profile.h" ++ ++#define SERVICE_INTERFACE "org.bluez.Service1" ++ ++static unsigned int service_id = 0; ++static GSList *services = NULL; ++ ++struct service_data { ++ struct btd_service *service; ++ char *path; ++}; ++ ++static struct service_data *find_data(struct btd_service *service) ++{ ++ GSList *l; ++ ++ for (l = services; l; l = l->next) { ++ struct service_data *data = l->data; ++ ++ if (data->service == service) ++ return data; ++ } ++ ++ return NULL; ++} ++ ++static void data_free(void *user_data) ++{ ++ struct service_data *data = user_data; ++ ++ g_free(data->path); ++ g_free(data); ++} ++ ++static void data_remove(struct service_data *data) ++{ ++ services = g_slist_remove(services, data); ++ g_dbus_unregister_interface(btd_get_dbus_connection(), data->path, ++ SERVICE_INTERFACE); ++} ++ ++static DBusMessage *service_disconnect(DBusConnection *conn, DBusMessage *msg, ++ void *user_data) ++{ ++ return btd_error_not_available(msg); ++} ++ ++static DBusMessage *service_connect(DBusConnection *conn, DBusMessage *msg, ++ void *user_data) ++{ ++ return btd_error_not_available(msg); ++} ++ ++static const GDBusMethodTable service_methods[] = { ++ { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, service_disconnect) }, ++ { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, service_connect) }, ++ {} ++}; ++ ++static struct service_data *service_get_data(struct btd_service *service) ++{ ++ struct btd_device *dev = btd_service_get_device(service); ++ struct btd_profile *p = btd_service_get_profile(service); ++ struct service_data *data; ++ ++ data = find_data(service); ++ if (data != NULL) ++ return data; ++ ++ data = g_new0(struct service_data, 1); ++ data->path = g_strdup_printf("%s/%s", btd_device_get_path(dev), ++ p->remote_uuid); ++ data->path = g_strdelimit(data->path, "-", '_'); ++ data->service = service; ++ if (g_dbus_register_interface(btd_get_dbus_connection(), ++ data->path, SERVICE_INTERFACE, ++ service_methods, NULL, ++ NULL, data, ++ data_free) == FALSE) { ++ error("Unable to register service interface for %s", ++ data->path); ++ data_free(data); ++ return NULL; ++ } ++ ++ services = g_slist_prepend(services, data); ++ ++ DBG("%s", data->path); ++ ++ return data; ++} ++ ++static void service_cb(struct btd_service *service, ++ btd_service_state_t old_state, ++ btd_service_state_t new_state, ++ void *user_data) ++{ ++ struct service_data *data; ++ ++ data = service_get_data(service); ++ if (!data) ++ return; ++ ++ switch (new_state) { ++ case BTD_SERVICE_STATE_UNAVAILABLE: ++ data_remove(data); ++ break; ++ default: ++ return; ++ } ++} + + static int service_init(void) + { + DBG(""); + ++ service_id = btd_service_add_state_cb(service_cb, NULL); ++ + return 0; + } + + static void service_exit(void) + { + DBG(""); ++ ++ btd_service_remove_state_cb(service_id); ++ ++ g_slist_free_full(services, data_free); + } + + BLUETOOTH_PLUGIN_DEFINE(service, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0003-plugins-service-Add-State-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0003-plugins-service-Add-State-property.patch new file mode 100644 index 0000000..da2ac79 --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0003-plugins-service-Add-State-property.patch @@ -0,0 +1,88 @@ +From 879cd4b30144c1b16f1b4f97a3bb28c217bf949d Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Mon, 6 Jan 2014 16:02:27 +0200 +Subject: [PATCH 03/12] plugins/service: Add State property + +--- + plugins/service.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 46 insertions(+), 3 deletions(-) + +diff --git a/plugins/service.c b/plugins/service.c +index 0c22d79..b660810 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -93,6 +93,46 @@ static DBusMessage *service_connect(DBusConnection *conn, DBusMessage *msg, + return btd_error_not_available(msg); + } + ++static const char *data_get_state(struct service_data *data) ++{ ++ btd_service_state_t state = btd_service_get_state(data->service); ++ int err; ++ ++ switch (state) { ++ case BTD_SERVICE_STATE_UNAVAILABLE: ++ return "unavailable"; ++ case BTD_SERVICE_STATE_DISCONNECTED: ++ err = btd_service_get_error(data->service); ++ return err < 0 ? "error" : "disconnected"; ++ case BTD_SERVICE_STATE_CONNECTING: ++ return "connecting"; ++ case BTD_SERVICE_STATE_CONNECTED: ++ return "connected"; ++ case BTD_SERVICE_STATE_DISCONNECTING: ++ return "disconnecting"; ++ } ++ ++ return "unknown"; ++} ++ ++static gboolean get_state(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ const char *state; ++ ++ state = data_get_state(data); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &state); ++ ++ return TRUE; ++} ++ ++static const GDBusPropertyTable service_properties[] = { ++ { "State", "s", get_state, NULL, NULL }, ++ { } ++}; ++ + static const GDBusMethodTable service_methods[] = { + { GDBUS_ASYNC_METHOD("Disconnect", NULL, NULL, service_disconnect) }, + { GDBUS_ASYNC_METHOD("Connect", NULL, NULL, service_connect) }, +@@ -117,7 +157,7 @@ static struct service_data *service_get_data(struct btd_service *service) + if (g_dbus_register_interface(btd_get_dbus_connection(), + data->path, SERVICE_INTERFACE, + service_methods, NULL, +- NULL, data, ++ service_properties, data, + data_free) == FALSE) { + error("Unable to register service interface for %s", + data->path); +@@ -146,10 +186,13 @@ static void service_cb(struct btd_service *service, + switch (new_state) { + case BTD_SERVICE_STATE_UNAVAILABLE: + data_remove(data); +- break; +- default: + return; ++ default: ++ break; + } ++ ++ g_dbus_emit_property_changed(btd_get_dbus_connection(), data->path, ++ SERVICE_INTERFACE, "State"); + } + + static int service_init(void) +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0004-plugins-service-Add-RemoteUUID-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0004-plugins-service-Add-RemoteUUID-property.patch new file mode 100644 index 0000000..2643fc9 --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0004-plugins-service-Add-RemoteUUID-property.patch @@ -0,0 +1,46 @@ +From edff2c3b4438603402241c80d60a51c51200b2f0 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Mon, 6 Jan 2014 16:13:49 +0200 +Subject: [PATCH 04/12] plugins/service: Add RemoteUUID property + +--- + plugins/service.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index b660810..7b5783d 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -128,8 +128,29 @@ static gboolean get_state(const GDBusPropertyTable *property, + return TRUE; + } + ++static gboolean remote_uuid_exists(const GDBusPropertyTable *property, ++ void *user_data) ++{ ++ struct service_data *data = user_data; ++ struct btd_profile *p = btd_service_get_profile(data->service); ++ ++ return p->remote_uuid != NULL; ++} ++ ++static gboolean get_remote_uuid(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ struct btd_profile *p = btd_service_get_profile(data->service); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &p->remote_uuid); ++ ++ return TRUE; ++} ++ + static const GDBusPropertyTable service_properties[] = { + { "State", "s", get_state, NULL, NULL }, ++ { "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists }, + { } + }; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0005-plugins-service-Add-LocalUUID-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0005-plugins-service-Add-LocalUUID-property.patch new file mode 100644 index 0000000..194d95b --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0005-plugins-service-Add-LocalUUID-property.patch @@ -0,0 +1,48 @@ +From bdfbfc2d3d7558fc05c2587ca1b142d9a6abb7be Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Mon, 6 Jan 2014 16:19:39 +0200 +Subject: [PATCH 05/12] plugins/service: Add LocalUUID property + +--- + plugins/service.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index 7b5783d..207ac21 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -148,9 +148,31 @@ static gboolean get_remote_uuid(const GDBusPropertyTable *property, + return TRUE; + } + ++ ++static gboolean local_uuid_exists(const GDBusPropertyTable *property, ++ void *user_data) ++{ ++ struct service_data *data = user_data; ++ struct btd_profile *p = btd_service_get_profile(data->service); ++ ++ return p->local_uuid != NULL; ++} ++ ++static gboolean get_local_uuid(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ struct btd_profile *p = btd_service_get_profile(data->service); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &p->local_uuid); ++ ++ return TRUE; ++} ++ + static const GDBusPropertyTable service_properties[] = { + { "State", "s", get_state, NULL, NULL }, + { "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists }, ++ { "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists }, + { } + }; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0006-plugins-service-Add-implemention-of-.Connect-method.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0006-plugins-service-Add-implemention-of-.Connect-method.patch new file mode 100644 index 0000000..3e601ad --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0006-plugins-service-Add-implemention-of-.Connect-method.patch @@ -0,0 +1,104 @@ +From 2b63b5c56bc96e23c11be5b1d31ec80194f68e48 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Mon, 6 Jan 2014 16:59:36 +0200 +Subject: [PATCH 06/12] plugins/service: Add implemention of .Connect method + +--- + plugins/service.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 52 insertions(+), 1 deletion(-) + +diff --git a/plugins/service.c b/plugins/service.c +index 207ac21..ded4487 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -50,6 +50,7 @@ static GSList *services = NULL; + struct service_data { + struct btd_service *service; + char *path; ++ DBusMessage *connect; + }; + + static struct service_data *find_data(struct btd_service *service) +@@ -70,6 +71,9 @@ static void data_free(void *user_data) + { + struct service_data *data = user_data; + ++ if (data->connect) ++ dbus_message_unref(data->connect); ++ + g_free(data->path); + g_free(data); + } +@@ -90,7 +94,19 @@ static DBusMessage *service_disconnect(DBusConnection *conn, DBusMessage *msg, + static DBusMessage *service_connect(DBusConnection *conn, DBusMessage *msg, + void *user_data) + { +- return btd_error_not_available(msg); ++ struct service_data *data = user_data; ++ int err; ++ ++ if (data->connect) ++ return btd_error_in_progress(msg); ++ ++ err = btd_service_connect(data->service); ++ if (err < 0) ++ return btd_error_failed(msg, strerror(-err)); ++ ++ data->connect = dbus_message_ref(msg); ++ ++ return NULL; + } + + static const char *data_get_state(struct service_data *data) +@@ -215,6 +231,35 @@ static struct service_data *service_get_data(struct btd_service *service) + return data; + } + ++static void service_connected(struct service_data *data) ++{ ++ DBusMessage *reply; ++ ++ if (!data->connect) ++ return; ++ ++ reply = dbus_message_new_method_return(data->connect); ++ g_dbus_send_message(btd_get_dbus_connection(), reply); ++ dbus_message_unref(data->connect); ++ data->connect = NULL; ++} ++ ++static void service_disconnected(struct service_data *data) ++{ ++ DBusMessage *reply; ++ int err; ++ ++ if (!data->connect) ++ return; ++ ++ err = btd_service_get_error(data->service); ++ ++ reply = btd_error_failed(data->connect, strerror(-err)); ++ g_dbus_send_message(btd_get_dbus_connection(), reply); ++ dbus_message_unref(data->connect); ++ data->connect = NULL; ++} ++ + static void service_cb(struct btd_service *service, + btd_service_state_t old_state, + btd_service_state_t new_state, +@@ -230,6 +275,12 @@ static void service_cb(struct btd_service *service, + case BTD_SERVICE_STATE_UNAVAILABLE: + data_remove(data); + return; ++ case BTD_SERVICE_STATE_CONNECTED: ++ service_connected(data); ++ break; ++ case BTD_SERVICE_STATE_DISCONNECTED: ++ service_disconnected(data); ++ break; + default: + break; + } +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0007-plugins-service-Add-implemention-of-.Disconnect-meth.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0007-plugins-service-Add-implemention-of-.Disconnect-meth.patch new file mode 100644 index 0000000..20176da --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0007-plugins-service-Add-implemention-of-.Disconnect-meth.patch @@ -0,0 +1,72 @@ +From 7c830fb36836b73e0b031a0d52e060922c252583 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Mon, 6 Jan 2014 17:11:43 +0200 +Subject: [PATCH 07/12] plugins/service: Add implemention of .Disconnect method + +--- + plugins/service.c | 28 +++++++++++++++++++++++++++- + 1 file changed, 27 insertions(+), 1 deletion(-) + +diff --git a/plugins/service.c b/plugins/service.c +index ded4487..69bae8f 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -51,6 +51,7 @@ struct service_data { + struct btd_service *service; + char *path; + DBusMessage *connect; ++ DBusMessage *disconnect; + }; + + static struct service_data *find_data(struct btd_service *service) +@@ -74,6 +75,9 @@ static void data_free(void *user_data) + if (data->connect) + dbus_message_unref(data->connect); + ++ if (data->disconnect) ++ dbus_message_unref(data->disconnect); ++ + g_free(data->path); + g_free(data); + } +@@ -88,7 +92,22 @@ static void data_remove(struct service_data *data) + static DBusMessage *service_disconnect(DBusConnection *conn, DBusMessage *msg, + void *user_data) + { +- return btd_error_not_available(msg); ++ struct service_data *data = user_data; ++ int err; ++ ++ if (data->disconnect) ++ return btd_error_in_progress(msg); ++ ++ data->disconnect = dbus_message_ref(msg); ++ ++ err = btd_service_disconnect(data->service); ++ if (err == 0) ++ return NULL; ++ ++ dbus_message_unref(data->disconnect); ++ data->disconnect = NULL; ++ ++ return btd_error_failed(msg, strerror(-err)); + } + + static DBusMessage *service_connect(DBusConnection *conn, DBusMessage *msg, +@@ -249,6 +268,13 @@ static void service_disconnected(struct service_data *data) + DBusMessage *reply; + int err; + ++ if (data->disconnect) { ++ reply = dbus_message_new_method_return(data->disconnect); ++ g_dbus_send_message(btd_get_dbus_connection(), reply); ++ dbus_message_unref(data->disconnect); ++ data->connect = NULL; ++ } ++ + if (!data->connect) + return; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0008-plugins-service-Add-Device-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0008-plugins-service-Add-Device-property.patch new file mode 100644 index 0000000..9cbdb7f --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0008-plugins-service-Add-Device-property.patch @@ -0,0 +1,43 @@ +From d09615e22c2511c8f6404152e80d569e695f8195 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Tue, 28 Jan 2014 09:43:53 -0800 +Subject: [PATCH 08/12] plugins/service: Add Device property + +--- + plugins/service.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index 69bae8f..128ad7c 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -150,6 +150,18 @@ static const char *data_get_state(struct service_data *data) + return "unknown"; + } + ++static gboolean get_device(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ struct btd_device *dev = btd_service_get_device(data->service); ++ const char *path = btd_device_get_path(dev); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); ++ ++ return TRUE; ++} ++ + static gboolean get_state(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *user_data) + { +@@ -205,6 +217,7 @@ static gboolean get_local_uuid(const GDBusPropertyTable *property, + } + + static const GDBusPropertyTable service_properties[] = { ++ { "Device", "o", get_device, NULL, NULL }, + { "State", "s", get_state, NULL, NULL }, + { "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists }, + { "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists }, +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0009-plugins-service-Add-Version-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0009-plugins-service-Add-Version-property.patch new file mode 100644 index 0000000..01971b9 --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0009-plugins-service-Add-Version-property.patch @@ -0,0 +1,49 @@ +From 9770dbd83a39f4511d55df26016d2ff955f04031 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Fri, 7 Feb 2014 16:04:32 +0200 +Subject: [PATCH 09/12] plugins/service: Add Version property + +--- + plugins/service.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index 128ad7c..c2584c0 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -216,11 +216,32 @@ static gboolean get_local_uuid(const GDBusPropertyTable *property, + return TRUE; + } + ++static gboolean version_exists(const GDBusPropertyTable *property, ++ void *user_data) ++{ ++ struct service_data *data = user_data; ++ uint16_t version = btd_service_get_version(data->service); ++ ++ return version != 0x0000; ++} ++ ++static gboolean get_version(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ uint16_t version = btd_service_get_version(data->service); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &version); ++ ++ return TRUE; ++} ++ + static const GDBusPropertyTable service_properties[] = { + { "Device", "o", get_device, NULL, NULL }, + { "State", "s", get_state, NULL, NULL }, + { "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists }, + { "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists }, ++ { "Version", "q", get_version, NULL, version_exists }, + { } + }; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0010-plugins-service-Add-AutoConnect-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0010-plugins-service-Add-AutoConnect-property.patch new file mode 100644 index 0000000..724d832 --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0010-plugins-service-Add-AutoConnect-property.patch @@ -0,0 +1,63 @@ +From dfd1b1988fce28b402c2d6e483b2d07f79428431 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Fri, 7 Feb 2014 16:56:41 +0200 +Subject: [PATCH 10/12] plugins/service: Add AutoConnect property + +--- + plugins/service.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index c2584c0..bca3abd 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -236,12 +236,46 @@ static gboolean get_version(const GDBusPropertyTable *property, + return TRUE; + } + ++static gboolean get_auto_connect(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ dbus_bool_t value = btd_service_get_auto_connect(data->service); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value); ++ ++ return TRUE; ++} ++ ++static void set_auto_connect(const GDBusPropertyTable *property, ++ DBusMessageIter *value, ++ GDBusPendingPropertySet id, ++ void *user_data) ++{ ++ struct service_data *data = user_data; ++ dbus_bool_t b; ++ ++ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN) { ++ g_dbus_pending_property_error(id, ++ ERROR_INTERFACE ".InvalidArguments", ++ "Invalid arguments in method call"); ++ return; ++ } ++ ++ dbus_message_iter_get_basic(value, &b); ++ ++ btd_service_set_auto_connect(data->service, b); ++ ++ g_dbus_pending_property_success(id); ++} ++ + static const GDBusPropertyTable service_properties[] = { + { "Device", "o", get_device, NULL, NULL }, + { "State", "s", get_state, NULL, NULL }, + { "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists }, + { "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists }, + { "Version", "q", get_version, NULL, version_exists }, ++ { "AutoConnect", "b", get_auto_connect, set_auto_connect, NULL }, + { } + }; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5/0011-plugins-service-Add-Blocked-property.patch b/meta-ivi/recipes-connectivity/bluez5/bluez5/0011-plugins-service-Add-Blocked-property.patch new file mode 100644 index 0000000..4fb4a50 --- /dev/null +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5/0011-plugins-service-Add-Blocked-property.patch @@ -0,0 +1,64 @@ +From fd98f8eec102c01ea1fffccf7f520a5eaf2153e0 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> +Date: Sat, 8 Feb 2014 14:46:18 +0200 +Subject: [PATCH 11/12] plugins/service: Add Blocked property + +--- + plugins/service.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/plugins/service.c b/plugins/service.c +index bca3abd..d1db278 100644 +--- a/plugins/service.c ++++ b/plugins/service.c +@@ -269,6 +269,39 @@ static void set_auto_connect(const GDBusPropertyTable *property, + g_dbus_pending_property_success(id); + } + ++static gboolean get_blocked(const GDBusPropertyTable *property, ++ DBusMessageIter *iter, void *user_data) ++{ ++ struct service_data *data = user_data; ++ dbus_bool_t value = btd_service_is_blocked(data->service); ++ ++ dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value); ++ ++ return TRUE; ++} ++ ++static void set_blocked(const GDBusPropertyTable *property, ++ DBusMessageIter *value, ++ GDBusPendingPropertySet id, ++ void *user_data) ++{ ++ struct service_data *data = user_data; ++ dbus_bool_t b; ++ ++ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN) { ++ g_dbus_pending_property_error(id, ++ ERROR_INTERFACE ".InvalidArguments", ++ "Invalid arguments in method call"); ++ return; ++ } ++ ++ dbus_message_iter_get_basic(value, &b); ++ ++ btd_service_set_blocked(data->service, b); ++ ++ g_dbus_pending_property_success(id); ++} ++ + static const GDBusPropertyTable service_properties[] = { + { "Device", "o", get_device, NULL, NULL }, + { "State", "s", get_state, NULL, NULL }, +@@ -276,6 +309,7 @@ static const GDBusPropertyTable service_properties[] = { + { "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists }, + { "Version", "q", get_version, NULL, version_exists }, + { "AutoConnect", "b", get_auto_connect, set_auto_connect, NULL }, ++ { "Blocked", "b", get_blocked, set_blocked, NULL }, + { } + }; + +-- +2.2.0 + diff --git a/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend index 4ee80a0..ad86f55 100644 --- a/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend +++ b/meta-ivi/recipes-connectivity/bluez5/bluez5_%.bbappend @@ -1,14 +1,43 @@ +FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" + # # Service API reference implementation # Revision: 5.15 (Horizon) # Homepage: https://collab.genivi.org/wiki/display/genivi/Bluetooth+Stack+Reference+Implementation +# Actual patches copied from: +# https://review.tizen.org/git/?p=platform/upstream/bluez.git;a=commit;h=abb9a439baaaa9cd6f91ba5af8c6e426cdc8ff8e # -PV = "5.15" -PR = "horizon_r1" +SRC_URI_append = " \ + file://0001-plugins-Add-initial-code-for-service-plugin.patch \ + file://0002-plugins-service-Add-initial-code.patch \ + file://0003-plugins-service-Add-State-property.patch \ + file://0004-plugins-service-Add-RemoteUUID-property.patch \ + file://0005-plugins-service-Add-LocalUUID-property.patch \ + file://0006-plugins-service-Add-implemention-of-.Connect-method.patch \ + file://0007-plugins-service-Add-implemention-of-.Disconnect-meth.patch \ + file://0008-plugins-service-Add-Device-property.patch \ + file://0009-plugins-service-Add-Version-property.patch \ + file://0010-plugins-service-Add-AutoConnect-property.patch \ + file://0011-plugins-service-Add-Blocked-property.patch \ + " -SRC_URI_remove = "http://kernel.org/pub/linux/bluetooth/bluez-5.15.tar.xz" -SRC_URI_append = " git://git.gitorious.org/bluez/vudentzs-clone.git;protocol=http;branch=for-upstream" -SRCREV = "f76472e7983e52580afbf3a47f2f2e29e26514b9" +# we copy the EXTRA_OECONF from Poky's bluez5.inc, fix the following QA issue +# on the way and enable the Service API (--enable-service) option. +# WARNING: QA Issue: bluez5: configure was passed unrecognised options: +# --with-systemdunitdir [unknown-configure-option] +# Note: this is an issue only with the Poky "dizzy" branch and should be +# removed in case of future/later Poky versions. +# Poky rev: 419a37e09565a820fdeb2d49104cc27f6720af5a +EXTRA_OECONF = "\ + --enable-tools \ + --disable-cups \ + --enable-test \ + --enable-datafiles \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-systemd', '--disable-systemd', d)} \ + --enable-library \ + --enable-service \ +" -S = "${WORKDIR}/git" +PACKAGES =+ " libbluetooth-plugins-service " +FILES_libbluetooth-plugins-service = "${libdir}/bluetooth/plugins/*.so" |