Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH] Rename adapter_remove_device to btd_adapter_remove_device
From: Johan Hedberg @ 2014-01-25 22:13 UTC (permalink / raw)
  To: Petri Gynther; +Cc: linux-bluetooth
In-Reply-To: <20140125005506.7AD85100900@puck.mtv.corp.google.com>

Hi Petri,

On Fri, Jan 24, 2014, Petri Gynther wrote:
> Allow this symbol to be exported and usable from external plugins.
> ---
>  src/adapter.c | 14 +++++++-------
>  src/adapter.h |  3 +++
>  2 files changed, 10 insertions(+), 7 deletions(-)

The patch looks fine, but we usually don't export symbols without
knowing that there exists a valid use case for it. So could you perhaps
give some background (or even a follow-up patch) to explain what you
need this for?

Johan

^ permalink raw reply

* Re: [PATCH BlueZ 0/2] Basic [sg]etsockopt() testing in l2cap-tester
From: Johan Hedberg @ 2014-01-25 22:12 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1390614842-28379-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Lizardo,

On Fri, Jan 24, 2014, Anderson Lizardo wrote:
> These patches extend existing tests in l2cap-tester to exercise two common
> operations on LE sockets:
> 
> * getsockopt(BT_SECURITY) on client side (to set security level)
> * setsockopt(L2CAP_OPTIONS) on server side (called by bt_io_get())
> 
> At the moment, there is a regression on kernel introduced by commit
> a5a1e0e6b9c1dea3696192b5ec153d03917eb7b8 ("Bluetooth: Switch ATT channels to
> use L2CAP_CHAN_FIXED") which is affecting these two operations. I'm currently
> implementing and testing fixes for this regression.

I pushed your first patch and a slightly different version of the
second one which is more thorough in its checks. I also sent fixes for
the kernel side so you don't need to spend more time on that (unless you
disagree with the fixes I sent).

Johan

^ permalink raw reply

* [PATCH 3/3] Bluetooth: Fix CID initialization for fixed channels
From: johan.hedberg @ 2014-01-25 22:10 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390687809-14408-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

Fixed channels have the same source and destination CID. Ensure that the
values get properly initialized when receiving incoming connections and
deriving values from the parent socket.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/l2cap_core.c | 2 --
 net/bluetooth/l2cap_sock.c | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3a9917be6c6e..f86e98c47094 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1466,8 +1466,6 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
 	if (!chan)
 		goto clean;
 
-	chan->dcid = L2CAP_CID_ATT;
-
 	bacpy(&chan->src, &hcon->src);
 	bacpy(&chan->dst, &hcon->dst);
 	chan->src_type = bdaddr_type(hcon, hcon->src_type);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 588d43b1c18e..304fc8589af4 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1470,6 +1470,11 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
 		chan->tx_credits = pchan->tx_credits;
 		chan->rx_credits = pchan->rx_credits;
 
+		if (chan->chan_type == L2CAP_CHAN_FIXED) {
+			chan->scid = pchan->scid;
+			chan->dcid = pchan->scid;
+		}
+
 		security_sk_clone(parent, sk);
 	} else {
 		switch (sk->sk_type) {
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 2/3] Bluetooth: Fix freeing l2cap_chan while it's locked
From: johan.hedberg @ 2014-01-25 22:10 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1390687809-14408-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

There's a race condition where it's possible that user space closes the
socket right at the moment that the kernel is inside some L2CAP
signaling channel handler with the lock held for the l2cap_chan tied to
the socket. When the race occurs it can look as follows:

 WARNING: CPU: 1 PID: 2395 at kernel/locking/mutex.c:565 __mutex_lock_slowpath+0x1ff/0x26a()
 DEBUG_LOCKS_WARN_ON(l->magic != l)
 CPU: 1 PID: 2395 Comm: kworker/u5:1 Not tainted 3.12.0+ #224
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 Workqueue: hci0 hci_rx_work
  00000007 00000000 ed74dcd0 c1344099 ed74dcf8 ed74dce8 c1028b29 c1346891
  ed5e0b80 00000246 f61d7600 ed74dd00 c1028b88 00000009 ed74dcf8 c13fd4cc
  ed74dd14 ed74dd50 c1346891 c13fd4e4 00000235 c13fd4cc c13fd50a 5a5a5a5a
 Call Trace:
  [<c1344099>] dump_stack+0x48/0x60
  [<c1028b29>] warn_slowpath_common+0x57/0x6e
  [<c1346891>] ? __mutex_lock_slowpath+0x1ff/0x26a
  [<c1028b88>] warn_slowpath_fmt+0x26/0x2a
  [<c1346891>] __mutex_lock_slowpath+0x1ff/0x26a
  [<c134691f>] mutex_lock+0x23/0x2f
  [<c130e79a>] l2cap_get_chan_by_scid+0x32/0x40
  [<c13143cb>] l2cap_config_req+0x6d/0x78f
  [<c1009486>] ? save_stack_trace+0x1d/0x3b
  [<c10915c2>] ? set_track+0x48/0xa7
  [<c134312b>] ? free_debug_processing+0x134/0x16b
  [<c1006019>] ? native_sched_clock+0x37/0x3a
  [<c1315107>] l2cap_recv_frame+0x2f2/0x1a85
  [<c1315107>] ? l2cap_recv_frame+0x2f2/0x1a85
  [<c1317913>] l2cap_recv_acldata+0xe8/0x239
  [<c1317913>] ? l2cap_recv_acldata+0xe8/0x239
  [<c12fa470>] hci_rx_work+0x1b0/0x295
  [<c13465d9>] ? mutex_unlock+0x8/0xa
  [<c12fa470>] ? hci_rx_work+0x1b0/0x295
  [<c103592c>] ? pwq_activate_delayed_work+0x1c/0x27
  [<c1036d25>] process_one_work+0x128/0x1df
  [<c1347401>] ? _raw_spin_unlock_irq+0x8/0x12
  [<c1036d25>] ? process_one_work+0x128/0x1df
  [<c103713a>] worker_thread+0x127/0x1c4
  [<c1037013>] ? rescuer_thread+0x216/0x216
  [<c103aec6>] kthread+0x88/0x8d
  [<c1040000>] ? task_rq_lock+0x37/0x6e
  [<c1347e77>] ret_from_kernel_thread+0x1b/0x28
  [<c103ae3e>] ? __kthread_parkme+0x50/0x50
 ---[ end trace 81d41a8e15d9559e ]---
 =============================================================================
 BUG kmalloc-1024 (Tainted: G        W   ): Poison overwritten
 -----------------------------------------------------------------------------
 INFO: 0xed5e0b80-0xed5e0b85. First byte 0xff instead of 0x6b
 INFO: Allocated in l2cap_chan_create+0x1f/0xf9 age=9986 cpu=1 pid=2395
 	__slab_alloc.constprop.66+0x1c5/0x36e
 	kmem_cache_alloc+0x54/0xb4
 	l2cap_chan_create+0x1f/0xf9
 	l2cap_sock_alloc.constprop.5+0x73/0x9b
 	l2cap_sock_new_connection_cb+0x5d/0x95
 	l2cap_connect+0x112/0x3a0
 	l2cap_recv_frame+0x534/0x1a85
 	process_pending_rx+0x48/0x56
 	process_one_work+0x128/0x1df
 	worker_thread+0x127/0x1c4
 	kthread+0x88/0x8d
 	ret_from_kernel_thread+0x1b/0x28
 INFO: Freed in l2cap_chan_destroy+0x59/0x65 age=9986 cpu=0 pid=2363
 	__slab_free+0x3c/0x260
 	kfree+0xb3/0xbc
 	l2cap_chan_destroy+0x59/0x65
 	kref_put+0x2a/0x33
 	l2cap_chan_put+0x3f/0x4a
 	l2cap_sock_destruct+0x3d/0x77
 	__sk_free+0x20/0x116
 	sk_free+0x1c/0x1f
 	l2cap_sock_kill+0x6f/0x74
 	l2cap_sock_teardown_cb+0xc1/0x119
 	l2cap_chan_close+0x186/0x192
 	l2cap_sock_shutdown+0x1af/0x214
 	l2cap_sock_release+0x56/0xa2
 	sock_release+0x10/0x55
 	sock_close+0xb/0xf
 	__fput+0xd3/0x175

This patch fixes the race by acquiring the l2cap_chan lock in
l2cap_chan_destroy before removing the channel from the global list.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/l2cap_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index e5c5c7427c41..3a9917be6c6e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -442,10 +442,14 @@ static void l2cap_chan_destroy(struct kref *kref)
 
 	BT_DBG("chan %p", chan);
 
+	l2cap_chan_lock(chan);
+
 	write_lock(&chan_list_lock);
 	list_del(&chan->global_l);
 	write_unlock(&chan_list_lock);
 
+	l2cap_chan_unlock(chan);
+
 	kfree(chan);
 }
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 1/3] Bluetooth: Fix BT_SECURITY socket option for fixed channels (ATT)
From: johan.hedberg @ 2014-01-25 22:10 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

The BT_SECURITY option should also be allowed for fixed channels, so
punch the appropriate hole for it when checking for the channel type.
The main user of fixed CID user space sockets is right now ATT (which is
broken without this patch).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/l2cap_sock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 3f8e2a223474..588d43b1c18e 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -513,6 +513,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
 	switch (optname) {
 	case BT_SECURITY:
 		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
+		    chan->chan_type != L2CAP_CHAN_FIXED &&
 		    chan->chan_type != L2CAP_CHAN_RAW) {
 			err = -EINVAL;
 			break;
@@ -769,6 +770,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 	switch (optname) {
 	case BT_SECURITY:
 		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
+		    chan->chan_type != L2CAP_CHAN_FIXED &&
 		    chan->chan_type != L2CAP_CHAN_RAW) {
 			err = -EINVAL;
 			break;
-- 
1.8.5.3


^ permalink raw reply related

* Re: [PATCH BlueZ 0/2] Basic [sg]etsockopt() testing in l2cap-tester
From: Anderson Lizardo @ 2014-01-25  2:50 UTC (permalink / raw)
  To: BlueZ development; +Cc: Anderson Lizardo
In-Reply-To: <CAJdJm_NYECBW1hH+PmYtQqoBL-_279_hjfgqWD8i85bi9nHJiw@mail.gmail.com>

Hi again,

On Fri, Jan 24, 2014 at 10:00 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Actually I know why they fail: the tests try to use a PSM (and not
> CID) on a single mode LE adapter. I just don't understand why this is
> expected to work.

I now realise that this has to do with LE CoC. Would it be okay to
make l2cap-tester check for
/sys/module/bluetooth/parameters/enable_lecoc at test setup and if it
contains "N", skip the test?

Best Regards,
-- 
Anderson Lizardo
INdT - Manaus - Brazil

^ permalink raw reply

* Re: [PATCH BlueZ 0/2] Basic [sg]etsockopt() testing in l2cap-tester
From: Anderson Lizardo @ 2014-01-25  2:00 UTC (permalink / raw)
  To: BlueZ development; +Cc: Anderson Lizardo
In-Reply-To: <1390614842-28379-1-git-send-email-anderson.lizardo@openbossa.org>

Hi,

On Fri, Jan 24, 2014 at 9:54 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> PS: For some reason, the following tests are failing on my system, even using
> an older kernel:
>
> L2CAP LE Client - Success
> L2CAP LE Client SMP - Success
> L2CAP LE Client - Command Reject
> L2CAP LE Client - Invalid PSM
> L2CAP LE Server - Success
>
> connect() is returning EINVAL.  Any ideas for why this may be happening?

Actually I know why they fail: the tests try to use a PSM (and not
CID) on a single mode LE adapter. I just don't understand why this is
expected to work.

Best Regards,
-- 
Anderson Lizardo
INdT - Manaus - Brazil

^ permalink raw reply

* [PATCH BlueZ 2/2] tools/l2cap-tester: Test getsockopt(L2CAP_OPTIONS) on LE server
From: Anderson Lizardo @ 2014-01-25  1:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1390614842-28379-1-git-send-email-anderson.lizardo@openbossa.org>

The btio layer always performs this operation when bt_io_get() is
called. Also check for getsockopt(BT_RCVMTU), which is supported on
kernels with CoC enabled.
---
 tools/l2cap-tester.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index d541f1b..78e7ce6 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1034,7 +1034,9 @@ static gboolean l2cap_listen_cb(GIOChannel *io, GIOCondition cond,
 {
 	struct test_data *data = tester_get_data();
 	const struct l2cap_data *l2data = data->test_data;
-	int sk, new_sk;
+	struct l2cap_options l2o;
+	int sk, new_sk, err;
+	socklen_t len;
 
 	data->io_id = 0;
 
@@ -1047,6 +1049,28 @@ static gboolean l2cap_listen_cb(GIOChannel *io, GIOCondition cond,
 		return FALSE;
 	}
 
+	len = sizeof(l2o);
+	memset(&l2o, 0, len);
+
+	/* LE CoC enabled kernels should support BT_RCVMTU */
+	err = getsockopt(new_sk, SOL_BLUETOOTH, BT_RCVMTU, &l2o.imtu, &len);
+	if (err < 0 && errno != EPROTONOSUPPORT && errno != ENOPROTOOPT) {
+		tester_warn("getsockopt(BT_RCVMTU) failed: %s (%d)",
+							strerror(errno), errno);
+		tester_test_failed();
+		return FALSE;
+	}
+
+	/* For non-LE CoC enabled kernels we need to fall back to L2CAP_OPTIONS,
+	 * so test support for it as well */
+	err = getsockopt(new_sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &len);
+	if (err < 0) {
+		tester_warn("getsockopt(L2CAP_OPTIONS) failed: %s (%d)",
+							strerror(errno), errno);
+		tester_test_failed();
+		return FALSE;
+	}
+
 	if (l2data->read_data) {
 		struct bthost *bthost;
 		GIOChannel *new_io;
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH BlueZ 1/2] tools/l2cap-tester: Test setsockopt(BT_SECURITY) on LE client
From: Anderson Lizardo @ 2014-01-25  1:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1390614842-28379-1-git-send-email-anderson.lizardo@openbossa.org>

Although setting a security level using setsockopt(BT_SECURITY) is
optional for LE sockets (it will default to doing
unencrypted/unauthenticated connection), it is a common operation and it
is done by BlueZ daemon and some tools.
---
 tools/l2cap-tester.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 05202bd..d541f1b 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -461,6 +461,7 @@ static const struct l2cap_data le_server_success_test = {
 
 static const struct l2cap_data le_att_client_connect_success_test_1 = {
 	.cid = 0x0004,
+	.sec_level = BT_SECURITY_LOW,
 };
 
 static const struct l2cap_data le_att_server_success_test_1 = {
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH BlueZ 0/2] Basic [sg]etsockopt() testing in l2cap-tester
From: Anderson Lizardo @ 2014-01-25  1:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

Hi,

These patches extend existing tests in l2cap-tester to exercise two common
operations on LE sockets:

* getsockopt(BT_SECURITY) on client side (to set security level)
* setsockopt(L2CAP_OPTIONS) on server side (called by bt_io_get())

At the moment, there is a regression on kernel introduced by commit
a5a1e0e6b9c1dea3696192b5ec153d03917eb7b8 ("Bluetooth: Switch ATT channels to
use L2CAP_CHAN_FIXED") which is affecting these two operations. I'm currently
implementing and testing fixes for this regression.

PS: For some reason, the following tests are failing on my system, even using
an older kernel:

L2CAP LE Client - Success
L2CAP LE Client SMP - Success
L2CAP LE Client - Command Reject
L2CAP LE Client - Invalid PSM
L2CAP LE Server - Success

connect() is returning EINVAL.  Any ideas for why this may be happening?

Best Regards,
Anderson Lizardo

Anderson Lizardo (2):
  tools/l2cap-tester: Test setsockopt(BT_SECURITY) on LE client
  tools/l2cap-tester: Test getsockopt(L2CAP_OPTIONS) on LE server

 tools/l2cap-tester.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

-- 
1.8.3.2


^ permalink raw reply

* [PATCH] Rename adapter_remove_device to btd_adapter_remove_device
From: Petri Gynther @ 2014-01-25  0:55 UTC (permalink / raw)
  To: linux-bluetooth

Allow this symbol to be exported and usable from external plugins.
---
 src/adapter.c | 14 +++++++-------
 src/adapter.h |  3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 570a5bf..649fc7a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1036,8 +1036,8 @@ static void service_auth_cancel(struct service_auth *auth)
 	g_free(auth);
 }
 
-static void adapter_remove_device(struct btd_adapter *adapter,
-						struct btd_device *dev)
+void btd_adapter_remove_device(struct btd_adapter *adapter,
+				struct btd_device *dev)
 {
 	GList *l;
 
@@ -1531,7 +1531,7 @@ static gboolean remove_temp_devices(gpointer user_data)
 		next = g_slist_next(l);
 
 		if (device_is_temporary(dev))
-			adapter_remove_device(adapter, dev);
+			btd_adapter_remove_device(adapter, dev);
 	}
 
 	return FALSE;
@@ -2159,7 +2159,7 @@ static DBusMessage *remove_device(DBusConnection *conn,
 	btd_device_set_temporary(device, TRUE);
 
 	if (!btd_device_is_connected(device)) {
-		adapter_remove_device(adapter, device);
+		btd_adapter_remove_device(adapter, device);
 		return dbus_message_new_method_return(msg);
 	}
 
@@ -4268,7 +4268,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
 		const char *path = device_get_path(device);
 
 		DBG("Removing temporary device %s", path);
-		adapter_remove_device(adapter, device);
+		btd_adapter_remove_device(adapter, device);
 	}
 }
 
@@ -5834,7 +5834,7 @@ static void connect_failed_callback(uint16_t index, uint16_t length,
 	 * when it is temporary. */
 	if (device && !device_is_bonding(device, NULL)
 						&& device_is_temporary(device))
-		adapter_remove_device(adapter, device);
+		btd_adapter_remove_device(adapter, device);
 }
 
 static void unpaired_callback(uint16_t index, uint16_t length,
@@ -5865,7 +5865,7 @@ static void unpaired_callback(uint16_t index, uint16_t length,
 	if (btd_device_is_connected(device))
 		device_request_disconnect(device, NULL);
 	else
-		adapter_remove_device(adapter, device);
+		btd_adapter_remove_device(adapter, device);
 }
 
 static void read_info_complete(uint8_t status, uint16_t length,
diff --git a/src/adapter.h b/src/adapter.h
index de5b07d..e2e73dc 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -36,6 +36,7 @@
 #define INVALID_PASSKEY		0xffffffff
 
 struct btd_adapter;
+struct btd_device;
 
 struct btd_adapter *btd_adapter_get_default(void);
 bool btd_adapter_is_default(struct btd_adapter *adapter);
@@ -90,6 +91,8 @@ bool btd_adapter_get_connectable(struct btd_adapter *adapter);
 
 uint32_t btd_adapter_get_class(struct btd_adapter *adapter);
 const char *btd_adapter_get_name(struct btd_adapter *adapter);
+void btd_adapter_remove_device(struct btd_adapter *adapter,
+				struct btd_device *dev);
 struct btd_device *btd_adapter_get_device(struct btd_adapter *adapter,
 					const bdaddr_t *addr,
 					uint8_t addr_type);
-- 
1.8.5.3


^ permalink raw reply related

* Re: [PATCH] android/pts: Add PTS test results for A2DP
From: Sebastian Chlad @ 2014-01-25  0:03 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ development
In-Reply-To: <347F2184-6CA1-4BCF-AC42-0A9E1FB9F9C9@holtmann.org>

[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]

On Saturday, January 25, 2014, Marcel Holtmann <marcel@holtmann.org> wrote:

> Hi Sebastian,
>
> > ---
> > android/pts-a2dp.txt | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/android/pts-a2dp.txt b/android/pts-a2dp.txt
> > index a269ec1..c6eee62 100644
> > --- a/android/pts-a2dp.txt
> > +++ b/android/pts-a2dp.txt
> > @@ -1,7 +1,7 @@
> > PTS test results for A2DP
> >
> > PTS version: 5.0
> > -Tested: --not yet tested--
> > +Tested: 24.01.2014
> >
> > Results:
> > PASS  test passed
> > @@ -15,17 +15,17 @@ Test Name         Result  Notes
> >
> -------------------------------------------------------------------------------
> > TC_SRC_CC_BV_09_I     INC
> > TC_SRC_CC_BV_10_I     N/A
> > -TC_SRC_REL_BV_01_I   INC
> > -TC_SRC_REL_BV_02_I   INC
> > -TC_SRC_SET_BV_01_I   INC
> > -TC_SRC_SET_BV_02_I   INC
> > -TC_SRC_SET_BV_03_I   INC
> > +TC_SRC_REL_BV_01_I   PASS
> > +TC_SRC_REL_BV_02_I   PASS
> > +TC_SRC_SET_BV_01_I   PASS
> > +TC_SRC_SET_BV_02_I   PASS
> > +TC_SRC_SET_BV_03_I   PASS
> > TC_SRC_SET_BV_04_I    INC
> > TC_SRC_SET_BV_05_I    INC
> > TC_SRC_SET_BV_06_I    INC
> > TC_SRC_SUS_BV_01_I    INC
> > TC_SRC_SUS_BV_02_I    INC
> > -TC_SRC_SDP_BV_01_I   INC
> > +TC_SRC_SDP_BV_01_I   PASS
> > TC_SRC_AS_BV_01_I     INC
> > ———————————————————————————————————————
>
> can we extend the notes section with some sort of instructions that we
> have to do on the IUT side. Even it is something simple like Play music or
> just wait for incoming connections. This applies to all of out PTS
> documentation of course.
>
> Regards
>
> Marcel


 Sure. I'll keep adding such notes over next couple of weeks.

Br,
Sebastian


-- 
Seb/

[-- Attachment #2: Type: text/html, Size: 2213 bytes --]

^ permalink raw reply

* Re: [PATCH 2/3] android/avdtp: Retry send on EAGAIN as well
From: Szymon Janc @ 2014-01-24 22:16 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1390575403-30860-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Friday 24 January 2014 16:56:42 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> ---
>  android/avdtp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/android/avdtp.c b/android/avdtp.c
> index 5da1206..1055bc1 100644
> --- a/android/avdtp.c
> +++ b/android/avdtp.c
> @@ -444,7 +444,7 @@ static gboolean try_send(int sk, void *data, size_t len)
> 
>  	do {
>  		err = send(sk, data, len, 0);
> -	} while (err < 0 && errno == EINTR);
> +	} while (err < 0 && (errno == EINTR || errno == EAGAIN));
> 

This makes try_send() blocking, if this is ok then at least some explanation 
in commit message would be welcome.

>  	if (err < 0) {
>  		error("send: %s (%d)", strerror(errno), errno);

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH] android/pts: Add PTS test results for A2DP
From: Marcel Holtmann @ 2014-01-24 22:16 UTC (permalink / raw)
  To: Sebastian Chlad; +Cc: BlueZ development
In-Reply-To: <1390595089-5314-1-git-send-email-sebastianchlad@gmail.com>

Hi Sebastian,

> ---
> android/pts-a2dp.txt | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/android/pts-a2dp.txt b/android/pts-a2dp.txt
> index a269ec1..c6eee62 100644
> --- a/android/pts-a2dp.txt
> +++ b/android/pts-a2dp.txt
> @@ -1,7 +1,7 @@
> PTS test results for A2DP
> 
> PTS version: 5.0
> -Tested: --not yet tested--
> +Tested: 24.01.2014
> 
> Results:
> PASS	test passed
> @@ -15,17 +15,17 @@ Test Name		Result	Notes
> -------------------------------------------------------------------------------
> TC_SRC_CC_BV_09_I	INC
> TC_SRC_CC_BV_10_I	N/A
> -TC_SRC_REL_BV_01_I	INC
> -TC_SRC_REL_BV_02_I	INC
> -TC_SRC_SET_BV_01_I	INC
> -TC_SRC_SET_BV_02_I	INC
> -TC_SRC_SET_BV_03_I	INC
> +TC_SRC_REL_BV_01_I	PASS
> +TC_SRC_REL_BV_02_I	PASS
> +TC_SRC_SET_BV_01_I	PASS
> +TC_SRC_SET_BV_02_I	PASS
> +TC_SRC_SET_BV_03_I	PASS
> TC_SRC_SET_BV_04_I	INC
> TC_SRC_SET_BV_05_I	INC
> TC_SRC_SET_BV_06_I	INC
> TC_SRC_SUS_BV_01_I	INC
> TC_SRC_SUS_BV_02_I	INC
> -TC_SRC_SDP_BV_01_I	INC
> +TC_SRC_SDP_BV_01_I	PASS
> TC_SRC_AS_BV_01_I	INC
> ———————————————————————————————————————

can we extend the notes section with some sort of instructions that we have to do on the IUT side. Even it is something simple like Play music or just wait for incoming connections. This applies to all of out PTS documentation of course.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH] android/pts: Add PTS test results for A2DP
From: Szymon Janc @ 2014-01-24 22:04 UTC (permalink / raw)
  To: Sebastian Chlad; +Cc: linux-bluetooth
In-Reply-To: <1390595089-5314-1-git-send-email-sebastianchlad@gmail.com>

Hi Sebastian,

On Friday 24 January 2014 15:24:49 Sebastian Chlad wrote:
> ---
>  android/pts-a2dp.txt | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/android/pts-a2dp.txt b/android/pts-a2dp.txt
> index a269ec1..c6eee62 100644
> --- a/android/pts-a2dp.txt
> +++ b/android/pts-a2dp.txt
> @@ -1,7 +1,7 @@
>  PTS test results for A2DP
> 
>  PTS version: 5.0
> -Tested: --not yet tested--
> +Tested: 24.01.2014
> 
>  Results:
>  PASS	test passed
> @@ -15,17 +15,17 @@ Test Name		Result	Notes
>  ---------------------------------------------------------------------------
> ---- TC_SRC_CC_BV_09_I	INC
>  TC_SRC_CC_BV_10_I	N/A
> -TC_SRC_REL_BV_01_I	INC
> -TC_SRC_REL_BV_02_I	INC
> -TC_SRC_SET_BV_01_I	INC
> -TC_SRC_SET_BV_02_I	INC
> -TC_SRC_SET_BV_03_I	INC
> +TC_SRC_REL_BV_01_I	PASS
> +TC_SRC_REL_BV_02_I	PASS
> +TC_SRC_SET_BV_01_I	PASS
> +TC_SRC_SET_BV_02_I	PASS
> +TC_SRC_SET_BV_03_I	PASS
>  TC_SRC_SET_BV_04_I	INC
>  TC_SRC_SET_BV_05_I	INC
>  TC_SRC_SET_BV_06_I	INC
>  TC_SRC_SUS_BV_01_I	INC
>  TC_SRC_SUS_BV_02_I	INC
> -TC_SRC_SDP_BV_01_I	INC
> +TC_SRC_SDP_BV_01_I	PASS
>  TC_SRC_AS_BV_01_I	INC
>  ---------------------------------------------------------------------------
> ----

Applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH] android/pts: Add PTS test results for PBAP
From: Szymon Janc @ 2014-01-24 22:04 UTC (permalink / raw)
  To: Sebastian Chlad; +Cc: linux-bluetooth
In-Reply-To: <1390593376-4905-1-git-send-email-sebastianchlad@gmail.com>

Hi Sebastian,

On Friday 24 January 2014 14:56:16 Sebastian Chlad wrote:
> ---
>  android/pts-pbap.txt | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/android/pts-pbap.txt b/android/pts-pbap.txt
> index 3bf682f..843b7cf 100644
> --- a/android/pts-pbap.txt
> +++ b/android/pts-pbap.txt
> @@ -1,6 +1,6 @@
>  PTS test results for PBAP
> 
> -PTS version: 4.9
> +PTS version: 5.0
>  Tested: 14.11.2013
> 
>  Results:
> @@ -30,7 +30,7 @@ TC_PCE_PDF_BV_04_I	N/A
>  TC_PSE_SSM_BV_03_C	PASS
>  TC_PSE_SSM_BV_05_C	PASS
>  TC_PSE_SSM_BV_07_C	PASS
> -TC_PSE_SSM_BI_02_C	INC
> +TC_PSE_SSM_BI_02_C	PASS
>  TC_PSE_SSM_BI_03_C	N/A
>  TC_PSE_SSM_BV_08_I	PASS
>  TC_PSE_PBD_BV_02_C	PASS
> @@ -48,7 +48,7 @@ TC_PSE_PBB_BV_07_C	PASS
>  TC_PSE_PBB_BV_08_C	PASS
>  TC_PSE_PBB_BV_09_C	PASS
>  TC_PSE_PBB_BV_10_C	PASS
> -TC_PSE_PBB_BV_11_C	INC
> +TC_PSE_PBB_BV_11_C	PASS
>  TC_PSE_PBB_BI_01_C	PASS
>  TC_PSE_PBB_BI_07_C	PASS
>  TC_PSE_PBF_BV_01_I	PASS

Applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH 1/2] android/hal-audio: Refactor error messages
From: Szymon Janc @ 2014-01-24 22:02 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1390579604-14748-1-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On Friday 24 January 2014 17:06:43 Andrzej Kaczmarek wrote:
> ---
>  android/hal-audio.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index 8271647..974bedf 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -313,7 +313,7 @@ static int sbc_codec_init(struct audio_preset *preset,
> uint16_t mtu, DBG("");
> 
>  	if (preset->len != sizeof(a2dp_sbc_t)) {
> -		DBG("preset size mismatch");
> +		error("SBC: preset size mismatch");
>  		return AUDIO_STATUS_FAILED;
>  	}
> 
> @@ -422,8 +422,7 @@ static void write_media_packet(int fd, struct sbc_data
> *sbc_data, ret = write(fd, mp, sizeof(*mp) + data_len);
>  	if (ret < 0) {
>  		int err = errno;
> -		DBG("error writing data: %d (%s)", err,
> -						strerror(err));
> +		error("SBC: failed to write data: %d (%s)", err, strerror(err));
>  	}
> 
>  	sbc_data->frames_sent += mp->payload.frame_count;
> @@ -472,7 +471,7 @@ static ssize_t sbc_write_data(void *codec_data, const
> void *buffer, &written);
> 
>  		if (ret < 0) {
> -			DBG("failed to encode block");
> +			error("SBC: failed to encode block");
>  			break;
>  		}
> 
> @@ -500,7 +499,7 @@ static ssize_t sbc_write_data(void *codec_data, const
> void *buffer, * if we did not, something went wrong but we can't really
>  		 * handle this so this is just sanity check
>  		 */
> -		DBG("some data were not encoded");
> +		error("SBC: failed to encode complete input buffer");
>  	}
> 
>  	/* we always assume that all data was processed and sent */
> @@ -828,12 +827,12 @@ static ssize_t out_write(struct audio_stream_out
> *stream, const void *buffer, }
> 
>  	if (out->audio_state != AUDIO_A2DP_STATE_STARTED) {
> -		DBG("stream not started");
> +		error("audio: stream not started");
>  		return -1;
>  	}
> 
>  	if (out->ep->fd < 0) {
> -		DBG("no transport");
> +		error("audio: no transport socket");
>  		return -1;
>  	}
> 
> @@ -857,7 +856,7 @@ static int out_set_sample_rate(struct audio_stream
> *stream, uint32_t rate) DBG("");
> 
>  	if (rate != out->cfg.rate) {
> -		DBG("cannot set sample rate to %d", rate);
> +		warn("audio: cannot set sample rate to %d", rate);
>  		return -1;
>  	}
> 
> @@ -1182,6 +1181,7 @@ static int audio_open_output_stream(struct
> audio_hw_device *dev, return 0;
> 
>  fail:
> +	error("audio: cannot open output stream");
>  	free(out);
>  	*stream_out = NULL;
>  	return -EIO;

Both patches applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH] android: Update Audio IPC documentation
From: Szymon Janc @ 2014-01-24 22:01 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1390575029-6800-1-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On Friday 24 January 2014 15:50:29 Andrzej Kaczmarek wrote:
> Open Stream commands now also returns outoging MTU for returned socket.
> ---
>  android/audio-ipc-api.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/android/audio-ipc-api.txt b/android/audio-ipc-api.txt
> index 4aff92c..f4a497d 100644
> --- a/android/audio-ipc-api.txt
> +++ b/android/audio-ipc-api.txt
> @@ -66,7 +66,8 @@ Audio Service (ID 0)
>  	Opcode 0x03 - Open Stream command
> 
>  		Command parameters: Endpoint ID (1 octet)
> -		Response parameters: Codec configuration length (1 octet)
> +		Response parameters: Outgoing MTU (2 octets)
> +				     Codec configuration length (1 octet)
>  				     Codec configuration (1 octet)
>  				     File descriptor (inline)

Applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH] android/a2dp: Fix audio resume on started stream
From: Szymon Janc @ 2014-01-24 22:00 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1390496392-22826-1-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On Thursday 23 January 2014 17:59:52 Andrzej Kaczmarek wrote:
> In case stream is started from remote we'll receive Resume Stream IPC
> when audio is already considered as started (i.e. on first write from
> AudioFlinger). In such case we should not try to send AVDTP_START since
> this will fail but just reply success over IPC instead.
> ---
>  android/a2dp.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/android/a2dp.c b/android/a2dp.c
> index 572e0d1..10e43b1 100644
> --- a/android/a2dp.c
> +++ b/android/a2dp.c
> @@ -1376,10 +1376,12 @@ static void bt_stream_resume(const void *buf,
> uint16_t len) goto failed;
>  	}
> 
> -	err = avdtp_start(setup->dev->session, setup->stream);
> -	if (err < 0) {
> -		error("avdtp_start: %s", strerror(-err));
> -		goto failed;
> +	if (setup->state != HAL_AUDIO_STARTED) {
> +		err = avdtp_start(setup->dev->session, setup->stream);
> +		if (err < 0) {
> +			error("avdtp_start: %s", strerror(-err));
> +			goto failed;
> +		}
>  	}
> 
>  	audio_ipc_send_rsp(AUDIO_OP_RESUME_STREAM, AUDIO_STATUS_SUCCESS);

Applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply

* Re: [PATCH BlueZ] attrib: Fix crash if g_attrib_new() fails
From: Johan Hedberg @ 2014-01-24 21:57 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1390593469-18511-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Lizardo,

On Fri, Jan 24, 2014, Anderson Lizardo wrote:
> If g_attrib_new() fails for some reason (e.g. bt_io_get() fails), it
> will return NULL.
> 
> Crash reported by Valgrind:
> 
> ==2845== Invalid read of size 4
> ==2845==    at 0x40C6CC4: g_io_channel_unix_get_fd (giounix.c:655)
> ==2845==  Address 0x3c is not stack'd, malloc'd or (recently) free'd
> ---
>  src/attrib-server.c |    3 +++
>  1 file changed, 3 insertions(+)

Applied. Thanks.

Johan

^ permalink raw reply

* [RFC BlueZ 2/2] monitor: Add support for printing bluetoothd messages
From: Vinicius Costa Gomes @ 2014-01-24 21:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes
In-Reply-To: <1390599712-1609-1-git-send-email-vcgomes@gmail.com>

In many cases when debugging bluetoothd behaviour, it is useful
to associate bluetooth debug outputs with HCI/MGMT commands and
events.
---
 monitor/journal.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 94 insertions(+), 1 deletion(-)

diff --git a/monitor/journal.c b/monitor/journal.c
index ecc7dac..1b04f02 100644
--- a/monitor/journal.c
+++ b/monitor/journal.c
@@ -22,12 +22,105 @@
  */
 
 #include <errno.h>
+#include <stdio.h>
 
 #include <systemd/sd-journal.h>
 
+#include "mainloop.h"
 #include "journal.h"
 
+static sd_journal *journal;
+
+static void journal_destroy(void *user_data)
+{
+	sd_journal *j = user_data;
+	sd_journal_close(j);
+}
+
+static void journal_event(int fd, uint32_t events, void *user_data)
+{
+	sd_journal *j = user_data;
+	const void *d;
+	const char *msg;
+	size_t l;
+	int err, prefix = strlen("MESSAGE=");
+
+	err = sd_journal_process(j);
+	if (err < 0) {
+		printf("Could not process journal: %s (%d)\n",
+				strerror(-err), err);
+		goto failed;
+	}
+
+	err = sd_journal_next(j);
+	if (err == 0) {
+		/* No more events in the journal, let's wait. */
+		return;
+	} else if (err < 0) {
+		printf("Failed to iterate to the next entry: %s (%d)\n",
+				strerror(-err), err);
+		goto failed;
+	}
+
+	err = sd_journal_get_data(j, "MESSAGE", &d, &l);
+	if (err < 0) {
+		printf("Could not get journal messages: %s (%d)",
+				strerror(-err), err);
+		goto failed;
+	}
+
+	msg = d;
+
+	/* TODO: better formatting, perhaps colors. */
+	/* msg is prefixed with 'MESSAGE=', remove it. */
+	printf("# %.*s\n", (int) l - prefix, msg + prefix);
+
+	return;
+
+failed:
+	mainloop_remove_fd(fd);
+}
+
 int journal_monitor(void)
 {
-	return -ENOSYS;
+	int err, events, fd;
+
+	err = sd_journal_open(&journal, SD_JOURNAL_SYSTEM |
+					SD_JOURNAL_RUNTIME_ONLY |
+					SD_JOURNAL_LOCAL_ONLY);
+	if (err < 0)
+		goto failed;
+
+	err = sd_journal_add_match(journal, "_SYSTEMD_UNIT=bluetooth.service", 0);
+	if (err < 0)
+		goto failed;
+
+	err = sd_journal_add_disjunction(journal);
+	if (err < 0)
+		goto failed;
+
+	err = sd_journal_seek_tail(journal);
+	if (err < 0)
+		goto failed;
+
+	fd = sd_journal_get_fd(journal);
+	if (fd < 0) {
+		err = fd;
+		goto failed;
+	}
+
+	events = sd_journal_get_events(journal);
+	if (events < 0) {
+		err = events;
+		goto failed;
+	}
+
+	return mainloop_add_fd(fd, events, journal_event, journal,
+				journal_destroy);
+
+failed:
+	printf("Failed to listen for journal messages: %s (%d)\n",
+			strerror(-err), err);
+	journal_destroy(journal);
+	return err;
 }
-- 
1.8.5.3


^ permalink raw reply related

* [RFC BlueZ 1/2] monitor: Add stubs for monitoring bluetoothd's journal entries
From: Vinicius Costa Gomes @ 2014-01-24 21:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes
In-Reply-To: <1390599712-1609-1-git-send-email-vcgomes@gmail.com>

This will allow to have the output of bluetoothd in the same
place as the rest of the data that is being monitored, this
has the potencial to make it easier to know what bluetoothd
action caused which events.
---
 Makefile.tools    |  3 ++-
 configure.ac      |  7 +++++++
 monitor/journal.c | 33 +++++++++++++++++++++++++++++++++
 monitor/journal.h | 24 ++++++++++++++++++++++++
 monitor/main.c    | 13 ++++++++++++-
 5 files changed, 78 insertions(+), 2 deletions(-)
 create mode 100644 monitor/journal.c
 create mode 100644 monitor/journal.h

diff --git a/Makefile.tools b/Makefile.tools
index 52e49fb..42f7e4e 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -20,6 +20,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 					monitor/btsnoop.h monitor/btsnoop.c \
 					monitor/ellisys.h monitor/ellisys.c \
 					monitor/control.h monitor/control.c \
+					monitor/journal.h monitor/journal.c \
 					monitor/packet.h monitor/packet.c \
 					monitor/vendor.h monitor/vendor.c \
 					monitor/lmp.h monitor/lmp.c \
@@ -32,7 +33,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 					monitor/analyze.h monitor/analyze.c \
 					src/shared/util.h src/shared/util.c \
 					src/shared/queue.h src/shared/queue.c
-monitor_btmon_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+monitor_btmon_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@ @SYSTEMD_JOURNAL_LIBS@
 endif
 
 if EXPERIMENTAL
diff --git a/configure.ac b/configure.ac
index f607d7a..abd65cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,6 +178,13 @@ AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
 		[disable systemd integration]), [enable_systemd=${enableval}])
 AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
 
+if (test "${enable_systemd}" != "no"); then
+	PKG_CHECK_MODULES(SYSTEMD_JOURNAL, libsystemd-journal, dummy=yes,
+				AC_MSG_ERROR(libsystemd-journal is required))
+	AC_SUBST(SYSTEMD_JOURNAL_CFLAGS)
+	AC_SUBST(SYSTEMD_JOURNAL_LIBS)
+fi
+
 AC_ARG_WITH([systemdsystemunitdir],
 			AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
 			[path to systemd system unit directory]),
diff --git a/monitor/journal.c b/monitor/journal.c
new file mode 100644
index 0000000..ecc7dac
--- /dev/null
+++ b/monitor/journal.c
@@ -0,0 +1,33 @@
+/*
+ *
+ *  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
+ *
+ */
+
+#include <errno.h>
+
+#include <systemd/sd-journal.h>
+
+#include "journal.h"
+
+int journal_monitor(void)
+{
+	return -ENOSYS;
+}
diff --git a/monitor/journal.h b/monitor/journal.h
new file mode 100644
index 0000000..895db02
--- /dev/null
+++ b/monitor/journal.h
@@ -0,0 +1,24 @@
+/*
+ *
+ *  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
+ *
+ */
+
+int journal_monitor(void);
diff --git a/monitor/main.c b/monitor/main.c
index e7ee3e4..6fb1d28 100644
--- a/monitor/main.c
+++ b/monitor/main.c
@@ -38,6 +38,8 @@
 #include "analyze.h"
 #include "ellisys.h"
 #include "control.h"
+#include "btsnoop.h"
+#include "journal.h"
 
 static void signal_callback(int signum, void *user_data)
 {
@@ -64,6 +66,7 @@ static void usage(void)
 		"\t-T, --date             Show time and date information\n"
 		"\t-S, --sco              Dump SCO traffic\n"
 		"\t-E, --ellisys [ip]     Send Ellisys HCI Injection\n"
+		"\t-j, --journal          Show bluetoothd journal logs\n"
 		"\t-h, --help             Show help options\n");
 }
 
@@ -78,6 +81,7 @@ static const struct option main_options[] = {
 	{ "sco",     no_argument,	NULL, 'S' },
 	{ "ellisys", required_argument, NULL, 'E' },
 	{ "todo",    no_argument,       NULL, '#' },
+	{ "journal", no_argument,       NULL, 'j' },
 	{ "version", no_argument,       NULL, 'v' },
 	{ "help",    no_argument,       NULL, 'h' },
 	{ }
@@ -91,6 +95,7 @@ int main(int argc, char *argv[])
 	const char *analyze_path = NULL;
 	const char *ellisys_server = NULL;
 	unsigned short ellisys_port = 0;
+	bool journal = false;
 	const char *str;
 	sigset_t mask;
 
@@ -101,7 +106,7 @@ int main(int argc, char *argv[])
 	for (;;) {
 		int opt;
 
-		opt = getopt_long(argc, argv, "r:w:a:s:i:tTSE:vh",
+		opt = getopt_long(argc, argv, "r:w:a:s:i:tTSE:jvh",
 						main_options, NULL);
 		if (opt < 0)
 			break;
@@ -150,6 +155,9 @@ int main(int argc, char *argv[])
 			packet_todo();
 			lmp_todo();
 			return EXIT_SUCCESS;
+		case 'j':
+			journal = true;
+			break;
 		case 'v':
 			printf("%s\n", VERSION);
 			return EXIT_SUCCESS;
@@ -200,6 +208,9 @@ int main(int argc, char *argv[])
 	if (ellisys_server)
 		ellisys_enable(ellisys_server, ellisys_port);
 
+	if (journal)
+		journal_monitor();
+
 	if (control_tracing() < 0)
 		return EXIT_FAILURE;
 
-- 
1.8.5.3


^ permalink raw reply related

* [RFC BlueZ 0/2] Print bluetoothd messages in btmon
From: Vinicius Costa Gomes @ 2014-01-24 21:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

Hi,

It is very common when debugging issues, specially users' problems to
ask for btmon logs and the accompaining bluetoothd logs. And depending
on the issue, it takes some time to relate the HCI/MGMT commands to
bluetoothd messages that help narrow down the problem.

This is just a proof of concept, to know if this will be generally
helpful. And so, it needs some improvements: sending bluetoothd the USR2
signal so debug is enabled, color support and better formatting.


Cheers,


Vinicius Costa Gomes (2):
  monitor: Add stubs for monitoring bluetoothd's journal entries
  monitor: Add support for printing bluetoothd messages

 Makefile.tools    |   3 +-
 configure.ac      |   7 +++
 monitor/journal.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor/journal.h |  24 +++++++++++
 monitor/main.c    |  13 +++++-
 5 files changed, 171 insertions(+), 2 deletions(-)
 create mode 100644 monitor/journal.c
 create mode 100644 monitor/journal.h


--
1.8.5.3

^ permalink raw reply

* [PATCH] android/pts: Add PTS test results for A2DP
From: Sebastian Chlad @ 2014-01-24 20:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sebastian Chlad

---
 android/pts-a2dp.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/android/pts-a2dp.txt b/android/pts-a2dp.txt
index a269ec1..c6eee62 100644
--- a/android/pts-a2dp.txt
+++ b/android/pts-a2dp.txt
@@ -1,7 +1,7 @@
 PTS test results for A2DP
 
 PTS version: 5.0
-Tested: --not yet tested--
+Tested: 24.01.2014
 
 Results:
 PASS	test passed
@@ -15,17 +15,17 @@ Test Name		Result	Notes
 -------------------------------------------------------------------------------
 TC_SRC_CC_BV_09_I	INC
 TC_SRC_CC_BV_10_I	N/A
-TC_SRC_REL_BV_01_I	INC
-TC_SRC_REL_BV_02_I	INC
-TC_SRC_SET_BV_01_I	INC
-TC_SRC_SET_BV_02_I	INC
-TC_SRC_SET_BV_03_I	INC
+TC_SRC_REL_BV_01_I	PASS
+TC_SRC_REL_BV_02_I	PASS
+TC_SRC_SET_BV_01_I	PASS
+TC_SRC_SET_BV_02_I	PASS
+TC_SRC_SET_BV_03_I	PASS
 TC_SRC_SET_BV_04_I	INC
 TC_SRC_SET_BV_05_I	INC
 TC_SRC_SET_BV_06_I	INC
 TC_SRC_SUS_BV_01_I	INC
 TC_SRC_SUS_BV_02_I	INC
-TC_SRC_SDP_BV_01_I	INC
+TC_SRC_SDP_BV_01_I	PASS
 TC_SRC_AS_BV_01_I	INC
 -------------------------------------------------------------------------------
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH BlueZ] attrib: Fix crash if g_attrib_new() fails
From: Anderson Lizardo @ 2014-01-24 19:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

If g_attrib_new() fails for some reason (e.g. bt_io_get() fails), it
will return NULL.

Crash reported by Valgrind:

==2845== Invalid read of size 4
==2845==    at 0x40C6CC4: g_io_channel_unix_get_fd (giounix.c:655)
==2845==  Address 0x3c is not stack'd, malloc'd or (recently) free'd
---
 src/attrib-server.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 3b94120..61395a5 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1235,6 +1235,9 @@ static void connect_event(GIOChannel *io, GError *gerr, void *user_data)
 	}
 
 	attrib = g_attrib_new(io);
+	if (!attrib)
+		return;
+
 	attrib_channel_attach(attrib);
 	g_attrib_unref(attrib);
 }
-- 
1.7.9.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox