* Re: [PATCH v2 3/4] Bluetooth: Use HCI request for LE connection
From: Andre Guedes @ 2013-10-04 20:57 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <BDCBCB2D-249D-4E3A-92C3-BCD21E28255D@holtmann.org>
Hi Marcel,
On 10/04/2013 03:25 AM, Marcel Holtmann wrote:
> Hi Andre,
>
>> This patch introduces a new helper, which uses the HCI request
>> framework, for creating LE connectons. All the handling is now
>> done by this function so we can remove the hci_cs_le_create_conn()
>> event handler.
>>
>> This patch also removes the old hci_le_create_connection() since
>> it is not used anymore.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>> include/net/bluetooth/hci_core.h | 2 ++
>> net/bluetooth/hci_conn.c | 26 ++++++-----------------
>> net/bluetooth/hci_core.c | 46 ++++++++++++++++++++++++++++++++++++++++
>> net/bluetooth/hci_event.c | 31 ---------------------------
>> 4 files changed, 54 insertions(+), 51 deletions(-)
>>
>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>> index e09c305..0835cf9 100644
>> --- a/include/net/bluetooth/hci_core.h
>> +++ b/include/net/bluetooth/hci_core.h
>> @@ -1217,6 +1217,8 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
>>
>> u8 bdaddr_to_le(u8 bdaddr_type);
>>
>> +int hci_create_le_conn(struct hci_dev *hdev, bdaddr_t *addr, u8 type);
>> +
>> #define SCO_AIRMODE_MASK 0x0003
>> #define SCO_AIRMODE_CVSD 0x0000
>> #define SCO_AIRMODE_TRANSP 0x0003
>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>> index 08e601c..cb0e5d7 100644
>> --- a/net/bluetooth/hci_conn.c
>> +++ b/net/bluetooth/hci_conn.c
>> @@ -49,25 +49,6 @@ static const struct sco_param sco_param_wideband[] = {
>> { EDR_ESCO_MASK | ESCO_EV3, 0x0008 }, /* T1 */
>> };
>>
>> -static void hci_le_create_connection(struct hci_conn *conn)
>> -{
>> - struct hci_dev *hdev = conn->hdev;
>> - struct hci_cp_le_create_conn cp;
>> -
>> - memset(&cp, 0, sizeof(cp));
>> - cp.scan_interval = __constant_cpu_to_le16(0x0060);
>> - cp.scan_window = __constant_cpu_to_le16(0x0030);
>> - bacpy(&cp.peer_addr, &conn->dst);
>> - cp.peer_addr_type = conn->dst_type;
>> - cp.conn_interval_min = __constant_cpu_to_le16(0x0028);
>> - cp.conn_interval_max = __constant_cpu_to_le16(0x0038);
>> - cp.supervision_timeout = __constant_cpu_to_le16(0x002a);
>> - cp.min_ce_len = __constant_cpu_to_le16(0x0000);
>> - cp.max_ce_len = __constant_cpu_to_le16(0x0000);
>> -
>> - hci_send_cmd(hdev, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
>> -}
>> -
>> static void hci_le_create_connection_cancel(struct hci_conn *conn)
>> {
>> hci_send_cmd(conn->hdev, HCI_OP_LE_CREATE_CONN_CANCEL, 0, NULL);
>> @@ -545,6 +526,7 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
>> u8 dst_type, u8 sec_level, u8 auth_type)
>> {
>> struct hci_conn *conn;
>> + int err;
>>
>> if (test_bit(HCI_LE_PERIPHERAL, &hdev->flags))
>> return ERR_PTR(-ENOTSUPP);
>> @@ -565,7 +547,11 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
>> conn->link_mode |= HCI_LM_MASTER;
>> conn->sec_level = BT_SECURITY_LOW;
>>
>> - hci_le_create_connection(conn);
>> + err = hci_create_le_conn(hdev, &conn->dst, conn->dst_type);
>> + if (err) {
>> + hci_conn_del(conn);
>> + return ERR_PTR(err);
>> + }
>
> it is safe to sleep here? Since that is what the new call is doing.
We are not running in an atomic section here so we are allowed to sleep.
Actually, there are other calls in this flow that may sleep. If you take
a look at a few lines up in this function, you'll find a call to
hci_conn_add() which allocates memory using GFP_KERNEL flag (so it may
sleep).
Anyway, I always compile my kernels using all those kernel hacking
options which detects errors like that and it doesn't complain about this.
>
>> }
>>
>> conn->pending_sec_level = sec_level;
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 82dbdc6..1002510 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -3662,3 +3662,49 @@ u8 bdaddr_to_le(u8 bdaddr_type)
>> return ADDR_LE_DEV_RANDOM;
>> }
>> }
>> +
>> +static void create_le_conn_complete(struct hci_dev *hdev, u8 status)
>> +{
>> + struct hci_conn *conn;
>> +
>> + if (status == 0)
>> + return;
>> +
>> + BT_ERR("HCI request failed to initiate LE connection: status 0x%2.2x",
>> + status);
>
> This should say "create" instead of "initiate".
I'll fix it.
>
>> +
>> + conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT);
>> + if (!conn)
>> + return;
>> +
>
> We are no longer setting conn->state to BT_CLOSED on purpose here?
No, this is an error. I'll fix it in v3.
>
>> + mgmt_connect_failed(hdev, &conn->dst, conn->type, conn->dst_type,
>> + status);
>> +
>> + hci_proto_connect_cfm(conn, status);
>> +
>> + hci_dev_lock(hdev);
>> + hci_conn_del(conn);
>> + hci_dev_unlock(hdev);
>> +}
>
> You are changing the locking behavior without any explanation. Previous code has it around the whole section. I am not a huge fan of changes that get sneaked in this way. That should be a separate patch to explain why it is correct. This patch should not change the current behavior.
Sure, I'll fix it.
Regards,
Andre
^ permalink raw reply
* Re: [PATCHv6 0/5] Initial skeleton
From: Johan Hedberg @ 2013-10-04 12:28 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Fri, Oct 04, 2013, Andrei Emeltchenko wrote:
> Those are modified patches from Frederic Danis.
>
> Changes:
> * v6: removed -n option, print to stdout & stderr depending on type of logs.
> * v5: log is now printed to stderr
>
> Frederic Danis (5):
> build: Add skeleton for BlueZ Android
> android: Add skeleton of BlueZ Android daemon
> android-build: Add BlueZ Android daemon
> build: Add BlueZ Android daemon
> android: Android version of log.c
>
> .gitignore | 2 +
> Makefile.am | 4 +-
> Makefile.android | 8 ++++
> android/Android.mk | 31 ++++++++++++++
> android/log.c | 82 +++++++++++++++++++++++++++++++++++++
> android/main.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++
> bootstrap-configure | 1 +
> configure.ac | 5 +++
> 8 files changed, 244 insertions(+), 1 deletion(-)
> create mode 100644 Makefile.android
> create mode 100644 android/Android.mk
> create mode 100644 android/log.c
> create mode 100644 android/main.c
This patch set has now been applied upstream. Thanks.
Johan
^ permalink raw reply
* [PATCHv6 5/5] android: Android version of log.c
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
Add logging for Android, currently print logs to stderr and stdout.
---
Makefile.android | 4 +--
android/Android.mk | 2 ++
android/log.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
android/main.c | 6 ++++
4 files changed, 92 insertions(+), 2 deletions(-)
create mode 100644 android/log.c
diff --git a/Makefile.android b/Makefile.android
index e792c10..e161e6d 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -1,8 +1,8 @@
if ANDROID
noinst_PROGRAMS += android/bluetoothd
-android_bluetoothd_SOURCES = android/main.c
+android_bluetoothd_SOURCES = android/main.c src/log.c
android_bluetoothd_LDADD = @GLIB_LIBS@
endif
-EXTRA_DIST += android/Android.mk
+EXTRA_DIST += android/Android.mk android/log.c
diff --git a/android/Android.mk b/android/Android.mk
index fc3d6c2..ec820ac 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -14,10 +14,12 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main.c \
+ log.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
$(call include-path-for, glib)/glib \
+ $(LOCAL_PATH)/../src \
LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
diff --git a/android/log.c b/android/log.c
new file mode 100644
index 0000000..ce07b82
--- /dev/null
+++ b/android/log.c
@@ -0,0 +1,82 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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 <fcntl.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+#include <glib.h>
+
+void info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stdout, format, ap);
+ fprintf(stdout, "\n");
+
+ va_end(ap);
+}
+
+void warn(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
+
+void error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
+
+void btd_debug(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stdout, format, ap);
+ fprintf(stdout, "\n");
+
+ va_end(ap);
+}
diff --git a/android/main.c b/android/main.c
index f4240c3..f75b0a8 100644
--- a/android/main.c
+++ b/android/main.c
@@ -34,6 +34,8 @@
#include <glib.h>
+#include "log.h"
+
#define SHUTDOWN_GRACE_SECONDS 10
static GMainLoop *event_loop;
@@ -98,9 +100,13 @@ int main(int argc, char *argv[])
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
+ DBG("Entering main loop");
+
g_main_loop_run(event_loop);
g_main_loop_unref(event_loop);
+ info("Exit");
+
return EXIT_SUCCESS;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 4/5] build: Add BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
.gitignore | 2 ++
Makefile.android | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/.gitignore b/.gitignore
index 8a25a3e..3707209 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,3 +98,5 @@ unit/test-gobex-packet
unit/test-gobex-transfer
unit/test-*.log
unit/test-*.trs
+
+android/bluetoothd
diff --git a/Makefile.android b/Makefile.android
index 56fa9a7..e792c10 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -1 +1,8 @@
+if ANDROID
+noinst_PROGRAMS += android/bluetoothd
+
+android_bluetoothd_SOURCES = android/main.c
+android_bluetoothd_LDADD = @GLIB_LIBS@
+endif
+
EXTRA_DIST += android/Android.mk
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 3/5] android-build: Add BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
Define local mapping to glib path, otherwise this has to be inside central
place in the build repository.
---
android/Android.mk | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index 183f7e2..fc3d6c2 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -2,3 +2,28 @@ LOCAL_PATH := $(call my-dir)
# Retrieve BlueZ version from configure.ac file
BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
+
+# Specify pathmap for glib
+pathmap_INCL += glib:external/bluetooth/glib
+
+#
+# Android BlueZ daemon (bluetoothd)
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ main.c \
+
+LOCAL_C_INCLUDES := \
+ $(call include-path-for, glib) \
+ $(call include-path-for, glib)/glib \
+
+LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
+
+LOCAL_SHARED_LIBRARIES := \
+ libglib \
+
+LOCAL_MODULE := bluetoothd
+
+include $(BUILD_EXECUTABLE)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 2/5] android: Add skeleton of BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
android/main.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100644 android/main.c
diff --git a/android/main.c b/android/main.c
new file mode 100644
index 0000000..f4240c3
--- /dev/null
+++ b/android/main.c
@@ -0,0 +1,106 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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 <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <glib.h>
+
+#define SHUTDOWN_GRACE_SECONDS 10
+
+static GMainLoop *event_loop;
+
+static gboolean quit_eventloop(gpointer user_data)
+{
+ g_main_loop_quit(event_loop);
+
+ return FALSE;
+}
+
+static void sig_term(int sig)
+{
+ static bool __terminated = false;
+
+ if (!__terminated) {
+ g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
+ quit_eventloop, NULL);
+ }
+
+ __terminated = true;
+}
+
+static gboolean option_version = FALSE;
+
+static GOptionEntry options[] = {
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
+ "Show version information and exit", NULL },
+ { NULL }
+};
+
+int main(int argc, char *argv[])
+{
+ GOptionContext *context;
+ GError *err = NULL;
+ struct sigaction sa;
+
+ context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, options, NULL);
+
+ if (g_option_context_parse(context, &argc, &argv, &err) == FALSE) {
+ if (err != NULL) {
+ g_printerr("%s\n", err->message);
+ g_error_free(err);
+ } else
+ g_printerr("An unknown error occurred\n");
+
+ exit(EXIT_FAILURE);
+ }
+
+ g_option_context_free(context);
+
+ if (option_version == TRUE) {
+ printf("%s\n", VERSION);
+ exit(EXIT_SUCCESS);
+ }
+
+ event_loop = g_main_loop_new(NULL, FALSE);
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sig_term;
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+
+ g_main_loop_run(event_loop);
+
+ g_main_loop_unref(event_loop);
+
+ return EXIT_SUCCESS;
+}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 1/5] build: Add skeleton for BlueZ Android
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380887327-6652-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
Retrieve Bluetooth version from configure.ac.
---
Makefile.am | 4 +++-
Makefile.android | 1 +
android/Android.mk | 4 ++++
bootstrap-configure | 1 +
configure.ac | 5 +++++
5 files changed, 14 insertions(+), 1 deletion(-)
create mode 100644 Makefile.android
create mode 100644 android/Android.mk
diff --git a/Makefile.am b/Makefile.am
index 4e4b1c5..51204f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -179,6 +179,7 @@ test_scripts =
include Makefile.tools
include Makefile.obexd
+include Makefile.android
if HID2HCI
rulesdir = @UDEV_DIR@/rules.d
@@ -293,7 +294,8 @@ pkgconfig_DATA = lib/bluez.pc
endif
DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
- --disable-systemd --disable-udev
+ --disable-systemd --disable-udev \
+ --enable-android
DISTCLEANFILES = $(pkgconfig_DATA)
diff --git a/Makefile.android b/Makefile.android
new file mode 100644
index 0000000..56fa9a7
--- /dev/null
+++ b/Makefile.android
@@ -0,0 +1 @@
+EXTRA_DIST += android/Android.mk
diff --git a/android/Android.mk b/android/Android.mk
new file mode 100644
index 0000000..183f7e2
--- /dev/null
+++ b/android/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH := $(call my-dir)
+
+# Retrieve BlueZ version from configure.ac file
+BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
diff --git a/bootstrap-configure b/bootstrap-configure
index 7a6e7d1..dc36311 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -12,4 +12,5 @@ fi
--sysconfdir=/etc \
--localstatedir=/var \
--enable-experimental \
+ --enable-android \
--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index 41c2935..7b1f64a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,4 +242,9 @@ AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
[Directory for the configuration files])
AC_SUBST(CONFIGDIR, "${configdir}")
+AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
+ [enable BlueZ for Android]),
+ [enable_android=${enableval}])
+AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
+
AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv6 0/5] Initial skeleton
From: Andrei Emeltchenko @ 2013-10-04 11:48 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Those are modified patches from Frederic Danis.
Changes:
* v6: removed -n option, print to stdout & stderr depending on type of logs.
* v5: log is now printed to stderr
Frederic Danis (5):
build: Add skeleton for BlueZ Android
android: Add skeleton of BlueZ Android daemon
android-build: Add BlueZ Android daemon
build: Add BlueZ Android daemon
android: Android version of log.c
.gitignore | 2 +
Makefile.am | 4 +-
Makefile.android | 8 ++++
android/Android.mk | 31 ++++++++++++++
android/log.c | 82 +++++++++++++++++++++++++++++++++++++
android/main.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++
bootstrap-configure | 1 +
configure.ac | 5 +++
8 files changed, 244 insertions(+), 1 deletion(-)
create mode 100644 Makefile.android
create mode 100644 android/Android.mk
create mode 100644 android/log.c
create mode 100644 android/main.c
--
1.7.10.4
^ permalink raw reply
* Re: [PATCH 01/14] obexd/bluetooth: Remove unused local variables
From: Luiz Augusto von Dentz @ 2013-10-04 11:22 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Fri, Oct 4, 2013 at 12:05 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> This ix following build errors:
>
> CC obexd/plugins/obexd-bluetooth.o
> obexd/plugins/bluetooth.c: In function ‘register_profile_reply’:
> obexd/plugins/bluetooth.c:202:10: error: unused variable ‘err’
> [-Werror=unused-variable]
>
> obexd/plugins/bluetooth.c: In function ‘name_acquired’:
> obexd/plugins/bluetooth.c:367:15: error: unused variable ‘uuid’
> [-Werror=unused-variable]
>
> obexd/plugins/bluetooth.c: In function ‘name_released’:
> obexd/plugins/bluetooth.c:389:15: error: unused variable ‘uuid’
> [-Werror=unused-variable]
>
> obexd/plugins/bluetooth.c: In function ‘bluetooth_start’:
> obexd/plugins/bluetooth.c:400:10: error: unused variable ‘ios’
> [-Werror=unused-variable]
> ---
> obexd/plugins/bluetooth.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
> index 017ff60..7f8a26d 100644
> --- a/obexd/plugins/bluetooth.c
> +++ b/obexd/plugins/bluetooth.c
> @@ -199,7 +199,6 @@ static void register_profile_reply(DBusPendingCall *call, void *user_data)
> struct bluetooth_profile *profile = user_data;
> DBusMessage *reply = dbus_pending_call_steal_reply(call);
> DBusError derr;
> - GError *err = NULL;
>
> dbus_error_init(&derr);
> if (!dbus_set_error_from_message(&derr, reply)) {
> @@ -364,7 +363,6 @@ static void name_acquired(DBusConnection *conn, void *user_data)
>
> for (l = profiles; l; l = l->next) {
> struct bluetooth_profile *profile = l->data;
> - const char *uuid;
>
> if (profile->path != NULL)
> continue;
> @@ -386,7 +384,6 @@ static void name_released(DBusConnection *conn, void *user_data)
>
> for (l = profiles; l; l = l->next) {
> struct bluetooth_profile *profile = l->data;
> - const char *uuid;
>
> if (profile->path == NULL)
> continue;
> @@ -397,7 +394,6 @@ static void name_released(DBusConnection *conn, void *user_data)
>
> static void *bluetooth_start(struct obex_server *server, int *err)
> {
> - GSList *ios = NULL;
> const GSList *l;
>
> for (l = server->drivers; l; l = l->next) {
> --
> 1.8.4
All 14 patches applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCHv5 7/7] build: Add logging system
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
Makefile.android | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.android b/Makefile.android
index e792c10..e161e6d 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -1,8 +1,8 @@
if ANDROID
noinst_PROGRAMS += android/bluetoothd
-android_bluetoothd_SOURCES = android/main.c
+android_bluetoothd_SOURCES = android/main.c src/log.c
android_bluetoothd_LDADD = @GLIB_LIBS@
endif
-EXTRA_DIST += android/Android.mk
+EXTRA_DIST += android/Android.mk android/log.c
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 6/7] android-build: Add logging system
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
android/Android.mk | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index fc3d6c2..ec820ac 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -14,10 +14,12 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main.c \
+ log.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
$(call include-path-for, glib)/glib \
+ $(LOCAL_PATH)/../src \
LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 5/7] android: Android version of log.c
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
android/log.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
android/main.c | 6 +++++
2 files changed, 88 insertions(+)
create mode 100644 android/log.c
diff --git a/android/log.c b/android/log.c
new file mode 100644
index 0000000..31b33d9
--- /dev/null
+++ b/android/log.c
@@ -0,0 +1,82 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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 <fcntl.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+#include <glib.h>
+
+void info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
+
+void warn(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
+
+void error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
+
+void btd_debug(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+
+ va_end(ap);
+}
diff --git a/android/main.c b/android/main.c
index 1dba2d4..f88c115 100644
--- a/android/main.c
+++ b/android/main.c
@@ -34,6 +34,8 @@
#include <glib.h>
+#include "log.h"
+
#define SHUTDOWN_GRACE_SECONDS 10
static GMainLoop *event_loop;
@@ -102,9 +104,13 @@ int main(int argc, char *argv[])
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
+ DBG("Entering main loop");
+
g_main_loop_run(event_loop);
g_main_loop_unref(event_loop);
+ info("Exit");
+
return EXIT_SUCCESS;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 4/7] build: Add BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
.gitignore | 2 ++
Makefile.android | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/.gitignore b/.gitignore
index 8a25a3e..3707209 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,3 +98,5 @@ unit/test-gobex-packet
unit/test-gobex-transfer
unit/test-*.log
unit/test-*.trs
+
+android/bluetoothd
diff --git a/Makefile.android b/Makefile.android
index 56fa9a7..e792c10 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -1 +1,8 @@
+if ANDROID
+noinst_PROGRAMS += android/bluetoothd
+
+android_bluetoothd_SOURCES = android/main.c
+android_bluetoothd_LDADD = @GLIB_LIBS@
+endif
+
EXTRA_DIST += android/Android.mk
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 3/7] android-build: Add BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
Define local mapping to glib path, otherwise this has to be inside central
place in the build repository.
---
android/Android.mk | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index 183f7e2..fc3d6c2 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -2,3 +2,28 @@ LOCAL_PATH := $(call my-dir)
# Retrieve BlueZ version from configure.ac file
BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
+
+# Specify pathmap for glib
+pathmap_INCL += glib:external/bluetooth/glib
+
+#
+# Android BlueZ daemon (bluetoothd)
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ main.c \
+
+LOCAL_C_INCLUDES := \
+ $(call include-path-for, glib) \
+ $(call include-path-for, glib)/glib \
+
+LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
+
+LOCAL_SHARED_LIBRARIES := \
+ libglib \
+
+LOCAL_MODULE := bluetoothd
+
+include $(BUILD_EXECUTABLE)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 2/7] android: Add skeleton of BlueZ Android daemon
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
---
android/main.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 android/main.c
diff --git a/android/main.c b/android/main.c
new file mode 100644
index 0000000..1dba2d4
--- /dev/null
+++ b/android/main.c
@@ -0,0 +1,110 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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 <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <glib.h>
+
+#define SHUTDOWN_GRACE_SECONDS 10
+
+static GMainLoop *event_loop;
+
+static gboolean quit_eventloop(gpointer user_data)
+{
+ g_main_loop_quit(event_loop);
+
+ return FALSE;
+}
+
+static void sig_term(int sig)
+{
+ static bool __terminated = false;
+
+ if (!__terminated) {
+ g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
+ quit_eventloop, NULL);
+ }
+
+ __terminated = true;
+}
+
+static gboolean option_detach = TRUE;
+static gboolean option_version = FALSE;
+
+static GOptionEntry options[] = {
+ { "nodetach", 'n', G_OPTION_FLAG_REVERSE,
+ G_OPTION_ARG_NONE, &option_detach,
+ "Run with logging in foreground", NULL },
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
+ "Show version information and exit", NULL },
+ { NULL }
+};
+
+int main(int argc, char *argv[])
+{
+ GOptionContext *context;
+ GError *err = NULL;
+ struct sigaction sa;
+
+ context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, options, NULL);
+
+ if (g_option_context_parse(context, &argc, &argv, &err) == FALSE) {
+ if (err != NULL) {
+ g_printerr("%s\n", err->message);
+ g_error_free(err);
+ } else
+ g_printerr("An unknown error occurred\n");
+
+ exit(EXIT_FAILURE);
+ }
+
+ g_option_context_free(context);
+
+ if (option_version == TRUE) {
+ printf("%s\n", VERSION);
+ exit(EXIT_SUCCESS);
+ }
+
+ event_loop = g_main_loop_new(NULL, FALSE);
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sig_term;
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+
+ g_main_loop_run(event_loop);
+
+ g_main_loop_unref(event_loop);
+
+ return EXIT_SUCCESS;
+}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 1/7] build: Add skeleton for BlueZ Android
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1380884056-27808-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Frederic Danis <frederic.danis@linux.intel.com>
Retrieve Bluetooth version from configure.ac.
---
Makefile.am | 4 +++-
Makefile.android | 1 +
android/Android.mk | 4 ++++
bootstrap-configure | 1 +
configure.ac | 5 +++++
5 files changed, 14 insertions(+), 1 deletion(-)
create mode 100644 Makefile.android
create mode 100644 android/Android.mk
diff --git a/Makefile.am b/Makefile.am
index 4e4b1c5..51204f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -179,6 +179,7 @@ test_scripts =
include Makefile.tools
include Makefile.obexd
+include Makefile.android
if HID2HCI
rulesdir = @UDEV_DIR@/rules.d
@@ -293,7 +294,8 @@ pkgconfig_DATA = lib/bluez.pc
endif
DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
- --disable-systemd --disable-udev
+ --disable-systemd --disable-udev \
+ --enable-android
DISTCLEANFILES = $(pkgconfig_DATA)
diff --git a/Makefile.android b/Makefile.android
new file mode 100644
index 0000000..56fa9a7
--- /dev/null
+++ b/Makefile.android
@@ -0,0 +1 @@
+EXTRA_DIST += android/Android.mk
diff --git a/android/Android.mk b/android/Android.mk
new file mode 100644
index 0000000..183f7e2
--- /dev/null
+++ b/android/Android.mk
@@ -0,0 +1,4 @@
+LOCAL_PATH := $(call my-dir)
+
+# Retrieve BlueZ version from configure.ac file
+BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
diff --git a/bootstrap-configure b/bootstrap-configure
index 7a6e7d1..dc36311 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -12,4 +12,5 @@ fi
--sysconfdir=/etc \
--localstatedir=/var \
--enable-experimental \
+ --enable-android \
--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index 41c2935..7b1f64a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,4 +242,9 @@ AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
[Directory for the configuration files])
AC_SUBST(CONFIGDIR, "${configdir}")
+AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
+ [enable BlueZ for Android]),
+ [enable_android=${enableval}])
+AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
+
AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv5 0/7] Initial skeleton
From: Andrei Emeltchenko @ 2013-10-04 10:54 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Those are modified patches from Frederic Danis.
Changes:
* log is now printed to stderr
Frederic Danis (7):
build: Add skeleton for BlueZ Android
android: Add skeleton of BlueZ Android daemon
android-build: Add BlueZ Android daemon
build: Add BlueZ Android daemon
android: Android version of log.c
android-build: Add logging system
build: Add logging system
.gitignore | 2 +
Makefile.am | 4 +-
Makefile.android | 8 ++++
android/Android.mk | 31 ++++++++++++++
android/log.c | 82 ++++++++++++++++++++++++++++++++++++
android/main.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++
bootstrap-configure | 1 +
configure.ac | 5 +++
8 files changed, 248 insertions(+), 1 deletion(-)
create mode 100644 Makefile.android
create mode 100644 android/Android.mk
create mode 100644 android/log.c
create mode 100644 android/main.c
--
1.7.10.4
^ permalink raw reply
* [PATCH 2/2] Bluetooth: Add management command for setting LE scan parameters
From: Marcel Holtmann @ 2013-10-04 10:19 UTC (permalink / raw)
To: linux-bluetooth
The scan interval and window parameters are used for LE passive
background scanning and connection establishment. This allows
userspace to change the values.
These two values should be kept in sync with whatever is used for
the scan parameters service on remote devices. And it puts the
controlling daemon (for example bluetoothd) in charge of setting
the values.
Main use case would be to switch between two sets of values. One
for foreground applications and one for background applications.
At this moment, the values are only used for manual connection
establishment, but soon that should be extended to background
scanning and automatic connection establishment.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/mgmt.h | 7 +++++++
net/bluetooth/mgmt.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 2ad433bb..518c5c8 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -362,6 +362,13 @@ struct mgmt_cp_set_static_address {
} __packed;
#define MGMT_SET_STATIC_ADDRESS_SIZE 6
+#define MGMT_OP_SET_SCAN_PARAMS 0x002C
+struct mgmt_cp_set_scan_params {
+ __le16 interval;
+ __le16 window;
+} __packed;
+#define MGMT_SET_SCAN_PARAMS_SIZE 4
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
__le16 opcode;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 16125ff9..2af2f4f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3322,6 +3322,43 @@ static int set_static_address(struct sock *sk, struct hci_dev *hdev,
return err;
}
+static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
+ void *data, u16 len)
+{
+ struct mgmt_cp_set_scan_params *cp = data;
+ __u16 interval, window;
+ int err;
+
+ BT_DBG("%s", hdev->name);
+
+ if (!lmp_le_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
+ MGMT_STATUS_NOT_SUPPORTED);
+
+ interval = __le16_to_cpu(cp->interval);
+
+ if (interval < 0x0004 || interval > 0x4000)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
+ MGMT_STATUS_INVALID_PARAMS);
+
+ window = __le16_to_cpu(cp->window);
+
+ if (window < 0x0004 || window > 0x4000)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
+ MGMT_STATUS_INVALID_PARAMS);
+
+ hci_dev_lock(hdev);
+
+ hdev->le_scan_interval = interval;
+ hdev->le_scan_window = window;
+
+ err = cmd_complete(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 0, NULL, 0);
+
+ hci_dev_unlock(hdev);
+
+ return err;
+}
+
static void fast_connectable_complete(struct hci_dev *hdev, u8 status)
{
struct pending_cmd *cmd;
@@ -3658,6 +3695,7 @@ static const struct mgmt_handler {
{ set_advertising, false, MGMT_SETTING_SIZE },
{ set_bredr, false, MGMT_SETTING_SIZE },
{ set_static_address, false, MGMT_SET_STATIC_ADDRESS_SIZE },
+ { set_scan_params, false, MGMT_SET_SCAN_PARAMS_SIZE },
};
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: Make LE scan interval and window a controller option
From: Marcel Holtmann @ 2013-10-04 10:19 UTC (permalink / raw)
To: linux-bluetooth
The scan interval and window for LE passive scanning and connection
establishment should be configurable on a per controller basis. So
introduce a setting that later on will allow modifying it.
This setting does not affect LE active scanning during device
discovery phase. As long as that phase uses interleaved discovery,
it will will continuously scan.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci_core.h | 2 ++
net/bluetooth/hci_conn.c | 4 ++--
net/bluetooth/hci_core.c | 3 +++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e09c305..7442ece 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -164,6 +164,8 @@ struct hci_dev {
__u16 page_scan_interval;
__u16 page_scan_window;
__u8 page_scan_type;
+ __u16 le_scan_interval;
+ __u16 le_scan_window;
__u16 devid_source;
__u16 devid_vendor;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 08e601c..c5b115e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -55,8 +55,8 @@ static void hci_le_create_connection(struct hci_conn *conn)
struct hci_cp_le_create_conn cp;
memset(&cp, 0, sizeof(cp));
- cp.scan_interval = __constant_cpu_to_le16(0x0060);
- cp.scan_window = __constant_cpu_to_le16(0x0030);
+ cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
+ cp.scan_window = cpu_to_le16(hdev->le_scan_window);
bacpy(&cp.peer_addr, &conn->dst);
cp.peer_addr_type = conn->dst_type;
cp.conn_interval_min = __constant_cpu_to_le16(0x0028);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 82dbdc6..6c2eff0 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2223,6 +2223,9 @@ struct hci_dev *hci_alloc_dev(void)
hdev->sniff_max_interval = 800;
hdev->sniff_min_interval = 80;
+ hdev->le_scan_interval = 0x0060;
+ hdev->le_scan_window = 0x0030;
+
mutex_init(&hdev->lock);
mutex_init(&hdev->req_lock);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 14/14] build-sys: Add missing $(AM_CFLAGS) to obexd_src_obexd_CFLAGS
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
This fix not passing extra build flags when --enable-maintainer-mode
is used.
---
Makefile.obexd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.obexd b/Makefile.obexd
index d5377cb..2d4f10d 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -85,7 +85,7 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
-obexd_src_obexd_CFLAGS = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @ICAL_CFLAGS@ \
+obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ @ICAL_CFLAGS@ \
-DOBEX_PLUGIN_BUILTIN \
-DPLUGINDIR=\""$(obex_plugindir)"\" \
-fPIC -D_FILE_OFFSET_BITS=64
--
1.8.4
^ permalink raw reply related
* [PATCH 13/14] obexd/MAP: Fix protected property value
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
"Sent" flag value was returned instead of "Protected" one.
This also fix following build error:
CC obexd/client/obexd-map.o
obexd/client/map.c:711:17: error: ‘get_protected’ defined but not
used [-Werror=unused-function]
cc1: all warnings being treated as errors
---
obexd/client/map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 801d715..4373d74 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -814,7 +814,7 @@ static const GDBusPropertyTable map_msg_properties[] = {
{ "Priority", "b", get_priority },
{ "Read", "b", get_read, set_read },
{ "Sent", "b", get_sent },
- { "Protected", "b", get_sent },
+ { "Protected", "b", get_protected },
{ "Deleted", "b", NULL, set_deleted },
{ }
};
--
1.8.4
^ permalink raw reply related
* [PATCH 12/14] obexd/client: Remove unused static functions
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
This fix following build error:
CC obexd/client/obexd-dbus.o
obexd/client/dbus.c:70:13: error: ‘append_array_variant’ defined but
not used [-Werror=unused-function]
obexd/client/dbus.c:97:13: error: ‘append_dict_variant’ defined but
not used [-Werror=unused-function]
---
obexd/client/dbus.c | 81 -----------------------------------------------------
1 file changed, 81 deletions(-)
diff --git a/obexd/client/dbus.c b/obexd/client/dbus.c
index d635a45..243af59 100644
--- a/obexd/client/dbus.c
+++ b/obexd/client/dbus.c
@@ -67,87 +67,6 @@ void obex_dbus_dict_append(DBusMessageIter *dict,
dbus_message_iter_close_container(dict, &keyiter);
}
-static void append_array_variant(DBusMessageIter *iter, int type, void *val)
-{
- DBusMessageIter variant, array;
- char typesig[2];
- char arraysig[3];
- const char **str_array = *(const char ***) val;
- int i;
-
- arraysig[0] = DBUS_TYPE_ARRAY;
- arraysig[1] = typesig[0] = type;
- arraysig[2] = typesig[1] = '\0';
-
- dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- arraysig, &variant);
-
- dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
- typesig, &array);
-
- for (i = 0; str_array[i]; i++)
- dbus_message_iter_append_basic(&array, type,
- &(str_array[i]));
-
- dbus_message_iter_close_container(&variant, &array);
-
- dbus_message_iter_close_container(iter, &variant);
-}
-
-static void append_dict_variant(DBusMessageIter *iter, int type, void *val)
-{
- DBusMessageIter variant, array, entry;
- char typesig[5];
- char arraysig[6];
- const void **val_array = *(const void ***) val;
- int i;
-
- arraysig[0] = DBUS_TYPE_ARRAY;
- arraysig[1] = typesig[0] = DBUS_DICT_ENTRY_BEGIN_CHAR;
- arraysig[2] = typesig[1] = DBUS_TYPE_STRING;
- arraysig[3] = typesig[2] = type;
- arraysig[4] = typesig[3] = DBUS_DICT_ENTRY_END_CHAR;
- arraysig[5] = typesig[4] = '\0';
-
- dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
- arraysig, &variant);
-
- dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
- typesig, &array);
-
- for (i = 0; val_array[i]; i += 2) {
- dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY,
- NULL, &entry);
-
- dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
- &(val_array[i + 0]));
-
- /*
- * D-Bus expects a char** or uint8* depending on the type
- * given. Since we are dealing with an array through a void**
- * (and thus val_array[i] is a pointer) we need to
- * differentiate DBUS_TYPE_STRING from the others. The other
- * option would be the user to pass the exact type to this
- * function, instead of a pointer to it. However in this case
- * a cast from type to void* would be needed, which is not
- * good.
- */
- if (type == DBUS_TYPE_STRING) {
- dbus_message_iter_append_basic(&entry, type,
- &(val_array[i + 1]));
- } else {
- dbus_message_iter_append_basic(&entry, type,
- val_array[i + 1]);
- }
-
- dbus_message_iter_close_container(&array, &entry);
- }
-
- dbus_message_iter_close_container(&variant, &array);
-
- dbus_message_iter_close_container(iter, &variant);
-}
-
int obex_dbus_signal_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
--
1.8.4
^ permalink raw reply related
* [PATCH 11/14] client/transfer: Return "error" for unknown status in status2str
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
This can happen only if there is a bug in obexd code.
This fix following build error:
CC obexd/client/obexd-transfer.o
obexd/client/transfer.c: In function ‘status2str’:
obexd/client/transfer.c:277:1: error: control reaches end of non-void
function [-Werror=return-type]
---
obexd/client/transfer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 99a17e9..5a8d4f2 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -272,6 +272,7 @@ static const char *status2str(uint8_t status)
case TRANSFER_STATUS_COMPLETE:
return "complete";
case TRANSFER_STATUS_ERROR:
+ default:
return "error";
}
}
--
1.8.4
^ permalink raw reply related
* [PATCH 10/14] obexd/MAP: Fix missing include
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
This fix following build error:
CC obexd/client/obexd-map.o
obexd/client/map.c: In function ‘msg_element’:
obexd/client/map.c:1113:2: error: implicit declaration of function ‘strtoull’ [-Werror=implicit-function-declaration]
---
obexd/client/map.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index fe15bab..801d715 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
+#include <stdlib.h>
#include <glib.h>
#include <gdbus/gdbus.h>
#include <gobex/gobex-apparam.h>
--
1.8.4
^ permalink raw reply related
* [PATCH 09/14] obexd/service: Remove unused local variable
From: Szymon Janc @ 2013-10-04 9:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1380877538-22614-1-git-send-email-szymon.janc@tieto.com>
This fix following build error:
CC obexd/src/obexd-service.o
obexd/src/service.c: In function ‘obex_service_driver_register’:
obexd/src/service.c:100:10: error: unused variable ‘l’ [-Werror=unused-variable]
---
obexd/src/service.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/obexd/src/service.c b/obexd/src/service.c
index 6b8533b..c088535 100644
--- a/obexd/src/service.c
+++ b/obexd/src/service.c
@@ -97,8 +97,6 @@ static struct obex_service_driver *find_driver(uint16_t service)
int obex_service_driver_register(struct obex_service_driver *driver)
{
- GSList *l;
-
if (!driver) {
error("Invalid driver");
return -EINVAL;
--
1.8.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox