* [PATCH v2 2/2] Correct UUIDs list to EIR
From: Francisco Alecrim @ 2010-04-07 15:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Francisco Alecrim
In-Reply-To: <1270652663-23107-2-git-send-email-francisco.alecrim@openbossa.org>
Correct create_ext_inquiry_response to response only UUIDs per-adapter.
---
src/adapter.c | 3 ++-
src/sdpd-service.c | 5 +++--
src/sdpd.h | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index cdd5562..7008410 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -816,7 +816,8 @@ static void update_ext_inquiry_response(struct btd_adapter *adapter)
if (dev->ssp_mode > 0)
create_ext_inquiry_response((char *) dev->name,
- adapter->tx_power, data);
+ adapter->tx_power,
+ adapter->services, data);
if (hci_write_ext_inquiry_response(dd, fec, data,
HCI_REQ_TIMEOUT) < 0)
diff --git a/src/sdpd-service.c b/src/sdpd-service.c
index a8f7d47..4551577 100644
--- a/src/sdpd-service.c
+++ b/src/sdpd-service.c
@@ -167,9 +167,10 @@ uint8_t get_service_classes(const bdaddr_t *bdaddr)
}
void create_ext_inquiry_response(const char *name,
- int8_t tx_power, uint8_t *data)
+ int8_t tx_power, sdp_list_t *services,
+ uint8_t *data)
{
- sdp_list_t *list = sdp_get_record_list();
+ sdp_list_t *list = services;
uint8_t *ptr = data;
uint16_t uuid[24];
int i, index = 0;
diff --git a/src/sdpd.h b/src/sdpd.h
index 1352a83..1f0a229 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -95,4 +95,5 @@ int remove_record_from_server(uint32_t handle);
uint8_t get_service_classes(const bdaddr_t *bdaddr);
void create_ext_inquiry_response(const char *name,
- int8_t tx_power, uint8_t *data);
+ int8_t tx_power, sdp_list_t *services,
+ uint8_t *data);
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH v2 1/2] Report local services(UUIDs) through DBus
From: Johan Hedberg @ 2010-04-07 15:30 UTC (permalink / raw)
To: Francisco Alecrim; +Cc: linux-bluetooth
In-Reply-To: <1270652663-23107-2-git-send-email-francisco.alecrim@openbossa.org>
Hi Alecrim,
A few more minor correction suggestions:
On Wed, Apr 07, 2010, Francisco Alecrim wrote:
> + emit_array_property_changed(connection, adapter->path,
> + ADAPTER_INTERFACE, "UUIDs",
> + DBUS_TYPE_STRING, &uuids);
The general rule for continuation line indenting is: indent as much as
possible as long as the total length doesn't go beyond 80. It looks like
these two lines could be indented a bit more. There are a few other
similar places too but I think you should be able to find them by
yourself.
> + for (i = 0; uuids[i]; i++)
> + g_free(uuids[i]);
> + g_free(uuids);
These three lines could be replaced simply with g_strfreev(uuids);
> + for (i = 0; uuids[i]; i++)
> + g_free(uuids[i]);
> + g_free(uuids);
And same here.
Johan
^ permalink raw reply
* [PATCH v3 0/2] Services through DBus and correct EIR
From: Francisco Alecrim @ 2010-04-07 16:25 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Francisco Alecrim
* Third version:
** Indent change at adapter_emit_uuids_updated
** Use g_strfreev instead of loop to free **uuids.
Francisco Alecrim (2):
Report local services(UUIDs) through DBus
Correct UUIDs list to EIR
doc/adapter-api.txt | 5 +++
src/adapter.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/adapter.h | 2 +
src/sdpd-database.c | 4 ++
src/sdpd-service.c | 5 ++-
src/sdpd.h | 3 +-
test/list-devices | 3 ++
7 files changed, 104 insertions(+), 5 deletions(-)
^ permalink raw reply
* [PATCH v3 1/2] Report local services(UUIDs) through DBus
From: Francisco Alecrim @ 2010-04-07 16:25 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Francisco Alecrim
In-Reply-To: <1270657550-28767-1-git-send-email-francisco.alecrim@openbossa.org>
* Include UUIDs field to method GetProperties(org.bluez.Adapter).
Applications can get local services(UUIDs) available through DBus.
* UUIDs per-adapter stored at btd_adapter to prevent some searches not
necessary regarding it requires information from access_db and service_db.
* Emit Adapter.PropertyChanged signal when UUIDs change.
---
doc/adapter-api.txt | 5 +++
src/adapter.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-
src/adapter.h | 2 +
src/sdpd-database.c | 4 ++
test/list-devices | 3 ++
5 files changed, 97 insertions(+), 1 deletions(-)
diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index 48cab40..6098c76 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -270,3 +270,8 @@ Properties string Address [readonly]
array{object} Devices [readonly]
List of device object paths.
+
+ array{string} UUIDs [readonly]
+
+ List of 128-bit UUIDs that represents the available
+ local services.
diff --git a/src/adapter.c b/src/adapter.c
index 5fd0736..c7a0c76 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -37,6 +37,7 @@
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
#include <glib.h>
#include <dbus/dbus.h>
@@ -115,6 +116,7 @@ struct btd_adapter {
GSList *mode_sessions; /* Request Mode sessions */
GSList *disc_sessions; /* Discovery sessions */
guint scheduler_id; /* Scheduler handle */
+ sdp_list_t *services; /* Services associated to adapter */
struct hci_dev dev; /* hci info */
int8_t tx_power; /* inq response tx power level */
@@ -1033,6 +1035,73 @@ static void adapter_update_devices(struct btd_adapter *adapter)
g_free(devices);
}
+static void adapter_emit_uuids_updated(struct btd_adapter *adapter)
+{
+ char **uuids;
+ int i;
+ sdp_list_t *list;
+
+ uuids = g_new0(char *, sdp_list_len(adapter->services) + 1);
+
+ for (i = 0, list = adapter->services; list; list = list->next, i++) {
+ sdp_record_t *rec = list->data;
+ uuids[i] = bt_uuid2string(&rec->svclass);
+ }
+
+ emit_array_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "UUIDs", DBUS_TYPE_STRING, &uuids);
+
+ g_strfreev(uuids);
+}
+
+/*
+ * adapter_services_inc_rem - Insert or remove UUID from adapter
+ */
+static void adapter_service_ins_rem(const bdaddr_t *bdaddr, void *rec,
+ gboolean insert)
+{
+ struct btd_adapter *adapter;
+ GSList *adapters;
+
+ adapters = NULL;
+
+ if (bacmp(bdaddr, BDADDR_ANY) != 0) {
+ /* Only one adapter */
+ adapter = manager_find_adapter(bdaddr);
+ if (!adapter)
+ return;
+
+ adapters = g_slist_append(adapters, adapter);
+ } else
+ /* Emit D-Bus msg to all adapters */
+ adapters = manager_get_adapters();
+
+ for (; adapters; adapters = adapters->next) {
+ adapter = adapters->data;
+
+ if (insert == TRUE)
+ adapter->services = sdp_list_append(adapter->services,
+ rec);
+ else
+ adapter->services = sdp_list_remove(adapter->services,
+ rec);
+
+ adapter_emit_uuids_updated(adapter);
+ }
+}
+
+void adapter_service_insert(const bdaddr_t *bdaddr, void *rec)
+{
+ /* TRUE to include service*/
+ adapter_service_ins_rem(bdaddr, rec, TRUE);
+}
+
+void adapter_service_remove(const bdaddr_t *bdaddr, void *rec)
+{
+ /* FALSE to remove service*/
+ adapter_service_ins_rem(bdaddr, rec, FALSE);
+}
+
struct btd_device *adapter_create_device(DBusConnection *conn,
struct btd_adapter *adapter,
const char *address)
@@ -1196,9 +1265,10 @@ static DBusMessage *get_properties(DBusConnection *conn,
DBusMessageIter dict;
char str[MAX_NAME_LENGTH + 1], srcaddr[18];
gboolean value;
- char **devices;
+ char **devices, **uuids;
int i;
GSList *l;
+ sdp_list_t *list;
ba2str(&adapter->bdaddr, srcaddr);
@@ -1270,6 +1340,18 @@ static DBusMessage *get_properties(DBusConnection *conn,
&devices, i);
g_free(devices);
+ /* UUIDs */
+ uuids = g_new0(char *, sdp_list_len(adapter->services) + 1);
+
+ for (i = 0, list = adapter->services; list; list = list->next, i++) {
+ sdp_record_t *rec = list->data;
+ uuids[i] = bt_uuid2string(&rec->svclass);
+ }
+
+ dict_append_array(&dict, "UUIDs", DBUS_TYPE_STRING, &uuids, i);
+
+ g_strfreev(uuids);
+
dbus_message_iter_close_container(&iter, &dict);
return reply;
diff --git a/src/adapter.h b/src/adapter.h
index 9b4ce10..e4307d8 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -121,6 +121,8 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode);
void adapter_setname_complete(bdaddr_t *local, uint8_t status);
void adapter_update_tx_power(bdaddr_t *bdaddr, uint8_t status, void *ptr);
void adapter_update_local_name(bdaddr_t *bdaddr, uint8_t status, void *ptr);
+void adapter_service_insert(const bdaddr_t *bdaddr, void *rec);
+void adapter_service_remove(const bdaddr_t *bdaddr, void *rec);
void adapter_set_class_complete(bdaddr_t *bdaddr, uint8_t status);
struct agent *adapter_get_agent(struct btd_adapter *adapter);
diff --git a/src/sdpd-database.c b/src/sdpd-database.c
index 07a0bc3..224a4e7 100644
--- a/src/sdpd-database.c
+++ b/src/sdpd-database.c
@@ -40,6 +40,7 @@
#include "sdpd.h"
#include "logging.h"
+#include "adapter.h"
static sdp_list_t *service_db;
static sdp_list_t *access_db;
@@ -183,6 +184,8 @@ void sdp_record_add(const bdaddr_t *device, sdp_record_t *rec)
dev->handle = rec->handle;
access_db = sdp_list_insert_sorted(access_db, dev, access_sort);
+
+ adapter_service_insert(device, rec);
}
static sdp_list_t *record_locate(uint32_t handle)
@@ -252,6 +255,7 @@ int sdp_record_remove(uint32_t handle)
if (p) {
a = (sdp_access_t *) p->data;
if (a) {
+ adapter_service_remove(&a->device, r);
access_db = sdp_list_remove(access_db, a);
access_free(a);
}
diff --git a/test/list-devices b/test/list-devices
index 511d0cf..9120714 100755
--- a/test/list-devices
+++ b/test/list-devices
@@ -40,6 +40,9 @@ for i in adapter_list:
if (key == "Devices"):
list = extract_objects(value)
print " %s = %s" % (key, list)
+ elif (key == "UUIDs"):
+ list = extract_uuids(value)
+ print " %s = %s" % (key, list)
else:
print " %s = %s" % (key, value)
--
1.6.3.3
^ permalink raw reply related
* [PATCH v3 2/2] Correct UUIDs list to EIR
From: Francisco Alecrim @ 2010-04-07 16:25 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Francisco Alecrim
In-Reply-To: <1270657550-28767-2-git-send-email-francisco.alecrim@openbossa.org>
Correct create_ext_inquiry_response to response only UUIDs per-adapter.
---
src/adapter.c | 3 ++-
src/sdpd-service.c | 5 +++--
src/sdpd.h | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index c7a0c76..e1f6414 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -816,7 +816,8 @@ static void update_ext_inquiry_response(struct btd_adapter *adapter)
if (dev->ssp_mode > 0)
create_ext_inquiry_response((char *) dev->name,
- adapter->tx_power, data);
+ adapter->tx_power,
+ adapter->services, data);
if (hci_write_ext_inquiry_response(dd, fec, data,
HCI_REQ_TIMEOUT) < 0)
diff --git a/src/sdpd-service.c b/src/sdpd-service.c
index a8f7d47..4551577 100644
--- a/src/sdpd-service.c
+++ b/src/sdpd-service.c
@@ -167,9 +167,10 @@ uint8_t get_service_classes(const bdaddr_t *bdaddr)
}
void create_ext_inquiry_response(const char *name,
- int8_t tx_power, uint8_t *data)
+ int8_t tx_power, sdp_list_t *services,
+ uint8_t *data)
{
- sdp_list_t *list = sdp_get_record_list();
+ sdp_list_t *list = services;
uint8_t *ptr = data;
uint16_t uuid[24];
int i, index = 0;
diff --git a/src/sdpd.h b/src/sdpd.h
index 1352a83..1f0a229 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -95,4 +95,5 @@ int remove_record_from_server(uint32_t handle);
uint8_t get_service_classes(const bdaddr_t *bdaddr);
void create_ext_inquiry_response(const char *name,
- int8_t tx_power, uint8_t *data);
+ int8_t tx_power, sdp_list_t *services,
+ uint8_t *data);
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH v3 0/2] Services through DBus and correct EIR
From: Johan Hedberg @ 2010-04-07 17:35 UTC (permalink / raw)
To: Francisco Alecrim; +Cc: linux-bluetooth
In-Reply-To: <1270657550-28767-1-git-send-email-francisco.alecrim@openbossa.org>
Hi Alecrim,
On Wed, Apr 07, 2010, Francisco Alecrim wrote:
> * Third version:
> ** Indent change at adapter_emit_uuids_updated
> ** Use g_strfreev instead of loop to free **uuids.
>
> Francisco Alecrim (2):
> Report local services(UUIDs) through DBus
> Correct UUIDs list to EIR
>
> doc/adapter-api.txt | 5 +++
> src/adapter.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++-
> src/adapter.h | 2 +
> src/sdpd-database.c | 4 ++
> src/sdpd-service.c | 5 ++-
> src/sdpd.h | 3 +-
> test/list-devices | 3 ++
> 7 files changed, 104 insertions(+), 5 deletions(-)
Thanks for the updated patches! They are now pushed upstream. It seems
you missed my point about other indentation issues than the one I
explicitly pointed out, but I went ahead and fixed that in a separate
commit to avoid a new feedback round for such a minor issue.
Johan
^ permalink raw reply
* [PATCH] Update service class on adapter-by-adapter basis
From: Elvis Pfützenreuter @ 2010-04-07 21:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
From: Elvis Pfutzenreuter <epx@signove.com>
When a service is added (or removed) for a specific adapter,
only the service class of that specific adapter shall be updated.
---
src/adapter.c | 15 +++++++++++++++
src/adapter.h | 2 ++
src/sdpd-service.c | 24 +++++++++++++++---------
src/sdpd.h | 1 -
4 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 8fc47b9..1530f83 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1103,6 +1103,21 @@ void adapter_service_remove(const bdaddr_t *bdaddr, void *rec)
adapter_service_ins_rem(bdaddr, rec, FALSE);
}
+sdp_list_t *adapter_service_list(const bdaddr_t *bdaddr)
+{
+ struct btd_adapter *adapter;
+ sdp_list_t *list = NULL;
+
+ if (bacmp(bdaddr, BDADDR_ANY) != 0) {
+ /* Only one adapter */
+ adapter = manager_find_adapter(bdaddr);
+ if (adapter)
+ list = adapter->services;
+ }
+
+ return list;
+}
+
struct btd_device *adapter_create_device(DBusConnection *conn,
struct btd_adapter *adapter,
const char *address)
diff --git a/src/adapter.h b/src/adapter.h
index e4307d8..5975299 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -23,6 +23,7 @@
*/
#include <bluetooth/bluetooth.h>
+#include <bluetooth/sdp.h>
#include <dbus/dbus.h>
#include <glib.h>
@@ -123,6 +124,7 @@ void adapter_update_tx_power(bdaddr_t *bdaddr, uint8_t status, void *ptr);
void adapter_update_local_name(bdaddr_t *bdaddr, uint8_t status, void *ptr);
void adapter_service_insert(const bdaddr_t *bdaddr, void *rec);
void adapter_service_remove(const bdaddr_t *bdaddr, void *rec);
+sdp_list_t *adapter_service_list(const bdaddr_t *bdaddr);
void adapter_set_class_complete(bdaddr_t *bdaddr, uint8_t status);
struct agent *adapter_get_agent(struct btd_adapter *adapter);
diff --git a/src/sdpd-service.c b/src/sdpd-service.c
index 4551577..cddd87e 100644
--- a/src/sdpd-service.c
+++ b/src/sdpd-service.c
@@ -47,11 +47,10 @@
#include "sdpd.h"
#include "logging.h"
#include "manager.h"
+#include "adapter.h"
static sdp_record_t *server = NULL;
-static uint8_t service_classes = 0x00;
-
static uint16_t did_vendor = 0x0000;
static uint16_t did_product = 0x0000;
static uint16_t did_version = 0x0000;
@@ -98,9 +97,9 @@ static void update_db_timestamp(void)
sdp_attr_replace(server, SDP_ATTR_SVCDB_STATE, d);
}
-static void update_svclass_list(const bdaddr_t *src)
+static void update_adapter_svclass_list(const bdaddr_t *src)
{
- sdp_list_t *list = sdp_get_record_list();
+ sdp_list_t *list = adapter_service_list(src);
uint8_t val = 0;
for (; list; list = list->next) {
@@ -156,14 +155,21 @@ static void update_svclass_list(const bdaddr_t *src)
SDPDBG("Service classes 0x%02x", val);
- service_classes = val;
-
manager_update_svc(src, val);
}
-uint8_t get_service_classes(const bdaddr_t *bdaddr)
+static void update_svclass_list(const bdaddr_t *src)
{
- return service_classes;
+ bdaddr_t bdaddr;
+ GSList *adapters = manager_get_adapters();
+
+ for (; adapters; adapters = adapters->next) {
+ adapter_get_address(adapters->data, &bdaddr);
+
+ if (bacmp(src, BDADDR_ANY) == 0 || bacmp(src, &bdaddr) == 0)
+ update_adapter_svclass_list(&bdaddr);
+ }
+
}
void create_ext_inquiry_response(const char *name,
@@ -613,7 +619,7 @@ success:
}
update_db_timestamp();
- update_svclass_list(BDADDR_ANY);
+ update_svclass_list(&req->device);
/* Build a rsp buffer */
bt_put_unaligned(htonl(rec->handle), (uint32_t *) rsp->data);
diff --git a/src/sdpd.h b/src/sdpd.h
index 1f0a229..d496a4a 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -93,7 +93,6 @@ void stop_sdp_server(void);
int add_record_to_server(const bdaddr_t *src, sdp_record_t *rec);
int remove_record_from_server(uint32_t handle);
-uint8_t get_service_classes(const bdaddr_t *bdaddr);
void create_ext_inquiry_response(const char *name,
int8_t tx_power, sdp_list_t *services,
uint8_t *data);
--
1.6.3.3
^ permalink raw reply related
* Re: Kernel panic when handing Motorola S305 headset
From: Nick Pelly @ 2010-04-08 0:15 UTC (permalink / raw)
To: Liang Bao; +Cc: linux-bluetooth, Marcel Holtmann
In-Reply-To: <6aeb672b1003010154u6660632fj53fdbac2c8d0e302@mail.gmail.com>
On Mon, Mar 1, 2010 at 1:54 AM, Liang Bao <tim.bao@gmail.com> wrote:
> I'd like to continue the previous thread on that Motorola S305 causes
> kernel panic because I did find some clue here. Sorry for misleading
> guess one month ago if any.
>
> Recap the problem here so that you don't to read the first long post.
> The pattern to reproduce the issue is:
> 1. Pair the S305 headset from the phone or the PC( I am using a Ubuntu)
> 2. Remove pairing on the phone or PC
> 3. Power off and then power on S305.
> 4. The S305 will try to connect and since link key removed on this
> side it will try to pair. Input 0000.
> 5. Kernel panic happens. This can be observed on kernel version
> 2.6.29(on the Droid phone, yes, it's a modified version),
> 2.6.31-19-generic on a Ubuntu and a pretty latest 2.6.33-020633rc8
> from Ubuntu official RC release.
>
> The exact kernel crash point is
> =A0 =A0 =A0 =A0 =A0 =A0 if (l2cap_check_security(sk)) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (bt_sk(sk)->defer_setup) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct sock *parent =3D bt_sk(=
sk)->parent;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rsp.result =3D cpu_to_le16(L2C=
AP_CR_PEND);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rsp.status =3D cpu_to_le16(L2C=
AP_CS_AUTHOR_PEND);
>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 parent->sk_data_ready(parent, 0)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else {
>
> After tracing the issue for a couple of weeks, I find the difference
> between a normal flow and the panic one. If the user space process
> accepts the L2CAP connection request before L2CAP_INFO_RSP received,
> the following calls will be carried out:
>
> l2cap_sock_accept-> bt_accept_dequeue->bt_accept_unlink(in the branch
> bt_sk(parent)->defer_setup)-> set bt_sk(sk)->parent =3D NULL. Later when
> L2CAP_INFO_RSP arrives, the l2cap_conn_start() will try to call the
> marked line above and de-referring NULL happen.
>
> To fix this, shall we consider checking if a pending socket can be
> accepted in bt_accept_dequeue() prior to a pending L2CAP_INFO_REQ
> responded? For example, =A0adding a check to BT_CONNECT2 in
> af_bluetooth.c.
>
> 215 =A0 =A0 =A0 =A0 if (sk->sk_state =3D=3D BT_CONNECTED || !newsock ||
> 216 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ( bt_sk(parent)->defe=
r_setup &&
> (sk->sk_state !=3D BT_CONNECT2))) {
>
> Again, I am not sure if this will bring a side-effect. Please advise
> the most appropriate way. Thanks.
>
> p.s: I attached partial trace files for those who're interested to the tr=
aces.
>
We can reproduce this issue.
There is nothing preventing an l2cap socket with deferred setup from
accepting an l2cap connection before the info response packet has come
in. This causes the null pointer panic when the info response
eventually arrives.
I'm not sure the best way to fix this. Ideally we'd check
L2CAP_INFO_FEAT_MASK_REQ_DONE, but that is not available in
af_bluetooth.c:bt_accept_dequeue(). I think the problem is that
BT_CONNECT2 - which is available in af_bluetooth.c is used for both
deferred setup and for the case where we are waiting for the info
response.
Marcel, some advice on the best way to proceed here would be helpful.
Nick
^ permalink raw reply
* Re: [PATCH 1/2] Report local services(UUIDs) through DBus
From: Marcel Holtmann @ 2010-04-08 3:57 UTC (permalink / raw)
To: Gustavo F. Padovan; +Cc: Francisco Alecrim, linux-bluetooth
In-Reply-To: <20100407012054.GC23956@vigoh>
Hi Gustavo,
> > +/*
> > + * adapter_services_inc_rem - Insert or remove UUID from adapter
> > + */
> > +static void adapter_service_ins_rem(const bdaddr_t *bdaddr, void *rec,
> > + gboolean insert)
> > +{
> > + struct btd_adapter *adapter;
> > + GSList *adapters;
> > +
> > + adapters = NULL;
> > +
> > + if (bacmp(bdaddr, BDADDR_ANY) != 0) {
> > + /* Only one adapter */
> > + adapter = manager_find_adapter(bdaddr);
> > + if (!adapter)
> > + return;
> > +
> > + adapters = g_slist_append(adapters, adapter);
> > + } else {
> > + /* Emit D-Bus msg to all adapters */
> > + adapters = manager_get_adapters();
> > + }
>
> No need for braces here. :)
because of the comment is is actually preferred to have braces in this
case. This is not for the sake of the compiler. It is purely for humans
to not disturb them with reading the code.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 2/2] Correct UUIDs list to EIR
From: Marcel Holtmann @ 2010-04-08 3:59 UTC (permalink / raw)
To: Francisco Alecrim; +Cc: linux-bluetooth
In-Reply-To: <1270591520-2078-2-git-send-email-francisco.alecrim@openbossa.org>
Hi Francisco,
> Correct create_ext_inquiry_response to response only UUIDs per-adapter.
> ---
> src/adapter.c | 3 ++-
> src/sdpd-service.c | 5 +++--
> src/sdpd.h | 3 ++-
> 3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 47cef90..9e94d86 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -816,7 +816,8 @@ static void update_ext_inquiry_response(struct btd_adapter *adapter)
>
> if (dev->ssp_mode > 0)
> create_ext_inquiry_response((char *) dev->name,
> - adapter->tx_power, data);
> + adapter->tx_power, adapter->services,
> + data);
>
> if (hci_write_ext_inquiry_response(dd, fec, data,
> HCI_REQ_TIMEOUT) < 0)
> diff --git a/src/sdpd-service.c b/src/sdpd-service.c
> index a8f7d47..4551577 100644
> --- a/src/sdpd-service.c
> +++ b/src/sdpd-service.c
> @@ -167,9 +167,10 @@ uint8_t get_service_classes(const bdaddr_t *bdaddr)
> }
>
> void create_ext_inquiry_response(const char *name,
> - int8_t tx_power, uint8_t *data)
> + int8_t tx_power, sdp_list_t *services,
> + uint8_t *data)
> {
> - sdp_list_t *list = sdp_get_record_list();
> + sdp_list_t *list = services;
> uint8_t *ptr = data;
> uint16_t uuid[24];
> int i, index = 0;
> diff --git a/src/sdpd.h b/src/sdpd.h
> index 1352a83..1f0a229 100644
> --- a/src/sdpd.h
> +++ b/src/sdpd.h
> @@ -95,4 +95,5 @@ int remove_record_from_server(uint32_t handle);
>
> uint8_t get_service_classes(const bdaddr_t *bdaddr);
> void create_ext_inquiry_response(const char *name,
> - int8_t tx_power, uint8_t *data);
> + int8_t tx_power, sdp_list_t *services,
> + uint8_t *data);
and this reminds me, that the list of UUIDs for local adapter and
inquiry response should be actually sorted. Currently we are a bit lazy
in that area. So please go ahead and fix that as well.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] btusb: Raw mode and ACL/SCO data
From: Marcel Holtmann @ 2010-04-08 4:08 UTC (permalink / raw)
To: Kim B. Heino; +Cc: linux-bluetooth, linux-kernel
In-Reply-To: <20100407155358.083823f9@bluegiga.com>
Hi Kim,
> This patch allows sending ACL/SCO packets if device is in RAW mode.
> Previously only command packets were allowed.
so do I really wanna know why such a change is required?
> diff -ur orig/drivers/bluetooth/btusb.c linux-2.6.33.2/drivers/bluetooth/btusb.c
> --- orig/drivers/bluetooth/btusb.c 2010-04-02 02:02:33.000000000 +0300
> +++ linux-2.6.33.2/drivers/bluetooth/btusb.c 2010-04-07 15:17:55.696672710 +0300
> @@ -663,7 +663,9 @@
> break;
>
> case HCI_ACLDATA_PKT:
> - if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)
> + if (!data->bulk_tx_ep ||
> + (!test_bit(HCI_RAW, &hdev->flags) &&
> + hdev->conn_hash.acl_num < 1))
> return -ENODEV;
Actually this one is wrong. The conn_hash.acl_num check just has to go
away. We always start the bulk URBs anyway since otherwise a lot of
devices break. We had to figure this out the hard way. Some device
manufactures have endpoints that rely on each other and do their flow
control based on submitted URBs.
So no need to do another HCI_RAW test here.
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> @@ -680,7 +682,9 @@
> break;
>
> case HCI_SCODATA_PKT:
> - if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)
> + if (!data->isoc_tx_ep ||
> + (!test_bit(HCI_RAW, &hdev->flags) &&
> + hdev->conn_hash.sco_num < 1))
> return -ENODEV;
>
> urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
And my assumption is that you only tested ACL data since this clearly
doesn't do anything useful. The isoc URBs and incoming data are not
magically started only because you pass this checkpoint.
No SCO links and no isoc URBs in the system. Period. If you wanna
disable the kernel Bluetooth stack, then you don't get SCO support over
USB.
Regards
Marcel
^ permalink raw reply
* Help regarding Bluez features
From: Asutosh Das @ 2010-04-08 5:45 UTC (permalink / raw)
To: linux-bluetooth
Hi
I have tried figuring out most of it on my own, but the below
mentioned I couldn't.
I have the following queries regarding Bluez 3.36.
Does Bluez 3.36 support:
A2DP SRC Features -
- Initiate Connection Release (y/n) -
- Accept Connection Release (y/n) -
- SBC Encoder (y/n) (I guess its present not sure though) -
- Protocol Descriptor List (y/n) -
- Bluetooth Profile Descriptor List (y/n) -
- Support of DM3 packet type (y/n) -
- Support of DH3 packet type (y/n) -
- Support of DM5 packet type (y/n) -
- Support of DH5 packet type (y/n) -
- Supports inquiry (y/n) -
- Supports inquiry scan (y/n) -
- Supports initiation of general inquiry (y/n) -
- Supports general/limited discoverable mode (general/limited) -
--
Thank you,
Warm Regards,
Asutosh Das
^ permalink raw reply
* Re: Help regarding Bluez features
From: Marcel Holtmann @ 2010-04-08 12:47 UTC (permalink / raw)
To: Asutosh Das; +Cc: linux-bluetooth
In-Reply-To: <y2gca39c8ec1004072245p3187486lcf296b97e282562c@mail.gmail.com>
Hi Asutosh,
> I have tried figuring out most of it on my own, but the below
> mentioned I couldn't.
>
> I have the following queries regarding Bluez 3.36.
>
> Does Bluez 3.36 support:
>
> A2DP SRC Features -
> - Initiate Connection Release (y/n) -
> - Accept Connection Release (y/n) -
> - SBC Encoder (y/n) (I guess its present not sure though) -
> - Protocol Descriptor List (y/n) -
> - Bluetooth Profile Descriptor List (y/n) -
> - Support of DM3 packet type (y/n) -
> - Support of DH3 packet type (y/n) -
> - Support of DM5 packet type (y/n) -
> - Support of DH5 packet type (y/n) -
> - Supports inquiry (y/n) -
> - Supports inquiry scan (y/n) -
> - Supports initiation of general inquiry (y/n) -
> - Supports general/limited discoverable mode (general/limited) -
sounds like you are doing qualification testing based on 3.36. You know
that this version is not really supported anymore. We have jumped to the
4.x major release. And also latest release is 4.63 already. I would
really propose you update to BlueZ 4.60 or later.
Regards
Marcel
^ permalink raw reply
* [PATCH] List with UUIDs per-adapter should be sorted
From: Francisco Alecrim @ 2010-04-08 21:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Francisco Alecrim
---
src/adapter.c | 5 +++--
src/sdpd-database.c | 2 +-
src/sdpd.h | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 8fc47b9..c174793 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1081,8 +1081,9 @@ static void adapter_service_ins_rem(const bdaddr_t *bdaddr, void *rec,
adapter = adapters->data;
if (insert == TRUE)
- adapter->services = sdp_list_append(adapter->services,
- rec);
+ adapter->services = sdp_list_insert_sorted(
+ adapter->services, rec,
+ record_sort);
else
adapter->services = sdp_list_remove(adapter->services,
rec);
diff --git a/src/sdpd-database.c b/src/sdpd-database.c
index 224a4e7..263b16e 100644
--- a/src/sdpd-database.c
+++ b/src/sdpd-database.c
@@ -55,7 +55,7 @@ typedef struct {
* The service repository is a linked list in sorted order
* and the service record handle is the sort key
*/
-static int record_sort(const void *r1, const void *r2)
+int record_sort(const void *r1, const void *r2)
{
const sdp_record_t *rec1 = (const sdp_record_t *) r1;
const sdp_record_t *rec2 = (const sdp_record_t *) r2;
diff --git a/src/sdpd.h b/src/sdpd.h
index 1f0a229..ce189ca 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -70,6 +70,7 @@ sdp_buf_t *sdp_get_cached_rsp(sdp_cont_state_t *cstate);
void sdp_cstate_cache_init(void);
void sdp_cstate_clean_buf(void);
+int record_sort(const void *r1, const void *r2);
void sdp_svcdb_reset(void);
void sdp_svcdb_collect_all(int sock);
void sdp_svcdb_set_collectable(sdp_record_t *rec, int sock);
--
1.6.3.3
^ permalink raw reply related
* Is hsp code in BlueZ and pulseaudio broken?
From: Zhu Yanhai @ 2010-04-09 8:35 UTC (permalink / raw)
To: linux-bluetooth, pulseaudio-discuss
Cc: vivian.zhang, guannan.ou, Zheng Huan, Zhu Yanhai, Zhu, Yanhai
Hi list,
I can't make hsp profile work with the latest bluez and pulseaudio,
does anyone here know
whether the hsp code in bluez and pulseaudio still can work?
I used a DELL BH200 headset, which has both A2DP, Headset and
Headsfree profile support.
The code of BlueZ and Pulseaudio are both directly cloned from their git repos.
BlueZ configure:
$ ./configure --enable-maintainer-mode --enable-debug --prefix=/usr
--mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var
--libexecdir=/lib --enable-netlink --disable-capng --enable-tracer
--enable-tools --enable-bccmd --enable-dfutool --enable-hid2hci
--enable-hidd --enable-pand --enable-dund --enable-test --enable-cups
--disable-pcmcia --disable-udevrules --with-telephony=ofono
--disable-configfiles
To make the testing steps clear, I unloaded module-bluetooth-discover
before connecting the
headset.
After starting bluez with the option -n and -d, I called to
org.bluez.Headset/Connect() using d-feet.
BlueZ printed:
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB:
HEADSET_STATE_DISCONNECTED -> HEADSET_STATE_CONNECTING
bluetoothd[10791]: link_key_request (sba=00:26:5E:A5:A8:65,
dba=00:16:44:FD:84:CB)
bluetoothd[10791]: kernel auth requirements = 0x00
bluetoothd[10791]: stored link key type = 0x00
bluetoothd[10791]: adapter_get_device(00:16:44:FD:84:CB)
bluetoothd[10791]: Discovered Headset service on channel 8
bluetoothd[10791]: /org/bluez/10791/hci0/dev_00_16_44_FD_84_CB:
Connecting to 00:16:44:FD:84:CB channel 8
bluetoothd[10791]: link_key_request (sba=00:26:5E:A5:A8:65,
dba=00:16:44:FD:84:CB)
bluetoothd[10791]: kernel auth requirements = 0x04
bluetoothd[10791]: stored link key type = 0x00
bluetoothd[10791]: hcid_dbus_bonding_process_complete: status=00
bluetoothd[10791]: adapter_get_device(00:16:44:FD:84:CB)
bluetoothd[10791]: hcid_dbus_bonding_process_complete: no pending auth request
bluetoothd[10791]: /org/bluez/10791/hci0/dev_00_16_44_FD_84_CB:
Connected to 00:16:44:FD:84:CB
bluetoothd[10791]: telephony-ofono: device 0xb793c4d8 connected
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB: HEADSET_STATE_CONNECTING
-> HEADSET_STATE_CONNECTED
And then 'load-module module-bluetooth-discover' using pacmd. As soon
as the module was loaded, BlueZ printed:
bluetoothd[10791]: Accepted new client connection on unix socket (fd=22)
bluetoothd[10791]: Audio API: BT_REQUEST <- BT_GET_CAPABILITIES
bluetoothd[10791]: Audio API: BT_RESPONSE -> BT_GET_CAPABILITIES
bluetoothd[10791]: Audio API: BT_REQUEST <- BT_GET_CAPABILITIES
bluetoothd[10791]: Audio API: BT_RESPONSE -> BT_GET_CAPABILITIES
bluetoothd[10791]: Audio API: BT_REQUEST <- BT_OPEN
bluetoothd[10791]: open sco -
object=/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB source=ANY
destination=ANY lock=readwrite
bluetoothd[10791]: Audio API: BT_RESPONSE -> BT_OPEN
bluetoothd[10791]: Audio API: BT_REQUEST <- BT_SET_CONFIGURATION
bluetoothd[10791]: Audio API: BT_RESPONSE -> BT_SET_CONFIGURATION
bluetoothd[10791]: Audio API: BT_REQUEST <- BT_START_STREAM
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB: HEADSET_STATE_CONNECTED
-> HEADSET_STATE_PLAY_IN_PROGRESS
bluetoothd[10791]: SCO socket opened for headset
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB
bluetoothd[10791]: SCO fd=24
bluetoothd[10791]: Audio API: BT_RESPONSE -> BT_START_STREAM
bluetoothd[10791]: Audio API: BT_INDICATION -> BT_NEW_STREAM
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB:
HEADSET_STATE_PLAY_IN_PROGRESS -> HEADSET_STATE_PLAYING
Then, after waiting about 3-4 seconds, BlueZ printed:
bluetoothd[10791]: No matching connection found for handle 6
bluetoothd[10791]: Audio connection got disconnected
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB: HEADSET_STATE_PLAYING ->
HEADSET_STATE_CONNECTED
bluetoothd[10791]: ERR or HUP on RFCOMM socket
bluetoothd[10791]: telephony-ofono: device 0xb793c4d8 disconnected
bluetoothd[10791]: State changed
/org/bluez/10791/hci0/dev_00_16_44_FD_84_CB: HEADSET_STATE_CONNECTED
-> HEADSET_STATE_DISCONNECTED
bluetoothd[10791]: Unix client disconnected (fd=22)
bluetoothd[10791]: client_free(0xb79330d0)
'hcitool con' reported there was no connections after that, and the
headset was power off automatically. And of course I can't see this
headset by
'ilst-cards' or 'list-sinks' in pacmd.
Is it because there is anything broken in the latest BlueZ +
Pulseaudio, or am I doing something wrong?
Thanks,
Zhu Yanhai
^ permalink raw reply
* [PATCH] Added support for deleting all MDLS in MCAP
From: José Antonio Santos Cadenas @ 2010-04-09 11:44 UTC (permalink / raw)
To: Santiago Carot Nemesio; +Cc: linux-bluetooth
In-Reply-To: <1270562433.8428.40.camel@mosquito>
Also fixed some bugs in mcl state transitions
Signed-off-by: Jose Antonio Santos Cadenas <santoscadenas@gmail.com>
Reviewed-by: Santiago Carot Nemesio <sancane@gmail.com>
---
mcap/mcap.c | 133 +++++++++++++++++++++++++++++++++++++++----------------
mcap/mcap_lib.h | 2 +
2 files changed, 97 insertions(+), 38 deletions(-)
diff --git a/mcap/mcap.c b/mcap/mcap.c
index 28c586c..e76c565 100644
--- a/mcap/mcap.c
+++ b/mcap/mcap.c
@@ -33,7 +33,6 @@
#include "mcap.h"
#include "mcap_lib.h"
-//#define STATE2STR(_mcl) state2str(_mcl->state)
#define MCAP_ERROR mcap_error_quark()
#define SET_DEFAULT_MCL_CB(__mcl) do { \
__mcl->cb->mdl_connected = default_mdl_connected_cb; \
@@ -71,7 +70,8 @@ typedef enum {
typedef enum {
MDL_WAITING,
MDL_CONNECTED,
- MDL_CLOSED
+ MDL_DELETING,
+ MDL_CLOSED,
} MDLState;
struct mcap_mcl_cb {
@@ -79,7 +79,7 @@ struct mcap_mcl_cb {
mcap_mdl_event_cb mdl_closed; /* Remote device has closed an mdl */
mcap_mdl_event_cb mdl_deleted; /* Remote device deleted an mdl */
mcap_remote_mdl_conn_req_cb mdl_conn_req; /* Remote deive requested create an mdl */
- mcap_remote_mdl_reconn_req_cb mdl_reconn_req; /* Remote device requested reconnect previus mdl */
+ mcap_remote_mdl_reconn_req_cb mdl_reconn_req; /* Remote device requested reconnect previous mdl */
gpointer user_data; /* user data */
};
@@ -240,6 +240,9 @@ static void update_mcl_state(struct mcap_mcl *mcl)
GSList *l;
struct mcap_mdl *mdl;
+ if (mcl->state == MCL_PENDING)
+ return;
+
for (l = mcl->mdls; l; l = l->next) {
mdl = l->data;
@@ -280,6 +283,12 @@ static void mcap_send_std_opcode(struct mcap_mcl *mcl, const uint8_t *buf,
return;
}
+ if (mcl->state == MCL_PENDING) {
+ g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
+ "Not Std Op. Codes can be sent in PENDING State");
+ return;
+ }
+
if (mcap_send_data(g_io_channel_unix_get_fd(mcl->cc), buf, size) < 0)
g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
"Data can't be sent, write error");
@@ -394,17 +403,10 @@ static gint compare_mdl(gconstpointer a, gconstpointer b)
static gboolean wait_response_timer(gpointer data)
{
struct mcap_mcl *mcl = data;
- struct mcap_mdl_op_cb *con = mcl->priv_data;
- struct mcap_mdl *mdl = con->mdl;
GError *gerr = NULL;
RELEASE_TIMER(mcl);
- mcl->mdls = g_slist_remove(mcl->mdls, mdl);
- g_free(mdl);
-
- mcl->req = MCL_AVAILABLE;
- update_mcl_state(mcl);
g_set_error(&gerr, MCAP_ERROR, MCAP_ERROR_FAILED,
"Timeout waiting response");
@@ -494,6 +496,26 @@ void mcap_req_mdl_reconnect(struct mcap_mdl *mdl,
con->cb.op = reconnect_cb;
con->user_data = user_data;
+ mcl->state = MCL_ACTIVE;
+ mcl->lcmd = cmd;
+ mcl->req = MCL_WAITING_RSP;
+ mcl->priv_data = con;
+
+ mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer, mcl);
+}
+
+static void send_delete_req(GError **err, struct mcap_mcl *mcl,
+ struct mcap_mdl_op_cb *con, uint16_t mdlid)
+{
+ uint8_t *cmd;
+
+ cmd = create_req(MCAP_MD_DELETE_MDL_REQ, mdlid);
+ mcap_send_std_opcode(mcl, cmd, sizeof(mcap_md_req), err);
+ if (*err) {
+ g_free(cmd);
+ return;
+ }
+
mcl->lcmd = cmd;
mcl->req = MCL_WAITING_RSP;
mcl->priv_data = con;
@@ -501,13 +523,43 @@ void mcap_req_mdl_reconnect(struct mcap_mdl *mdl,
mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer, mcl);
}
+void mcap_req_mdl_delete_all(struct mcap_mcl *mcl, GError **err,
+ mcap_mdl_del_cb delete_cb, gpointer user_data)
+{
+ GSList *l;
+ struct mcap_mdl *mdl;
+ struct mcap_mdl_op_cb *con;
+
+ debug("MCL in state: %d", mcl->state);
+ if (!mcl->mdls) {
+ g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
+ "There are not MDLs created");
+ return;
+ }
+
+ for (l = mcl->mdls; l; l = l->next) {
+ mdl = l->data;
+ if (mdl->state != MDL_WAITING)
+ mdl->state = MDL_DELETING;
+ }
+
+ con = g_new0(struct mcap_mdl_op_cb, 1);
+ con->mdl = NULL;
+ con->cb.del = delete_cb;
+ con->user_data = user_data;
+
+ send_delete_req(err, mcl, con, MCAP_ALL_MDLIDS);
+ if (*err)
+ g_free(con);
+ debug("exiting MCL in state: %d", mcl->state);
+}
+
void mcap_req_mdl_deletion(struct mcap_mdl *mdl, GError **err,
mcap_mdl_del_cb delete_cb, gpointer user_data)
{
struct mcap_mcl *mcl= mdl->mcl;
struct mcap_mdl_op_cb *con;
GSList *l;
- uint8_t *cmd;
l = g_slist_find(mcl->mdls, mdl);
@@ -519,28 +571,19 @@ void mcap_req_mdl_deletion(struct mcap_mdl *mdl, GError **err,
if (mdl->state == MDL_WAITING) {
g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
- "Not valid petition in this mdl state");
+ "Mdl is not created");
return;
}
+ mdl->state = MDL_DELETING;
con = g_new0(struct mcap_mdl_op_cb, 1);
con->mdl = mdl;
con->cb.del = delete_cb;
con->user_data = user_data;
- cmd = create_req(MCAP_MD_DELETE_MDL_REQ, mdl->mdlid);
- mcap_send_std_opcode(mcl, cmd, sizeof(mcap_md_req), err);
- if (*err) {
+ send_delete_req(err, mcl, con, mdl->mdlid);
+ if (*err)
g_free(con);
- g_free(cmd);
- return;
- }
-
- mcl->lcmd = cmd;
- mcl->req = MCL_WAITING_RSP;
- mcl->priv_data = con;
-
- mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer, mcl);
}
void mcap_mdl_abort(struct mcap_mdl *mdl, GError **err,
@@ -688,7 +731,7 @@ static gboolean parse_set_opts(struct mcap_mcl_cb *mcl_cb, GError **err,
cb = va_arg(args, int);
}
- /* Set new callbacks set */
+ /* Set new callbacks */
if (c->mdl_connected)
mcl_cb->mdl_connected = c->mdl_connected;
if (c->mdl_closed)
@@ -825,7 +868,7 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd, int le
if ((cfga != 0) && (cfga != conf)) {
/* Remote device set default configuration but upper profile */
/* has changed it. Protocol Error: force closing the MCL by */
- /* using remote device using UNESPECIFIED_ERROR response*/
+ /* using remote device using UNESPECIFIED_ERROR response */
send4B_cmd(mcl, MCAP_MD_CREATE_MDL_RSP, MCAP_UNESPECIFIED_ERROR,
mdl_id);
return;
@@ -844,8 +887,8 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd, int le
shutdown_mdl(mdl);
mcl->cb->mdl_closed(mdl, mcl->cb->user_data);
}
- mdl->state = MDL_WAITING;
mdl->mdep_id = mdep_id;
+ mdl->state = MDL_WAITING;
mcl->mdls = g_slist_insert_sorted(mcl->mdls, mdl, compare_mdl);
mcl->state = MCL_PENDING;
@@ -934,7 +977,7 @@ static void process_md_abort_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd, int len
g_free(del);
send4B_cmd(mcl, MCAP_MD_ABORT_MDL_RSP, MCAP_SUCCESS, mdl_id);
}
-/* Functions used to process responses */
+
static gboolean check_err_rsp(uint16_t rmdl, uint16_t smdl, uint8_t rc,
int rlen, int len, GError **gerr)
{
@@ -1089,15 +1132,26 @@ static void mcap_delete_mdl(gpointer elem, gpointer user_data)
{
struct mcap_mdl *mdl = elem;
gboolean notify = *(gboolean *)user_data;
- if (mdl->state == MDL_CONNECTED) {
- debug("MDL %d already connected, closing it", mdl->mdlid);
- shutdown_mdl(mdl);
- }
+
+ shutdown_mdl(mdl);
if (notify)
mdl->mcl->cb->mdl_deleted(mdl, mdl->mcl->cb->user_data);
g_free(mdl);
}
+static void restore_mdl(gpointer elem, gpointer data)
+{
+ struct mcap_mdl *mdl = elem;
+
+ if (mdl->state == MDL_DELETING) {
+ if (mdl->dc)
+ mdl->state = MDL_CONNECTED;
+ else
+ mdl->state = MDL_CLOSED;
+ } else if (mdl->state == MDL_CLOSED)
+ mdl->mcl->cb->mdl_closed(mdl, mdl->mcl->cb->user_data);
+}
+
static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, uint8_t *cmd,
int len)
{
@@ -1124,6 +1178,10 @@ static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, uint8_t *cmd,
mcl->lcmd = NULL;
mcl->req = MCL_AVAILABLE;
if (gerr) {
+ if (mdl)
+ restore_mdl(mdl, NULL);
+ else
+ g_slist_foreach(mcl->mdls, restore_mdl, NULL);
deleted_cb(gerr, user_data);
g_error_free(gerr);
return close;
@@ -1158,8 +1216,8 @@ static void process_md_delete_mdl_req(struct mcap_mcl *mcl, mcap_md_req *req)
notify = FALSE;
g_slist_foreach(mcl->mdls, mcap_delete_mdl, ¬ify);
g_slist_free(mcl->mdls);
- mcl->state = MCL_CONNECTED;
mcl->mdls = NULL;
+ mcl->state = MCL_CONNECTED;
/* NULL mdl means ALL_MDLS */
mcl->cb->mdl_deleted(NULL, mcl->cb->user_data);
goto resp;
@@ -1178,11 +1236,10 @@ static void process_md_delete_mdl_req(struct mcap_mcl *mcl, mcap_md_req *req)
}
}
- if (!mdl) {
+ if (!mdl || (mdl->state == MDL_WAITING)) {
send4B_cmd(mcl, MCAP_MD_DELETE_MDL_RSP, MCAP_INVALID_MDL, mdlid);
return;
}
-
mcl->mdls = g_slist_remove(mcl->mdls, mdl);
update_mcl_state(mcl);
notify = TRUE;
@@ -1400,16 +1457,16 @@ static gboolean mdl_closing_cb(GIOChannel *chan, GIOCondition cond, gpointer dat
{
struct mcap_mdl *mdl = data;
- gboolean open;
+ gboolean notify;
debug("Close MDL %d", mdl->mdlid);
- open = (mdl->state == MDL_CONNECTED);
+ notify = (mdl->state == MDL_CONNECTED);
shutdown_mdl(mdl);
update_mcl_state(mdl->mcl);
- if (open)
+ if (notify)
/*Callback to upper layer */
mdl->mcl->cb->mdl_closed(mdl, mdl->mcl->cb->user_data);
diff --git a/mcap/mcap_lib.h b/mcap/mcap_lib.h
index 530f03a..867a53d 100644
--- a/mcap/mcap_lib.h
+++ b/mcap/mcap_lib.h
@@ -92,6 +92,8 @@ void mcap_req_mdl_creation(struct mcap_mcl *mcl,
void mcap_req_mdl_reconnect(struct mcap_mdl *mdl, GError **err,
mcap_mdl_operation_cb reconnect_cb,
gpointer user_data);
+void mcap_req_mdl_delete_all(struct mcap_mcl *mcl, GError **err,
+ mcap_mdl_del_cb delete_cb, gpointer user_data);
void mcap_req_mdl_deletion(struct mcap_mdl *mdl, GError **err,
mcap_mdl_del_cb delete_cb, gpointer user_data);
void mcap_mdl_connect(struct mcap_mdl *mdl,
--
1.6.3.3
^ permalink raw reply related
* Re: Is hsp code in BlueZ and pulseaudio broken?
From: Luiz Augusto von Dentz @ 2010-04-09 12:32 UTC (permalink / raw)
To: Zhu Yanhai
Cc: linux-bluetooth, pulseaudio-discuss, vivian.zhang, guannan.ou,
Zheng Huan, Zhu Yanhai, Zhu, Yanhai
In-Reply-To: <o2p977a2be21004090135u225590edn39c803c9d201b308@mail.gmail.com>
Hi,
On Fri, Apr 9, 2010 at 11:35 AM, Zhu Yanhai <zhu.yanhai@gmail.com> wrote:
> 'hcitool con' reported there was no connections after that, and the
> headset was power off automatically. And of course I can't see this
> headset by
> 'ilst-cards' or 'list-sinks' in pacmd.
>
> Is it because there is anything broken in the latest BlueZ +
> Pulseaudio, or am I doing something wrong?
It seems ok in bluetoothd size, maybe it is the suspend logic that
disconnect sco after a few seconds when idle, but it doesn't seems to
be the case here as also rfcomm connection is dropped somehow.
--
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply
* obexd-0.22 causes gnome-bluetooth sendto dialog to stop closing when operation ends
From: Pacho Ramos @ 2010-04-10 11:22 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
Hello
This is a regression over obexd-0.21. After updating to 0.22,
gnome-bluetooth sendto dialog no longer closes when operation finishes,
even if file is already properly sent.
This has been reported also in:
https://bugzilla.gnome.org/show_bug.cgi?id=613196
Thanks a lot for your help
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: bluez installs alsa related stuff under /etc/alsa instead of /usr/share/alsa
From: Pacho Ramos @ 2010-04-10 11:28 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1267781065.6970.6.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]
El vie, 05-03-2010 a las 10:24 +0100, Pacho Ramos escribió:
> El vie, 05-03-2010 a las 10:11 +0100, Pacho Ramos escribió:
> > El jue, 04-03-2010 a las 17:42 -0800, Marcel Holtmann escribió:
> > > Hi Pacho,
> > >
> > > > bluez installs stuff into /etc/alsa and it seems wrong since default
> > > > location for alsa stuff seems to be /usr/share/alsa instead. You can
> > > > also see that this is been workarounded in ubuntu, gentoo (and probably
> > > > debian also).
> > > >
> > > > Any reason why using /etc/alsa instead?
> > >
> > > I thought that is the default location. If that is wrong, then please
> > > quote the ALSA documentation and send a patch to fix it.
> > >
> > > Regards
> > >
> > > Marcel
> >
> > alsa-lib configure.in seems to indicate that /usr/share/alsa is the
> > default one:
> > dnl ALSA configuration directory
> > AC_ARG_WITH(configdir,
> > AS_HELP_STRING([--with-configdir=dir],
> > [path where ALSA config files are stored]),
> > confdir="$withval", confdir="")
> > if test -z "$confdir"; then
> > eval dir="$datadir"
> > case "$dir" in
> > /*) ;;
> > *) dir="$prefix/share"
> > esac
> > confdir="$dir/alsa"
> > fi
> >
>
> I forgot the patch, sorry
>
Was this committed finally? Thanks :-)
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: obexd-0.22 causes gnome-bluetooth sendto dialog to stop closing when operation ends
From: Vinicius Gomes @ 2010-04-10 14:17 UTC (permalink / raw)
To: pacho; +Cc: linux-bluetooth
In-Reply-To: <1270898546.5646.28.camel@localhost.localdomain>
Hi Pacho,
2010/4/10 Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>:
> Hello
>
> This is a regression over obexd-0.21. After updating to 0.22,
> gnome-bluetooth sendto dialog no longer closes when operation finishes,
> even if file is already properly sent.
>
We noticed this regression as well. Luiz already has a fix for this,
it was just not integrated yet.
In case you want to take a look and perhaps help test it, the fix is here[1].
Cheers,
--
Vinicius
[1] http://gitorious.org/~vudentz/obexd/vudentzs-clone (branch master)
^ permalink raw reply
* RE: bluez and a2dp sennheiser pcx310 headphones
From: John Frankish @ 2010-04-10 18:25 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
In-Reply-To: <2d5a2c101002080102o71229a41ob75676b48a502919@mail.gmail.com>
> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-owner@vger.kernel.org] On Behalf Of Luiz Augusto von Dentz
> Sent: Monday, 08 February, 2010 11:55
> To: John Frankish
> Cc: linux-bluetooth@vger.kernel.org
> Subject: Re: bluez and a2dp sennheiser pcx310 headphones
>
> Hi John,
>
> On Mon, Feb 8, 2010 at 8:19 AM, John Frankish <j-frankish@slb.com> wrote:
>> Hi,
>>
>> Using the .asoundrc below with bluez-4.53, I've been able to play music to a pair of sennheiser pcx310 headphones without problems, but although the remote volume control on the headphones works, the track skip/fastforward/repeat does not.
>>
>> According to the headphones manual, the remote controls rely on an avrcp profile - is this something supported by bluez or is it something that should be supported by the audio source (or both)?
>
> You probably need to load uinput module to make this to work, also you
> should probably try pulse audio which has a better integration with
> bluetooth headsets so you don't need to manually configure alsa it
> will do all this automatically for you.
>
OK, so I've updated the kernel to 2.6.33.2 and loaded the uinput module.
I believe things are connected as I see this in dmesg after pressing the "track skip" button:
input: 00:1B:66:00:31:88 as /devices/virtual/input/input11
mplayer -ao alsa:device=bluetooth /mnt/sda1/Music/f00/aayw.mp3
Starting playback...
[press track skip]
No bind found for key ''.
Could anybody point me to a resource that explains how to manually "bind" the headphone controls to xmms, mplayer, rhythmbox, etc since I don't particularly want to use pulse audio
Thanks
John
^ permalink raw reply
* Re: obexd-0.22 causes gnome-bluetooth sendto dialog to stop closing when operation ends
From: Pacho Ramos @ 2010-04-10 18:38 UTC (permalink / raw)
To: Vinicius Gomes; +Cc: linux-bluetooth
In-Reply-To: <l2r2a9506371004100717p500f6b4o48e8a6d2dfb8f0c5@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
El sáb, 10-04-2010 a las 11:17 -0300, Vinicius Gomes escribió:
> Hi Pacho,
>
> 2010/4/10 Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>:
> > Hello
> >
> > This is a regression over obexd-0.21. After updating to 0.22,
> > gnome-bluetooth sendto dialog no longer closes when operation finishes,
> > even if file is already properly sent.
> >
>
> We noticed this regression as well. Luiz already has a fix for this,
> it was just not integrated yet.
>
> In case you want to take a look and perhaps help test it, the fix is here[1].
>
>
> Cheers,
Thanks a lot, I will try to use it as soon as I am able to
Best regards
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Implement AVCTP passthrough commands
From: Paolo Medici @ 2010-04-11 8:33 UTC (permalink / raw)
To: linux-bluetooth
Hi,
Are there no contraindications to complete the implementation in audio/control.c of other commands (as well as VolumeUp/VolumeDown)?
In this case, to try to control my iPod Touch, I would like to add remaining ones.
Paolo
^ permalink raw reply
* Mouse authentication regression after 4.63
From: Brian Rogers @ 2010-04-11 9:49 UTC (permalink / raw)
To: linux-bluetooth
Upon trying out a newer version of BlueZ, I found a regression in
support for my mouse caused by the following commit:
commit aee26b30bbc24cde464ba1a557c2b258ddec6432
Author: Johan Hedberg <johan.hedberg@nokia.com>
Date: Tue Mar 30 13:36:46 2010 +0300
Make BtIO default security level MEDIUM
MEDIUM makes more sense than the kernel default LOW which maps to "no
bonding" with SSP (something that's useful only for very special cases
such as OPP).
After this commit, when I turn on or move my mouse, I get prompted for a
PIN to use for the connection. "0000" won't work, and blank isn't
accepted, so the mouse can't connect. Deleting and re-pairing my mouse
doesn't work either. I suspect my mouse just does not support
encryption. I've never seen AUTH or ENCRYPT on my mouse in the output of
"hcitool con" and I can't enable encryption on a working bluez using
"hcitool auth". It just prompts for a PIN, and disconnects the mouse
when I enter one. And there's no documentation on what PIN should be
used with this mouse.
With the above commit reverted, it works fine again. The mouse
information is below. Could this be a device-specific quirk? What
information is needed to resolve this?
$ hcitool info 00:12:A1:63:EF:3A
Requesting information ...
BD Address: 00:12:A1:63:EF:3A
Device Name: Interlink Bluetooth Mouse
LMP Version: 2.0 (0x3) LMP Subversion: 0x229
Manufacturer: Broadcom Corporation (15)
Features: 0xbc 0x02 0x04 0x38 0x08 0x00 0x00 0x00
<encryption> <slot offset> <timing accuracy> <role switch>
<sniff mode> <RSSI> <power control> <enhanced iscan>
<interlaced iscan> <interlaced pscan> <AFH cap. slave>
^ permalink raw reply
* Re: Mouse authentication regression after 4.63
From: Johan Hedberg @ 2010-04-11 10:36 UTC (permalink / raw)
To: Brian Rogers; +Cc: linux-bluetooth
In-Reply-To: <4BC19B11.1090409@xyzw.org>
[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]
Hi Brian,
On Sun, Apr 11, 2010, Brian Rogers wrote:
> Upon trying out a newer version of BlueZ, I found a regression in
> support for my mouse caused by the following commit:
>
> commit aee26b30bbc24cde464ba1a557c2b258ddec6432
> Author: Johan Hedberg <johan.hedberg@nokia.com>
> Date: Tue Mar 30 13:36:46 2010 +0300
>
> Make BtIO default security level MEDIUM
>
> MEDIUM makes more sense than the kernel default LOW which maps to "no
> bonding" with SSP (something that's useful only for very special cases
> such as OPP).
>
>
> After this commit, when I turn on or move my mouse, I get prompted
> for a PIN to use for the connection. "0000" won't work, and blank
> isn't accepted, so the mouse can't connect. Deleting and re-pairing
> my mouse doesn't work either. I suspect my mouse just does not
> support encryption. I've never seen AUTH or ENCRYPT on my mouse in
> the output of "hcitool con" and I can't enable encryption on a
> working bluez using "hcitool auth". It just prompts for a PIN, and
> disconnects the mouse when I enter one. And there's no documentation
> on what PIN should be used with this mouse.
>
> With the above commit reverted, it works fine again. The mouse
> information is below. Could this be a device-specific quirk? What
> information is needed to resolve this?
I don't think this needs anything device specific. Authentication is
optional for mice so we can't really have the HID sockets requiring
higher security than LOW. The attached patch should fix the issue.
Johan
[-- Attachment #2: input-sec-level.patch --]
[-- Type: text/x-diff, Size: 1454 bytes --]
diff --git a/input/device.c b/input/device.c
index 922dc98..e047009 100644
--- a/input/device.c
+++ b/input/device.c
@@ -886,6 +886,7 @@ static void control_connect_cb(GIOChannel *chan, GError *conn_err,
BT_IO_OPT_SOURCE_BDADDR, &idev->src,
BT_IO_OPT_DEST_BDADDR, &idev->dst,
BT_IO_OPT_PSM, L2CAP_PSM_HIDP_INTR,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
if (!io) {
error("%s", err->message);
@@ -964,6 +965,7 @@ static DBusMessage *input_device_connect(DBusConnection *conn,
BT_IO_OPT_SOURCE_BDADDR, &idev->src,
BT_IO_OPT_DEST_BDADDR, &idev->dst,
BT_IO_OPT_PSM, L2CAP_PSM_HIDP_CTRL,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
iconn->ctrl_io = io;
}
diff --git a/input/server.c b/input/server.c
index 93ceea6..7eddf93 100644
--- a/input/server.c
+++ b/input/server.c
@@ -187,6 +187,7 @@ int server_start(const bdaddr_t *src)
server, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR, src,
BT_IO_OPT_PSM, L2CAP_PSM_HIDP_CTRL,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
if (!server->ctrl) {
error("Failed to listen on control channel");
@@ -199,6 +200,7 @@ int server_start(const bdaddr_t *src)
server, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR, src,
BT_IO_OPT_PSM, L2CAP_PSM_HIDP_INTR,
+ BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
if (!server->intr) {
error("Failed to listen on interrupt channel");
^ 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