* Re: SBC loudness bug?
From: Siarhei Siamashka @ 2010-12-22 23:07 UTC (permalink / raw)
To: Christian Hoene
Cc: 'Luiz Augusto von Dentz', linux-bluetooth,
'Hagen Hentschel (Ellisys)'
In-Reply-To: <000601cba1e2$86077e70$92167b50$@de>
[-- Attachment #1: Type: Text/Plain, Size: 2735 bytes --]
On Wednesday 22 December 2010 16:14:16 Christian Hoene wrote:
> Hello,
>
> Mr. Hagen Hentschel was telling me that the BlueZ SBC implementation still
> has an bug.
Yes, unfortunately bluez sbc *decoder* is still as bad as it used to be. There
easily may be more than one bug in it.
I feel somewhat responsible for not bringing sbc decoder into a better shape
earlier. But at that time, only properly working and fast sbc *encoder* was
needed for A2DP bluetooth stereo headsets support in Nokia N900. Moreover, I
had run out of allocated time to this task (due to actually having to fix some
bluez sbc encoder bugs in addition to doing just performance optimizations) and
had to wrap up this activity even before all the planned ARM NEON optimizations
had been implemented.
Fortunately I had some spare time on the last summer vacation to spend on bluez
sbc codec. It was a tough choice deciding between either fixing the decoder or
adding missing ARM NEON optimizations to the encoder. But in the end I decided
to get at least one thing done right (the encoder), especially considering that
it happens to be referred from several places as an example of ARM NEON
optimizations. And I just did not feel right about having clearly incomplete
stuff there :) So the encoder got more optimizations [1][2], and the decoder
remained the way it was (it is still in my low priority TODO list).
> As compared to Bluetooth's reference implementation the signal
> is twotimes too silent. We told me, that in the last step of calculating
> the PCM samples a 1 bit right shift was done too much.
>
> A correct implementation for C# can be found at
> http://sourceforge.net/projects/sbcsharp/
>
> Sorry, due to time limits I cannot provide you with a patch...
Even without looking at the changes (after all, it's not so easy without a
patch), I guess it's more like a band aid. The whole decoder needs to be
seriously reworked. At least dropping the current synthesis filter
completely and reimplementing it straight according to A2DP spec is
necessary. We can't verify whether the current filter is correct, and also
its low precision is likely masking the other bugs and deviations from the
spec. I had some notes about it earlier in [3].
I have no idea when this all might be done unless somebody steps up for this
task (Hagen?). Or unless I myself somehow get an opportunity to work on fixing
sbc decoder full time for at least a week (next summer vacation?).
1. http://marc.info/?l=linux-bluetooth&m=127781938327437&w=2
2. http://marc.info/?l=linux-bluetooth&m=127807359119577&w=2
3. http://marc.info/?l=linux-bluetooth&m=126106163120842&w=2
--
Best regards,
Siarhei Siamashka
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH 08/18] Add a way to retrieve ATT primary services
From: Johan Hedberg @ 2010-12-22 22:52 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-9-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> As the primary services were discovered by the core bluetoothd, we need
> a way to export that information.
>
> The service discovery uses the same primary list as the device, there's no
> need to free that list when the discovery finishes. That list will be removed
> when the device is free'd.
> ---
> src/adapter.c | 6 +++---
> src/device.c | 15 +++++++++++++++
> src/device.h | 3 +++
> src/glib-helper.c | 1 -
> 4 files changed, 21 insertions(+), 4 deletions(-)
I tried to continue applying the patches starting with this one, but it
doesn't apply cleanly anymore probably due to me skipping patch 7 with
its compilation errors. So I'll once again stop processing the patch set
here.
Johan
^ permalink raw reply
* Re: [PATCH 07/18] Add support for creating devices from stored primary services
From: Johan Hedberg @ 2010-12-22 22:50 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-8-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> From what we can retrieve from storage we are able to create the devices
> and probe the device drivers.
> ---
> src/adapter.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 77 insertions(+), 0 deletions(-)
Patches 5 and 6 have been pushed upstream, but this one doesn't compile:
src/adapter.c: In function 'string_to_primary_list':
src/adapter.c:1958: error: implicit declaration of function 'att_primary_free'
src/adapter.c: In function 'create_stored_device_from_primary':
src/adapter.c:2003: error: 'att_primary_free' undeclared (first use in this function)
src/adapter.c:2003: error: (Each undeclared identifier is reported only once
src/adapter.c:2003: error: for each function it appears in.)
make[1]: *** [src/adapter.o] Error 1
Please fix and resubmit.
Johan
^ permalink raw reply
* Re: [PATCH v3] sbc: detect when bitpool has changed
From: Johan Hedberg @ 2010-12-22 22:44 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1293010548-25151-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Wed, Dec 22, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> A2DP spec allow bitpool changes midstream which is why sbc configuration
> has a range of values for bitpool that the encoder can use and decoder
> must support.
>
> Bitpool changes do not affect the state of encoder/decoder so they don't
> need to be reinitialize when this happens, so the impact is fairly small,
> what it does change is the frame length so encoders may change the
> bitpool to use the link more efficiently.
> ---
> sbc/sbc.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
The patch has been pushed upstream. Thanks. Could you also make sure
that it gets applied to PulseAudio's copy of libsbc?
Johan
^ permalink raw reply
* Re: [PATCH] Change LE scan interval and window to recommended values
From: Johan Hedberg @ 2010-12-22 22:42 UTC (permalink / raw)
To: Bruna Moreira; +Cc: linux-bluetooth
In-Reply-To: <1293045108-14011-1-git-send-email-bruna.moreira@openbossa.org>
Hi Bruna,
On Wed, Dec 22, 2010, Bruna Moreira wrote:
> Replace default scan interval and scan window values with recommended
> ones for general discovery procedure, according to the Core
> specification.
> ---
> plugins/hciops.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2 3/18] Move primary service storage to device.c
From: Johan Hedberg @ 2010-12-22 22:41 UTC (permalink / raw)
To: Sheldon Demario; +Cc: linux-bluetooth
In-Reply-To: <1293055273-21076-1-git-send-email-sheldon.demario@openbossa.org>
Hi Sheldon,
On Wed, Dec 22, 2010, Sheldon Demario wrote:
> Discover All Primary Services has beed moved to device.c in order
> to follow a similar approach of BR/EDR service records.
> ---
> attrib/att.h | 6 ++++++
> attrib/client.c | 41 -----------------------------------------
> attrib/gattrib.c | 1 +
> src/device.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> src/glib-helper.c | 24 ++++++++++++++++--------
> 5 files changed, 66 insertions(+), 50 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [RFC 1/2] Add g_attrib_send_seq()
From: Claudio Takahasi @ 2010-12-22 22:29 UTC (permalink / raw)
To: Brian Gix; +Cc: rshaffer, padovan, linux-bluetooth
In-Reply-To: <1292626132-30029-2-git-send-email-bgix@codeaurora.org>
Hi Brian,
On Fri, Dec 17, 2010 at 7:48 PM, Brian Gix <bgix@codeaurora.org> wrote:
> Add g_attrib_send_seq() as an extension to g_attrib_send().
> g_attrib_send_seq() functionally queues an entire
> "GATT Procedure" as defined in the BT Core v4.0.
> The intention is that the full procedure is run
> to completion before the next GATT Procedure is
> started. Subsequent ATT requests to a continuing
> procedure are added to the head of the Attrib queue.
>
> Fix g_attrib_send() to be the degenerative case of g_attrib_send_seq()
> This function now chains to g_attrib_send_seq() with arguments
> indicating that it is *not* a compound (multi-step) GATT
> procedure, but rather that the entire procedure is performed
> with a single ATT opcode request/response.
>
> Fix received_data() to recognize that incoming response is (or isn't)
> part of a compound Procedure, so that it waits for additional
> requests before servicing the Attrib queue.
> ---
> attrib/gattrib.c | 44 ++++++++++++++++++++++++++++++++++++--------
> attrib/gattrib.h | 4 ++++
> 2 files changed, 40 insertions(+), 8 deletions(-)
>
> diff --git a/attrib/gattrib.c b/attrib/gattrib.c
> index eace01b..8ef5d92 100644
> --- a/attrib/gattrib.c
> +++ b/attrib/gattrib.c
> @@ -58,6 +58,7 @@ struct command {
> guint16 len;
> guint8 expected;
> gboolean sent;
> + gboolean compound;
> GAttribResultFunc func;
> gpointer user_data;
> GDestroyNotify notify;
> @@ -285,6 +286,7 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
> uint8_t buf[512], status;
> gsize len;
> GIOStatus iostat;
> + gboolean compound = FALSE;
Intialization is not necessary.
>
> if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL)) {
> attrib->read_watch = 0;
> @@ -319,6 +321,8 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
> return attrib->events != NULL;
> }
>
> + compound = cmd->compound;
> +
> if (buf[0] == ATT_OP_ERROR) {
> status = buf[4];
> goto done;
> @@ -332,7 +336,8 @@ static gboolean received_data(GIOChannel *io, GIOCondition cond, gpointer data)
> status = 0;
>
> done:
> - if (attrib->queue && g_queue_is_empty(attrib->queue) == FALSE)
> + if (!compound && attrib->queue &&
> + g_queue_is_empty(attrib->queue) == FALSE)
> wake_up_sender(attrib);
>
> if (cmd) {
> @@ -340,6 +345,11 @@ done:
> cmd->func(status, buf, len, cmd->user_data);
>
> command_destroy(cmd);
> +
> + if (compound && attrib->queue &&
> + g_queue_is_empty(attrib->queue) == FALSE)
> + wake_up_sender(attrib);
> +
Any chance to change the logic to avoid duplicated verification?
No mater the value of "compound" wake_up_sender() is always called. Is
the order important?
> }
>
> return TRUE;
> @@ -367,12 +377,16 @@ GAttrib *g_attrib_new(GIOChannel *io)
> return g_attrib_ref(attrib);
> }
>
> -guint g_attrib_send(GAttrib *attrib, guint8 opcode, const guint8 *pdu,
> - guint16 len, GAttribResultFunc func,
> - gpointer user_data, GDestroyNotify notify)
> +guint g_attrib_send_seq(GAttrib *attrib, gboolean compound, guint id,
> + guint8 opcode, const guint8 *pdu, guint16 len,
> + GAttribResultFunc func, gpointer user_data,
> + GDestroyNotify notify)
> {
> struct command *c;
>
> + if (attrib == NULL || attrib->queue == NULL)
> + return 0;
> +
Is it necessary to check if queue is NULL?
> c = g_try_new0(struct command, 1);
> if (c == NULL)
> return 0;
> @@ -385,16 +399,30 @@ guint g_attrib_send(GAttrib *attrib, guint8 opcode, const guint8 *pdu,
> c->func = func;
> c->user_data = user_data;
> c->notify = notify;
> - c->id = ++attrib->next_cmd_id;
> + c->compound = compound;
>
> - g_queue_push_tail(attrib->queue, c);
> + if (id) {
> + c->id = id;
> + g_queue_push_head(attrib->queue, c);
> + } else {
> + c->id = ++attrib->next_cmd_id;
> + g_queue_push_tail(attrib->queue, c);
>
> - if (g_queue_get_length(attrib->queue) == 1)
> - wake_up_sender(attrib);
> + if (g_queue_get_length(attrib->queue) == 1)
> + wake_up_sender(attrib);
> + }
>
> return c->id;
> }
>
> +guint g_attrib_send(GAttrib *attrib, guint8 opcode, const guint8 *pdu,
> + guint16 len, GAttribResultFunc func,
> + gpointer user_data, GDestroyNotify notify)
> +{
> + return g_attrib_send_seq(attrib, FALSE, 0, opcode,
> + pdu, len, func, user_data, notify);
Coding style issue here.
Claudio
^ permalink raw reply
* [PATCH v2 3/18] Move primary service storage to device.c
From: Sheldon Demario @ 2010-12-22 22:01 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
In-Reply-To: <20101222115722.GC27483@jh-x301>
Discover All Primary Services has beed moved to device.c in order
to follow a similar approach of BR/EDR service records.
---
attrib/att.h | 6 ++++++
attrib/client.c | 41 -----------------------------------------
attrib/gattrib.c | 1 +
src/device.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
src/glib-helper.c | 24 ++++++++++++++++--------
5 files changed, 66 insertions(+), 50 deletions(-)
diff --git a/attrib/att.h b/attrib/att.h
index 0b8612e..08feeec 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -137,6 +137,12 @@ struct att_range {
uint16_t end;
};
+struct att_primary {
+ char uuid[MAX_LEN_UUID_STR + 1];
+ uint16_t start;
+ uint16_t end;
+};
+
/* These functions do byte conversion */
static inline uint8_t att_get_u8(const void *ptr)
{
diff --git a/attrib/client.c b/attrib/client.c
index 69e4fb8..00d0bbc 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -1086,35 +1086,6 @@ static void load_attribute_data(char *key, char *value, void *data)
chr->format = attr_data_from_string(value + MAX_LEN_UUID_STR);
}
-static char *primary_list_to_string(GSList *primary_list)
-{
- GString *services;
- GSList *l;
-
- services = g_string_new(NULL);
-
- for (l = primary_list; l; l = l->next) {
- struct primary *primary = l->data;
- uuid_t *uuid128;
- char service[64];
- char uuidstr[MAX_LEN_UUID_STR];
-
- memset(service, 0, sizeof(service));
-
- uuid128 = sdp_uuid_to_uuid128(&primary->uuid);
- sdp_uuid2strn(uuid128, uuidstr, MAX_LEN_UUID_STR);
-
- bt_free(uuid128);
-
- snprintf(service, sizeof(service), "%04X#%04X#%s ",
- primary->start, primary->end, uuidstr);
-
- services = g_string_append(services, service);
- }
-
- return g_string_free(services, FALSE);
-}
-
static GSList *string_to_primary_list(struct gatt_service *gatt,
const char *str)
{
@@ -1158,17 +1129,6 @@ static GSList *string_to_primary_list(struct gatt_service *gatt,
return l;
}
-static void store_primary_services(struct gatt_service *gatt)
-{
- char *services;
-
- services = primary_list_to_string(gatt->primary);
-
- write_device_services(&gatt->sba, &gatt->dba, services);
-
- g_free(services);
-}
-
static gboolean load_primary_services(struct gatt_service *gatt)
{
GSList *primary_list;
@@ -1225,7 +1185,6 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
if (gatt->primary == NULL)
goto done;
- store_primary_services(gatt);
register_primary(gatt);
g_slist_foreach(gatt->primary, discover_all_char, gatt);
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index eace01b..9268001 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -30,6 +30,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
#include "att.h"
#include "btio.h"
diff --git a/src/device.c b/src/device.c
index c306e43..4bf9b52 100644
--- a/src/device.c
+++ b/src/device.c
@@ -45,6 +45,7 @@
#include "log.h"
#include "textfile.h"
+#include "att.h"
#include "hcid.h"
#include "adapter.h"
#include "device.h"
@@ -1518,10 +1519,36 @@ static void init_browse(struct browse_req *req, gboolean reverse)
l->data);
}
+static char *primary_list_to_string(GSList *primary_list)
+{
+ GString *services;
+ GSList *l;
+
+ services = g_string_new(NULL);
+
+ for (l = primary_list; l; l = l->next) {
+ struct att_primary *primary = l->data;
+ char service[64];
+
+ memset(service, 0, sizeof(service));
+
+ snprintf(service, sizeof(service), "%04X#%04X#%s ",
+ primary->start, primary->end, primary->uuid);
+
+ services = g_string_append(services, service);
+ }
+
+ return g_string_free(services, FALSE);
+}
+
static void primary_cb(GSList *services, int err, gpointer user_data)
{
struct browse_req *req = user_data;
struct btd_device *device = req->device;
+ struct btd_adapter *adapter = device->adapter;
+ GSList *l, *uuids = NULL;
+ bdaddr_t dba, sba;
+ char *str;
if (err) {
DBusMessage *reply;
@@ -1532,10 +1559,25 @@ static void primary_cb(GSList *services, int err, gpointer user_data)
services_changed(device);
device_set_temporary(device, FALSE);
- device_probe_drivers(device, services);
+
+ for (l = services; l; l = l->next) {
+ struct att_primary *prim = l->data;
+ uuids = g_slist_append(uuids, prim->uuid);
+ }
+
+ device_probe_drivers(device, uuids);
+ g_slist_free(uuids);
create_device_reply(device, req);
+ str = primary_list_to_string(services);
+
+ adapter_get_address(adapter, &sba);
+ device_get_address(device, &dba);
+
+ write_device_services(&sba, &dba, str);
+ g_free(str);
+
done:
device->browse = NULL;
browse_request_free(req);
diff --git a/src/glib-helper.c b/src/glib-helper.c
index bf39a83..60248cf 100644
--- a/src/glib-helper.c
+++ b/src/glib-helper.c
@@ -55,7 +55,7 @@ struct gattrib_context {
bt_primary_t cb;
bt_destroy_t destroy;
gpointer user_data;
- GSList *uuids;
+ GSList *primaries;
};
static GSList *gattrib_list = NULL;
@@ -75,8 +75,8 @@ static void gattrib_context_free(struct gattrib_context *ctxt)
if (ctxt->destroy)
ctxt->destroy(ctxt->user_data);
- g_slist_foreach(ctxt->uuids, (GFunc) g_free, NULL);
- g_slist_free(ctxt->uuids);
+ g_slist_foreach(ctxt->primaries, (GFunc) g_free, NULL);
+ g_slist_free(ctxt->primaries);
g_attrib_unref(ctxt->attrib);
if (ctxt->io) {
g_io_channel_unref(ctxt->io);
@@ -439,7 +439,7 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
struct gattrib_context *ctxt = user_data;
struct att_data_list *list;
unsigned int i, err;
- uint16_t end;
+ uint16_t start, end;
if (status == ATT_ECODE_ATTR_NOT_FOUND) {
err = 0;
@@ -459,9 +459,10 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
for (i = 0, end = 0; i < list->num; i++) {
const uint8_t *data = list->data[i];
- char *prim;
+ struct att_primary *primary;
uuid_t u128, u16;
+ start = att_get_u16(&data[0]);
end = att_get_u16(&data[2]);
if (list->len == 6) {
@@ -475,8 +476,15 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
/* Skipping invalid data */
continue;
- prim = bt_uuid2string(&u128);
- ctxt->uuids = g_slist_append(ctxt->uuids, prim);
+ primary = g_try_new0(struct att_primary, 1);
+ if (!primary) {
+ err = -ENOMEM;
+ goto done;
+ }
+ primary->start = start;
+ primary->end = end;
+ sdp_uuid2strn(&u128, primary->uuid, sizeof(primary->uuid));
+ ctxt->primaries = g_slist_append(ctxt->primaries, primary);
}
att_data_list_free(list);
@@ -489,7 +497,7 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
}
done:
- ctxt->cb(ctxt->uuids, err, ctxt->user_data);
+ ctxt->cb(ctxt->primaries, err, ctxt->user_data);
gattrib_context_free(ctxt);
}
--
1.7.3.2
^ permalink raw reply related
* Re: [PATCH v5] Bluetooth: Fix __hci_request synchronization for hci_open_dev
From: Marcel Holtmann @ 2010-12-22 21:31 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
In-Reply-To: <1292965287-29849-1-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
> The initialization function used by hci_open_dev (hci_init_req) sends
> many different HCI commands. The __hci_request function should only
> return when all of these commands have completed (or a timeout occurs).
> Several of these commands cause hci_req_complete to be called which
> causes __hci_request to return prematurely.
>
> This patch fixes the issue by adding a new hdev->req_last_cmd variable
> which is set during the initialization procedure. The hci_req_complete
> function will no longer mark the request as complete until the command
> matching hdev->req_last_cmd completes.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
> ---
> v5: comment added for req_last_cmd check as well as empty line added to
> hci_init_req as requested
looks all good to me.
Acked-by: Marcel Holtmann <marcel@holtmann.org.
Regards
Marcel
^ permalink raw reply
* [PATCH] Change LE scan interval and window to recommended values
From: Bruna Moreira @ 2010-12-22 19:11 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
Replace default scan interval and scan window values with recommended
ones for general discovery procedure, according to the Core
specification.
---
plugins/hciops.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 43e3d93..be143e9 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2583,8 +2583,10 @@ static int hciops_start_scanning(int index)
memset(&cp, 0, sizeof(cp));
cp.type = 0x01; /* Active scanning */
- cp.interval = htobs(0x0010);
- cp.window = htobs(0x0010);
+ /* The recommended value for scan interval and window is 11.25 msec.
+ * It is calculated by: time = n * 0.625 msec */
+ cp.interval = htobs(0x0012);
+ cp.window = htobs(0x0012);
cp.own_bdaddr_type = 0; /* Public address */
cp.filter = 0; /* Accept all adv packets */
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH v3] sbc: detect when bitpool has changed
From: Brian Gix @ 2010-12-22 17:55 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1293010548-25151-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Wed, 2010-12-22 at 11:35 +0200, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> A2DP spec allow bitpool changes midstream which is why sbc configuration
> has a range of values for bitpool that the encoder can use and decoder
> must support.
>
> Bitpool changes do not affect the state of encoder/decoder so they don't
> need to be reinitialize when this happens, so the impact is fairly small,
> what it does change is the frame length so encoders may change the
> bitpool to use the link more efficiently.
> ---
> sbc/sbc.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/sbc/sbc.c b/sbc/sbc.c
> index a6391ae..77fcc5d 100644
> --- a/sbc/sbc.c
> +++ b/sbc/sbc.c
> @@ -978,6 +978,9 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
>
> priv->frame.codesize = sbc_get_codesize(sbc);
> priv->frame.length = framelen;
> + } else if (priv->frame.bitpool != sbc->bitpool) {
> + priv->frame.length = framelen;
> + sbc->bitpool = priv->frame.bitpool;
> }
>
> if (!output)
> @@ -1050,6 +1053,9 @@ ssize_t sbc_encode(sbc_t *sbc, const void *input, size_t input_len,
>
> sbc_encoder_init(&priv->enc_state, &priv->frame);
> priv->init = 1;
> + } else if (priv->frame.bitpool != sbc->bitpool) {
> + priv->frame.length = sbc_get_frame_length(sbc);
> + priv->frame.bitpool = sbc->bitpool;
> }
>
> /* input must be large enough to encode a complete frame */
> @@ -1120,7 +1126,7 @@ size_t sbc_get_frame_length(sbc_t *sbc)
> struct sbc_priv *priv;
>
> priv = sbc->priv;
> - if (priv->init)
> + if (priv->init && priv->frame.bitpool == sbc->bitpool)
> return priv->frame.length;
>
> subbands = sbc->subbands ? 8 : 4;
I think this patch is correct.
--
Brian Gix
bgix@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply
* SBC loudness bug?
From: Christian Hoene @ 2010-12-22 14:14 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz', linux-bluetooth
Cc: 'Hagen Hentschel (Ellisys)'
In-Reply-To: <1293010548-25151-1-git-send-email-luiz.dentz@gmail.com>
Hello,
Mr. Hagen Hentschel was telling me that the BlueZ SBC implementation still has an bug. As compared to Bluetooth's reference implementation the signal is twotimes too silent. We told me, that in the last step of calculating the PCM samples a 1 bit right shift was done too much.
A correct implementation for C# can be found at http://sourceforge.net/projects/sbcsharp/
Sorry, due to time limits I cannot provide you with a patch...
With best regards,
Christian Hoene
^ permalink raw reply
* Re: [PATCH 05/18] Add support for storing the device type
From: Johan Hedberg @ 2010-12-22 12:00 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-6-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> When the service discovery (SDP or GATT) is finished, write the device
> type so it can be retrieved from storage when needed.
> ---
> src/device.c | 11 ++++++++++-
> 1 files changed, 10 insertions(+), 1 deletions(-)
This one doesn't apply, probably because I didn't apply 3/18. Please
resend a fixed 3/18 and then I'll proceed with processing this patch
set.
Johan
^ permalink raw reply
* Re: [PATCH 04/18] Add a way to store the remote device type
From: Johan Hedberg @ 2010-12-22 11:58 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-5-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> Because we need to know the device type (LE, Basic Rate or Dual Mode)
> to be able to fully restore the device from storage, we have to store
> and load this information to permanent storage.
>
> Note: due to "device_type_t" usage in storage.h, some header includes
> needed to be reordered in files which include storage.h.
> ---
> input/device.c | 4 ++--
> plugins/hciops.c | 2 +-
> serial/port.c | 2 ++
> src/storage.c | 40 ++++++++++++++++++++++++++++++++++++++++
> src/storage.h | 3 +++
> 5 files changed, 48 insertions(+), 3 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 03/18] Move primary service storage to device.c
From: Johan Hedberg @ 2010-12-22 11:57 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth, Sheldon Demario
In-Reply-To: <1292966800-6264-4-git-send-email-vinicius.gomes@openbossa.org>
Hi,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> +void att_primary_free(struct att_primary *prim)
> +{
> + g_free(prim);
> +}
<snip>
> + g_slist_foreach(ctxt->primaries, (GFunc) att_primary_free, NULL);
If you're gonna do typecasting to GFunc (something which btw should be
avoided whenever possible) you might as well pass g_free directly and
not create any dedicated function for it.
Johan
^ permalink raw reply
* Re: [PATCH 02/18] Fix memory leaks in the attrib-server
From: Johan Hedberg @ 2010-12-22 11:55 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-3-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> ---
> src/attrib-server.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
Pushed upstream, though isn't the following bit kind of unnecessary. I
don't see how the code could end up there when le_io isn't NULL:
> @@ -803,6 +804,11 @@ failed:
> g_io_channel_unref(l2cap_io);
> l2cap_io = NULL;
>
> + if (le_io) {
> + g_io_channel_unref(le_io);
> + le_io = NULL;
> + }
> +
Johan
^ permalink raw reply
* Re: [PATCH 01/18] Fix attrib plugin deregistration
From: Johan Hedberg @ 2010-12-22 11:54 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-2-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, Dec 21, 2010, Vinicius Costa Gomes wrote:
> As the comparison method used for find what to de-register was
> wrong, it was causing the btd_device reference that the attrib
> plugin was keeping never to be dropped.
> ---
> attrib/client.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* RE: problem to disconnect with bluez-test
From: Goubert, TonyX @ 2010-12-22 11:02 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <20101221222425.GA18281@jh-x301>
Hello,
Thank you for your answer.
This command is ok, I can disconnect.
Well, I'm a newbie in python but I'm interesting to contribute.
Is there a documentation which describes the command that we can develop?
For example, now I want to be able to connect after a disconnect.
BR.
--
Tony Goubert
tonyx.goubert@intel.com
-----Original Message-----
From: Johan Hedberg [mailto:johan.hedberg@gmail.com]
Sent: Tuesday, December 21, 2010 11:24 PM
To: Goubert, TonyX
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: problem to disconnect with bluez-test
Hi Tony,
On Tue, Dec 21, 2010, Goubert, TonyX wrote:
> Yes, in fact, I want to use the test scripts in bluez to disconnect a
> device.
>
> Well, I download the latest version of bluez (Bluez-4.82) and I have
> not find the command 'disconnect' in the script 'test-device'.
> There are : list, create, remove, ... no disconnect.
Obviously that's the case since 4.82 was released before I created the
patch.
> > I just went ahead and pushed a patch for it upstream.
>
> Can you give me your patch?
As I said, it's upstream. You can get it from there:
http://git.kernel.org/?p=bluetooth/bluez.git;a=summary
http://git.kernel.org/?p=bluetooth/bluez.git;a=commitdiff;h=dd109a698c149a805f19cd2a7ddd0cbb8434f965
Johan
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply
* [PATCH v3] sbc: detect when bitpool has changed
From: Luiz Augusto von Dentz @ 2010-12-22 9:35 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
A2DP spec allow bitpool changes midstream which is why sbc configuration
has a range of values for bitpool that the encoder can use and decoder
must support.
Bitpool changes do not affect the state of encoder/decoder so they don't
need to be reinitialize when this happens, so the impact is fairly small,
what it does change is the frame length so encoders may change the
bitpool to use the link more efficiently.
---
sbc/sbc.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/sbc/sbc.c b/sbc/sbc.c
index a6391ae..77fcc5d 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -978,6 +978,9 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
priv->frame.codesize = sbc_get_codesize(sbc);
priv->frame.length = framelen;
+ } else if (priv->frame.bitpool != sbc->bitpool) {
+ priv->frame.length = framelen;
+ sbc->bitpool = priv->frame.bitpool;
}
if (!output)
@@ -1050,6 +1053,9 @@ ssize_t sbc_encode(sbc_t *sbc, const void *input, size_t input_len,
sbc_encoder_init(&priv->enc_state, &priv->frame);
priv->init = 1;
+ } else if (priv->frame.bitpool != sbc->bitpool) {
+ priv->frame.length = sbc_get_frame_length(sbc);
+ priv->frame.bitpool = sbc->bitpool;
}
/* input must be large enough to encode a complete frame */
@@ -1120,7 +1126,7 @@ size_t sbc_get_frame_length(sbc_t *sbc)
struct sbc_priv *priv;
priv = sbc->priv;
- if (priv->init)
+ if (priv->init && priv->frame.bitpool == sbc->bitpool)
return priv->frame.length;
subbands = sbc->subbands ? 8 : 4;
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] sbc: detect when bitpool has changed
From: Luiz Augusto von Dentz @ 2010-12-22 9:05 UTC (permalink / raw)
To: Brian Gix; +Cc: linux-bluetooth
In-Reply-To: <1292954574.14993.37.camel@sealablnx02.qualcomm.com>
Hi,
On Tue, Dec 21, 2010 at 8:02 PM, Brian Gix <bgix@codeaurora.org> wrote:
> Hello Luiz,
>
> On Tue, 2010-12-21 at 18:58 +0200, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>>
>> ---
>> sbc/sbc.c | 8 +++++---
>> 1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/sbc/sbc.c b/sbc/sbc.c
>> index a6391ae..b3a7a09 100644
>> --- a/sbc/sbc.c
>> +++ b/sbc/sbc.c
>> @@ -965,7 +965,8 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
>>
>> framelen = sbc_unpack_frame(input, &priv->frame, input_len);
>>
>> - if (!priv->init) {
>> + /* init if no previous frame was encode or bitpool has changed */
>> + if (!priv->init || priv->frame.bitpool != sbc->bitpool) {
>> sbc_decoder_init(&priv->dec_state, &priv->frame);
>> priv->init = 1;
>
> I don't think it is a good idea to reinitialize the SBC decoder if a
> change in bitpool size is detected.
>
> The A2DP and AVDTP specifications do not allow most of the parameters to
> change from one frame to the next (mode, channels, subbands, blocks,
> allocation, frequency) but explicitly DO allow changes in bitpool size
> midstream. This allows for Variable Bit Rate (VBR) streaming, and adds
> efficiency to the over-the-air link with no quality loss. Also, the
> space required for decoding does not change just because the bitpool has
> changed, so re-initialization should not be required.
>
> The only things that should be different from one SBC frame to the next
> is the bitpool of course, and the framelen. That said, if a bitpool
> change is detected the only thing within that "IF" block that should be
> updated is:
> sbc->bitpool
You are mostly right, but we should also do priv->frame.length =
framelen to make sure sbc_get_frame_length return it properly.
>
> If any of the other afore mentioned parameters change, the stream should
> be terminated.
>
>>
>> @@ -1035,7 +1036,8 @@ ssize_t sbc_encode(sbc_t *sbc, const void *input, size_t input_len,
>> if (written)
>> *written = 0;
>>
>> - if (!priv->init) {
>> + /* init if no previous frame was encode or bitpool has changed */
>> + if (!priv->init || priv->frame.bitpool != sbc->bitpool) {
>> priv->frame.frequency = sbc->frequency;
>> priv->frame.mode = sbc->mode;
>> priv->frame.channels = sbc->mode == SBC_MODE_MONO ? 1 : 2;
>
> Same basic comment here, although it is perfectly allowable for the
> Encoder to not support VBR. However if the Encoder does change the
> bitpool, then the list of fields that need to be updated are:
> priv->frame.bitpool
> priv->frame.length
>
> But again, the sbc_encoder_init should *not* be re-run. I would pull
> those two variables out of that IF block, and set them in their own IF
> block either directly before or directly after the !priv->init IF block.
>
>
>> @@ -1120,7 +1122,7 @@ size_t sbc_get_frame_length(sbc_t *sbc)
>> struct sbc_priv *priv;
>>
>> priv = sbc->priv;
>> - if (priv->init)
>> + if (priv->init && priv->frame.bitpool == sbc->bitpool)
>> return priv->frame.length;
>>
>> subbands = sbc->subbands ? 8 : 4;
>
> This is a valid change, because bitpool changes do indeed change the
> frame.length.
Ive sent a v2 patch but will update with a v3 with a proper
description why it is needed.
--
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply
* [PATCH v2] sbc: detect when bitpool has changed
From: Luiz Augusto von Dentz @ 2010-12-22 8:33 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
---
sbc/sbc.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/sbc/sbc.c b/sbc/sbc.c
index a6391ae..77fcc5d 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -978,6 +978,9 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
priv->frame.codesize = sbc_get_codesize(sbc);
priv->frame.length = framelen;
+ } else if (priv->frame.bitpool != sbc->bitpool) {
+ priv->frame.length = framelen;
+ sbc->bitpool = priv->frame.bitpool;
}
if (!output)
@@ -1050,6 +1053,9 @@ ssize_t sbc_encode(sbc_t *sbc, const void *input, size_t input_len,
sbc_encoder_init(&priv->enc_state, &priv->frame);
priv->init = 1;
+ } else if (priv->frame.bitpool != sbc->bitpool) {
+ priv->frame.length = sbc_get_frame_length(sbc);
+ priv->frame.bitpool = sbc->bitpool;
}
/* input must be large enough to encode a complete frame */
@@ -1120,7 +1126,7 @@ size_t sbc_get_frame_length(sbc_t *sbc)
struct sbc_priv *priv;
priv = sbc->priv;
- if (priv->init)
+ if (priv->init && priv->frame.bitpool == sbc->bitpool)
return priv->frame.length;
subbands = sbc->subbands ? 8 : 4;
--
1.7.1
^ permalink raw reply related
* Re: problem to disconnect with bluez-test
From: Johan Hedberg @ 2010-12-21 22:24 UTC (permalink / raw)
To: Goubert, TonyX; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <6E42A1B4DD2F7B4D80A1F26BB498BF9F8C9BD2CCC0@irsmsx501.ger.corp.intel.com>
Hi Tony,
On Tue, Dec 21, 2010, Goubert, TonyX wrote:
> Yes, in fact, I want to use the test scripts in bluez to disconnect a
> device.
>
> Well, I download the latest version of bluez (Bluez-4.82) and I have
> not find the command 'disconnect' in the script 'test-device'.
> There are : list, create, remove, ... no disconnect.
Obviously that's the case since 4.82 was released before I created the
patch.
> > I just went ahead and pushed a patch for it upstream.
>
> Can you give me your patch?
As I said, it's upstream. You can get it from there:
http://git.kernel.org/?p=bluetooth/bluez.git;a=summary
http://git.kernel.org/?p=bluetooth/bluez.git;a=commitdiff;h=dd109a698c149a805f19cd2a7ddd0cbb8434f965
Johan
^ permalink raw reply
* Re: [PATCH 13/18] Add support for making LE connections to GATT client
From: Brian Gix @ 2010-12-21 22:22 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1292966800-6264-14-git-send-email-vinicius.gomes@openbossa.org>
Hi Vinicius,
On Tue, 2010-12-21 at 19:26 -0200, Vinicius Costa Gomes wrote:
> Now GATT client should be able to make LE connections. The information
> used to determine if we should make a LE connection is the psm stored
> in the gatt_service structure.
Most of your patches listed here are at a higher level than what I am
currently looking at, so I am just very happy that they are getting
done.
So all of my comments of your patch list are here.
> ---
> attrib/client.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/attrib/client.c b/attrib/client.c
> index 0eadf1e..21ce439 100644
> --- a/attrib/client.c
> +++ b/attrib/client.c
> @@ -409,7 +409,15 @@ static int l2cap_connect(struct gatt_service *gatt, GError **gerr,
> * Configuration it is necessary to poll the server from time
> * to time checking for modifications.
> */
> - io = bt_io_connect(BT_IO_L2CAP, connect_cb, gatt, NULL, gerr,
> + if (gatt->psm < 0)
> + io = bt_io_connect(BT_IO_L2CAP, connect_cb, gatt, NULL, gerr,
> + BT_IO_OPT_SOURCE_BDADDR, &gatt->sba,
> + BT_IO_OPT_DEST_BDADDR, &gatt->dba,
> + BT_IO_OPT_CID, GATT_CID,
> + BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
> + BT_IO_OPT_INVALID);
As I have mentioned previously, I am interested in assuring support of
LE Privacy. This is something we saw for the first time at the
Barcelona UPF, which caused a few teams problems.
While I understand that for now you just want to get Public Addressing
working, I think we may want to include a framework which allows for
Ransom and private addressing in the future, even if for now they are
just place-holders.
Towards that end, any interface like bt_io_connect which is specifying
the Source and Destination address in this manner, should also include
the address type, which at a minimum will need to be stored with the
Destination BDADDR. Source address type is less of a concern, as the
lower kernel layers can probably derive it. But I would suggest a
connect parameter of:
BT_IO_OPT_DEST_BDADDR_TYPE
with possible values of
0x00 - Public
0x01 - Random
And a gatt structure member of something like "uint8_t dbat".
> + else
> + io = bt_io_connect(BT_IO_L2CAP, connect_cb, gatt, NULL, gerr,
> BT_IO_OPT_SOURCE_BDADDR, &gatt->sba,
> BT_IO_OPT_DEST_BDADDR, &gatt->dba,
> BT_IO_OPT_PSM, gatt->psm,
Regards,
--
Brian Gix
bgix@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply
* Re: [PATCH] Configure HFP/HSP endpoints if headset interface is already connected
From: Johan Hedberg @ 2010-12-21 22:20 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1292946195-25355-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Dec 21, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> HFP/HSP can be connected when registering an endpoint which is different
> than on a2dp where the sep cannot be configured already since it wasn't
> available before.
> ---
> audio/media.c | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
The patch has been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 00/18] Making GATT a first class citizen
From: Vinicius Gomes @ 2010-12-21 22:19 UTC (permalink / raw)
To: Brian Gix; +Cc: linux-bluetooth
In-Reply-To: <1292969192.14993.61.camel@sealablnx02.qualcomm.com>
Hi Brian,
On Tue, Dec 21, 2010 at 8:06 PM, Brian Gix <bgix@codeaurora.org> wrote:
> Hi Vinicius,
>
> On Tue, 2010-12-21 at 19:26 -0200, Vinicius Costa Gomes wrote:
>> Hi,
>>
>> These are the first steps in the direction of making GATT a first
>> class citizen in Bluez.
>
> Is there a simple text file anywhere yet, that details the up-to-date
> Object-Path/Interface/Method/Properties/etc DBus API layout of the LE
> additions?
>
Yes, doc/attribute-api.txt should contain the documentation of the DBus API.
> Thanks,
>
> --
> Brian Gix
> bgix@codeaurora.org
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Vinicius
^ permalink raw reply
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