* 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
* [PATCH] android/pts: Add PTS test results for PBAP
From: Sebastian Chlad @ 2014-01-24 19:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sebastian Chlad
---
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
--
1.8.5.3
^ permalink raw reply related
* [PATCH 2/2] android/hal-audio: Remove DBG from SBC functions
From: Andrzej Kaczmarek @ 2014-01-24 16:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
In-Reply-To: <1390579604-14748-1-git-send-email-andrzej.kaczmarek@tieto.com>
These are redundant since callers will always print some information
which can be used to see what was actually called so no need to flood
output.
---
android/hal-audio.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 974bedf..8d737ad 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -266,8 +266,6 @@ static int sbc_get_presets(struct audio_preset *preset, size_t *len)
uint8_t *ptr = (uint8_t *) preset;
size_t preset_size = sizeof(*preset) + sizeof(a2dp_sbc_t);
- DBG("");
-
count = sizeof(sbc_presets) / sizeof(sbc_presets[0]);
for (i = 0; i < count; i++) {
@@ -293,8 +291,6 @@ static void sbc_init_encoder(struct sbc_data *sbc_data)
a2dp_sbc_t *in = &sbc_data->sbc;
sbc_t *out = &sbc_data->enc;
- DBG("");
-
sbc_init_a2dp(out, 0L, in, sizeof(*in));
out->endian = SBC_LE;
@@ -310,8 +306,6 @@ static int sbc_codec_init(struct audio_preset *preset, uint16_t mtu,
size_t out_frame_len;
size_t num_frames;
- DBG("");
-
if (preset->len != sizeof(a2dp_sbc_t)) {
error("SBC: preset size mismatch");
return AUDIO_STATUS_FAILED;
@@ -345,8 +339,6 @@ static int sbc_cleanup(void *codec_data)
{
struct sbc_data *sbc_data = (struct sbc_data *) codec_data;
- DBG("");
-
sbc_finish(&sbc_data->enc);
free(sbc_data->out_buf);
free(codec_data);
@@ -386,8 +378,6 @@ static size_t sbc_get_buffer_size(void *codec_data)
{
struct sbc_data *sbc_data = (struct sbc_data *) codec_data;
- DBG("");
-
return sbc_data->in_buf_size;
}
@@ -395,8 +385,6 @@ static size_t sbc_get_mediapacket_duration(void *codec_data)
{
struct sbc_data *sbc_data = (struct sbc_data *) codec_data;
- DBG("");
-
return sbc_data->frame_duration * sbc_data->frames_per_packet;
}
--
1.8.5.2
^ permalink raw reply related
* [PATCH 1/2] android/hal-audio: Refactor error messages
From: Andrzej Kaczmarek @ 2014-01-24 16:06 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
---
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;
--
1.8.5.2
^ permalink raw reply related
* Re: [PATCH 3/3] avctp: Fix unchecked return value
From: Anderson Lizardo @ 2014-01-24 15:00 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: BlueZ development
In-Reply-To: <1390575403-30860-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Fri, Jan 24, 2014 at 10:56 AM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> - for (i = 0; key_map[i].name != NULL; i++)
> + for (i = 0; key_map[i].name != NULL; i++) {
> ioctl(fd, UI_SET_KEYBIT, key_map[i].uinput);
> + err = -errno;
> + error("ioctl UI_SET_KEYBIT: %s (%d)", strerror(-err), -err);
> + goto fail;
> + }
You seem to have missed the "if (ioctl(...) < 0)" above.
Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil
^ permalink raw reply
* [PATCH 3/3] avctp: Fix unchecked return value
From: Andrei Emeltchenko @ 2014-01-24 14:56 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1390575403-30860-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Refactor code so that ioctl() return value is checked.
---
profiles/audio/avctp.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 6669ddc..4d0f906 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -1026,27 +1026,52 @@ static int uinput_create(char *name)
err = -errno;
error("Can't write device information: %s (%d)",
strerror(-err), -err);
- close(fd);
- return err;
+ goto fail;
+ }
+
+ if (ioctl(fd, UI_SET_EVBIT, EV_KEY) < 0) {
+ err = -errno;
+ error("ioctl UI_SET_EVBIT: %s (%d)", strerror(-err), -err);
+ goto fail;
+ }
+
+ if (ioctl(fd, UI_SET_EVBIT, EV_REL) < 0) {
+ err = -errno;
+ error("ioctl UI_SET_EVBIT: %s (%d)", strerror(-err), -err);
+ goto fail;
+ }
+
+ if (ioctl(fd, UI_SET_EVBIT, EV_REP) < 0) {
+ err = -errno;
+ error("ioctl UI_SET_EVBIT: %s (%d)", strerror(-err), -err);
+ goto fail;
}
- ioctl(fd, UI_SET_EVBIT, EV_KEY);
- ioctl(fd, UI_SET_EVBIT, EV_REL);
- ioctl(fd, UI_SET_EVBIT, EV_REP);
- ioctl(fd, UI_SET_EVBIT, EV_SYN);
+ if (ioctl(fd, UI_SET_EVBIT, EV_SYN) < 0) {
+ err = -errno;
+ error("ioctl UI_SET_EVBIT: %s (%d)", strerror(-err), -err);
+ goto fail;
+ }
- for (i = 0; key_map[i].name != NULL; i++)
+ for (i = 0; key_map[i].name != NULL; i++) {
ioctl(fd, UI_SET_KEYBIT, key_map[i].uinput);
+ err = -errno;
+ error("ioctl UI_SET_KEYBIT: %s (%d)", strerror(-err), -err);
+ goto fail;
+ }
if (ioctl(fd, UI_DEV_CREATE, NULL) < 0) {
err = -errno;
error("Can't create uinput device: %s (%d)",
strerror(-err), -err);
- close(fd);
- return err;
+ goto fail;
}
return fd;
+
+fail:
+ close(fd);
+ return err;
}
static void init_uinput(struct avctp *session)
--
1.8.3.2
^ permalink raw reply related
* [PATCH 2/3] android/avdtp: Retry send on EAGAIN as well
From: Andrei Emeltchenko @ 2014-01-24 14:56 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1390575403-30860-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
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));
if (err < 0) {
error("send: %s (%d)", strerror(errno), errno);
--
1.8.3.2
^ permalink raw reply related
* [PATCH 1/3] bnep: Calculate ifindex after NULL check
From: Andrei Emeltchenko @ 2014-01-24 14:56 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
profiles/network/bnep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 2a74016..0ef85d5 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -518,13 +518,15 @@ static int bnep_add_to_bridge(const char *devname, const char *bridge)
static int bnep_del_from_bridge(const char *devname, const char *bridge)
{
- int ifindex = if_nametoindex(devname);
+ int ifindex;
struct ifreq ifr;
int sk, err;
if (!devname || !bridge)
return -EINVAL;
+ ifindex = if_nametoindex(devname);
+
sk = socket(AF_INET, SOCK_STREAM, 0);
if (sk < 0)
return -1;
--
1.8.3.2
^ permalink raw reply related
* [PATCH] android: Update Audio IPC documentation
From: Andrzej Kaczmarek @ 2014-01-24 14:50 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
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)
--
1.8.5.2
^ permalink raw reply related
* Re: Discovering LE advertisements programatically
From: Anderson Lizardo @ 2014-01-24 14:38 UTC (permalink / raw)
To: Adam Warski; +Cc: BlueZ development
In-Reply-To: <41458C64-3510-481A-92F4-1296C06600CC@warski.org>
Hi Adam,
On Fri, Jan 24, 2014 at 10:15 AM, Adam Warski <adam@warski.org> wrote:
> I’m trying to find a good way to discover and retrieve LE advertisements programatically.
>
> My first shot was to try to use DBus. I was trying to extend what the test/test-discovery script is doing, but it seems using DBus I can only get notified of new devices being discovered. Is there a way to get the actual LE advertisement via DBus? The device properties seem not to contain the info from the advertisement PDU.
>
> If that’s not possible using DBus, is the way to go just using C?
>
> I also tried using command line, a combination of “hcitool lescan” and “hcidump”/“hcidump -R" gives what I need more or less (plain hcidump gives me the RSSI, hcidump -R gives me the raw packet that I need). Still, I guess there must be a better way.
My suggestion would be to take a look at "hcitool lescan" for how it
is done using C sockets. Or you can modify hcitool lescan to dump the
full advertising report instead of just the name.
Best Regards,
--
Anderson Lizardo
http://www.indt.org/?lang=en
Manaus - Brazil
^ permalink raw reply
* Re: [PATCH v3 0/5] Remote device cache support
From: Szymon Janc @ 2014-01-24 14:21 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1390515490-29538-1-git-send-email-szymon.janc@gmail.com>
Hi,
On Thursday 23 of January 2014 23:18:05 Szymon Janc wrote:
> V3:
> - bugfixes in cache handling
>
> V2:
> - keep cache in separate file
> - patch 3/5 and 4/5 from V1 squashed to 3/4
>
> V1:
> - set cache limit to 300
> - update timestamp of cached device
> - rebased to master
> - other minor fixes
>
> Szymon Janc (5):
> android/bluetooth: Split devices list to devices and bonded_devices
> android/bluetooth: Use defines for settings and devices files paths
> android/bluetooth: Add support for caching remote device info
> android/bluetooth: Add support for loading caches devices from storage
> android/bluetooth: Rename devices list to cached_devices
>
> android/bluetooth.c | 246 ++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 183 insertions(+), 63 deletions(-)
>
This is now pushed upstream.
--
Best regards,
Szymon Janc
^ permalink raw reply
* Discovering LE advertisements programatically
From: Adam Warski @ 2014-01-24 14:15 UTC (permalink / raw)
To: linux-bluetooth
Hello,
I’m trying to find a good way to discover and retrieve LE advertisements programatically.
My first shot was to try to use DBus. I was trying to extend what the test/test-discovery script is doing, but it seems using DBus I can only get notified of new devices being discovered. Is there a way to get the actual LE advertisement via DBus? The device properties seem not to contain the info from the advertisement PDU.
If that’s not possible using DBus, is the way to go just using C?
I also tried using command line, a combination of “hcitool lescan” and “hcidump”/“hcidump -R" gives what I need more or less (plain hcidump gives me the RSSI, hcidump -R gives me the raw packet that I need). Still, I guess there must be a better way.
Thanks,
Adam
--
Adam Warski
http://twitter.com/#!/adamwarski
http://www.softwaremill.com
http://www.warski.org
^ permalink raw reply
* [PATCH BlueZ v2 8/8] android/AVRCP: Add initial socket handling
From: Luiz Augusto von Dentz @ 2014-01-24 13:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1390569875-29436-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds the initial socket listening and handling incoming connections.
---
android/avctp.c | 5 +--
android/avrcp.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 4 deletions(-)
diff --git a/android/avctp.c b/android/avctp.c
index a88b7f7..80513e6 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -860,10 +860,7 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond,
handler = find_handler(control->handlers, avc->opcode);
if (!handler) {
DBG("handler not found for 0x%02x", avc->opcode);
- /* FIXME:
- * packet_size += avrcp_handle_vendor_reject(&code, operands);
- */
- avc->code = code;
+ avc->code = AVC_CTYPE_REJECTED;
goto done;
}
diff --git a/android/avrcp.c b/android/avrcp.c
index e06d136..807c109 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <glib.h>
+#include "btio/btio.h"
#include "lib/bluetooth.h"
#include "lib/sdp.h"
#include "lib/sdp_lib.h"
@@ -36,6 +37,7 @@
#include "avrcp.h"
#include "hal-msg.h"
#include "ipc.h"
+#include "avctp.h"
#define L2CAP_PSM_AVCTP 0x17
@@ -46,6 +48,13 @@
static bdaddr_t adapter_addr;
static uint32_t record_id = 0;
+static GSList *devices = NULL;
+static GIOChannel *server = NULL;
+
+struct avrcp_device {
+ bdaddr_t dst;
+ struct avctp *session;
+};
static const struct ipc_handler cmd_handlers[] = {
};
@@ -118,14 +127,124 @@ static sdp_record_t *avrcp_record(void)
return record;
}
+static void avrcp_device_free(void *data)
+{
+ struct avrcp_device *dev = data;
+
+ if (dev->session)
+ avctp_shutdown(dev->session);
+
+ devices = g_slist_remove(devices, dev);
+ g_free(dev);
+}
+
+static struct avrcp_device *avrcp_device_new(const bdaddr_t *dst)
+{
+ struct avrcp_device *dev;
+
+ dev = g_new0(struct avrcp_device, 1);
+ bacpy(&dev->dst, dst);
+ devices = g_slist_prepend(devices, dev);
+
+ return dev;
+}
+
+static int device_cmp(gconstpointer s, gconstpointer user_data)
+{
+ const struct avrcp_device *dev = s;
+ const bdaddr_t *dst = user_data;
+
+ return bacmp(&dev->dst, dst);
+}
+
+static void disconnect_cb(void *data)
+{
+ struct avrcp_device *dev = data;
+
+ DBG("");
+
+ dev->session = NULL;
+
+ avrcp_device_free(dev);
+}
+
+static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
+{
+ struct avrcp_device *dev;
+ bdaddr_t src, dst;
+ char address[18];
+ uint16_t imtu, omtu;
+ GError *gerr = NULL;
+ GSList *l;
+ int fd;
+
+ if (err) {
+ error("%s", err->message);
+ return;
+ }
+
+ bt_io_get(chan, &gerr,
+ BT_IO_OPT_SOURCE_BDADDR, &src,
+ BT_IO_OPT_DEST_BDADDR, &dst,
+ BT_IO_OPT_IMTU, &imtu,
+ BT_IO_OPT_OMTU, &omtu,
+ BT_IO_OPT_INVALID);
+ if (gerr) {
+ error("%s", gerr->message);
+ g_error_free(gerr);
+ g_io_channel_shutdown(chan, TRUE, NULL);
+ return;
+ }
+
+ ba2str(&dst, address);
+ DBG("Incoming connection from %s", address);
+
+ l = g_slist_find_custom(devices, &dst, device_cmp);
+ if (l) {
+ error("Unexpected connection");
+ return;
+ }
+
+ fd = g_io_channel_unix_get_fd(chan);
+
+ dev = avrcp_device_new(&dst);
+ dev->session = avctp_new(fd, imtu, omtu, 0x0100);
+
+ if (!dev->session) {
+ avrcp_device_free(dev);
+ return;
+ }
+
+ avctp_set_destroy_cb(dev->session, disconnect_cb, dev);
+
+ /* FIXME: get the real name of the device */
+ avctp_init_uinput(dev->session, "bluetooth", address);
+
+ g_io_channel_set_close_on_unref(chan, FALSE);
+
+ DBG("%s connected", address);
+}
+
bool bt_avrcp_register(const bdaddr_t *addr)
{
+ GError *err = NULL;
sdp_record_t *rec;
DBG("");
bacpy(&adapter_addr, addr);
+ server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
+ BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
+ BT_IO_OPT_PSM, L2CAP_PSM_AVCTP,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
+ BT_IO_OPT_INVALID);
+ if (!server) {
+ error("Failed to listen on AVDTP channel: %s", err->message);
+ g_error_free(err);
+ return false;
+ }
+
rec = avrcp_record();
if (!rec) {
error("Failed to allocate AVRCP record");
@@ -149,8 +268,17 @@ void bt_avrcp_unregister(void)
{
DBG("");
+ g_slist_free_full(devices, avrcp_device_free);
+ devices = NULL;
+
ipc_unregister(HAL_SERVICE_ID_AVRCP);
bt_adapter_remove_record(record_id);
record_id = 0;
+
+ if (server) {
+ g_io_channel_shutdown(server, TRUE, NULL);
+ g_io_channel_unref(server);
+ server = NULL;
+ }
}
--
1.8.4.2
^ permalink raw reply related
* [PATCH BlueZ v2 7/8] android/AVCTP: Add avctp_set_destroy_cb
From: Luiz Augusto von Dentz @ 2014-01-24 13:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1390569875-29436-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds avctp_set_destroy_cb that can be use to set a callback when
the AVCTP has been disconnected.
---
android/avctp.c | 13 +++++++++++++
android/avctp.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/android/avctp.c b/android/avctp.c
index 1255c3e..a88b7f7 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -174,6 +174,9 @@ struct avctp {
uint8_t key_quirks[256];
struct key_pressed key;
uint16_t version;
+
+ avctp_destroy_cb_t destroy;
+ void *data;
};
struct avctp_passthrough_handler {
@@ -1445,6 +1448,13 @@ int avctp_connect_browsing(struct avctp *session, int fd, size_t imtu,
return 0;
}
+void avctp_set_destroy_cb(struct avctp *session, avctp_destroy_cb_t cb,
+ void *user_data)
+{
+ session->destroy = cb;
+ session->data = user_data;
+}
+
void avctp_shutdown(struct avctp *session)
{
if (!session)
@@ -1456,6 +1466,9 @@ void avctp_shutdown(struct avctp *session)
if (session->control)
avctp_channel_destroy(session->control);
+ if (session->destroy)
+ session->destroy(session->data);
+
if (session->key.timer > 0)
g_source_remove(session->key.timer);
diff --git a/android/avctp.h b/android/avctp.h
index 99aaf95..a22bf13 100644
--- a/android/avctp.h
+++ b/android/avctp.h
@@ -103,6 +103,9 @@ typedef size_t (*avctp_browsing_pdu_cb) (struct avctp *session,
typedef void (*avctp_destroy_cb_t) (void *user_data);
struct avctp *avctp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
+void avctp_set_destroy_cb(struct avctp *session, avctp_destroy_cb_t cb,
+ void *user_data);
+
int avctp_init_uinput(struct avctp *session, const char *name,
const char *address);
int avctp_connect_browsing(struct avctp *session, int fd, size_t imtu,
--
1.8.4.2
^ permalink raw reply related
* [PATCH BlueZ v2 6/8] android/AVRCP: Add implementation of SDP record
From: Luiz Augusto von Dentz @ 2014-01-24 13:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1390569875-29436-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds the following record:
Service Name: AVRCP TG
Service RecHandle: 0x10002
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100
---
android/avrcp.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/android/avrcp.c b/android/avrcp.c
index 707506b..e06d136 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -29,22 +29,116 @@
#include <glib.h>
#include "lib/bluetooth.h"
+#include "lib/sdp.h"
+#include "lib/sdp_lib.h"
#include "log.h"
+#include "bluetooth.h"
#include "avrcp.h"
#include "hal-msg.h"
#include "ipc.h"
+#define L2CAP_PSM_AVCTP 0x17
+
+#define AVRCP_FEATURE_CATEGORY_1 0x0001
+#define AVRCP_FEATURE_CATEGORY_2 0x0002
+#define AVRCP_FEATURE_CATEGORY_3 0x0004
+#define AVRCP_FEATURE_CATEGORY_4 0x0008
+
static bdaddr_t adapter_addr;
+static uint32_t record_id = 0;
static const struct ipc_handler cmd_handlers[] = {
};
+static sdp_record_t *avrcp_record(void)
+{
+ sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+ uuid_t root_uuid, l2cap, avctp, avrtg;
+ sdp_profile_desc_t profile[1];
+ sdp_list_t *aproto_control, *proto_control[2];
+ sdp_record_t *record;
+ sdp_data_t *psm, *version, *features;
+ uint16_t lp = L2CAP_PSM_AVCTP;
+ uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
+ uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
+ AVRCP_FEATURE_CATEGORY_2 |
+ AVRCP_FEATURE_CATEGORY_3 |
+ AVRCP_FEATURE_CATEGORY_4);
+
+ record = sdp_record_alloc();
+ if (!record)
+ return NULL;
+
+ sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ root = sdp_list_append(NULL, &root_uuid);
+ sdp_set_browse_groups(record, root);
+
+ /* Service Class ID List */
+ sdp_uuid16_create(&avrtg, AV_REMOTE_TARGET_SVCLASS_ID);
+ svclass_id = sdp_list_append(NULL, &avrtg);
+ sdp_set_service_classes(record, svclass_id);
+
+ /* Protocol Descriptor List */
+ sdp_uuid16_create(&l2cap, L2CAP_UUID);
+ proto_control[0] = sdp_list_append(NULL, &l2cap);
+ psm = sdp_data_alloc(SDP_UINT16, &lp);
+ proto_control[0] = sdp_list_append(proto_control[0], psm);
+ apseq = sdp_list_append(NULL, proto_control[0]);
+
+ sdp_uuid16_create(&avctp, AVCTP_UUID);
+ proto_control[1] = sdp_list_append(NULL, &avctp);
+ version = sdp_data_alloc(SDP_UINT16, &avctp_ver);
+ proto_control[1] = sdp_list_append(proto_control[1], version);
+ apseq = sdp_list_append(apseq, proto_control[1]);
+
+ aproto_control = sdp_list_append(NULL, apseq);
+ sdp_set_access_protos(record, aproto_control);
+
+ /* Bluetooth Profile Descriptor List */
+ sdp_uuid16_create(&profile[0].uuid, AV_REMOTE_PROFILE_ID);
+ profile[0].version = avrcp_ver;
+ pfseq = sdp_list_append(NULL, &profile[0]);
+ sdp_set_profile_descs(record, pfseq);
+
+ features = sdp_data_alloc(SDP_UINT16, &feat);
+ sdp_attr_add(record, SDP_ATTR_SUPPORTED_FEATURES, features);
+
+ sdp_set_info_attr(record, "AVRCP TG", 0, 0);
+
+ sdp_data_free(psm);
+ sdp_data_free(version);
+ sdp_list_free(proto_control[0], NULL);
+ sdp_list_free(proto_control[1], NULL);
+ sdp_list_free(apseq, NULL);
+ sdp_list_free(aproto_control, NULL);
+ sdp_list_free(pfseq, NULL);
+ sdp_list_free(root, NULL);
+ sdp_list_free(svclass_id, NULL);
+
+ return record;
+}
+
bool bt_avrcp_register(const bdaddr_t *addr)
{
+ sdp_record_t *rec;
+
DBG("");
bacpy(&adapter_addr, addr);
+ rec = avrcp_record();
+ if (!rec) {
+ error("Failed to allocate AVRCP record");
+ return false;
+ }
+
+ if (bt_adapter_add_record(rec, 0) < 0) {
+ error("Failed to register AVRCP record");
+ sdp_record_free(rec);
+ return false;
+ }
+ record_id = rec->handle;
+
ipc_register(HAL_SERVICE_ID_AVRCP, cmd_handlers,
G_N_ELEMENTS(cmd_handlers));
@@ -56,4 +150,7 @@ void bt_avrcp_unregister(void)
DBG("");
ipc_unregister(HAL_SERVICE_ID_AVRCP);
+
+ bt_adapter_remove_record(record_id);
+ record_id = 0;
}
--
1.8.4.2
^ 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