Linux bluetooth development
 help / color / mirror / Atom feed
* RE: [PATCH] Remove doc/bluez-docs.xml.
From: Bastien Nocera @ 2010-11-18 15:56 UTC (permalink / raw)
  To: Waldemar.Rymarkiewicz; +Cc: johan.hedberg, linux-bluetooth
In-Reply-To: <99B09243E1A5DA4898CDD8B7001114480BD8F99A44@EXMB04.eu.tieto.com>

On Thu, 2010-11-18 at 17:53 +0200, Waldemar.Rymarkiewicz@tieto.com
wrote:
> Hi Johan,
> 
> >-----Original Message-----
> >From: Rymarkiewicz Waldemar 
> >Sent: Wednesday, November 03, 2010 4:55 PM
> >To: linux-bluetooth@vger.kernel.org
> >Cc: Johan Hedberg; Marcel Holtmann; Rymarkiewicz Waldemar
> >Subject: [PATCH] Remove doc/bluez-docs.xml.
> >
> >doc/bluez-docs.xml seems to be obsolate and not used anymore.
> >---
> > doc/bluez-docs.xml |   97 
> >----------------------------------------------------
> > 1 files changed, 0 insertions(+), 97 deletions(-)  delete 
> >mode 100644 doc/bluez-docs.xml
> >
> 
> Can you put some comment on that patch.

You didn't spell "obsolete" correctly.


^ permalink raw reply

* RE: [PATCH] Remove doc/bluez-docs.xml.
From: Waldemar.Rymarkiewicz @ 2010-11-18 16:03 UTC (permalink / raw)
  To: hadess, johan.hedberg; +Cc: linux-bluetooth
In-Reply-To: <1290095820.1435.12.camel@novo.hadess.net>

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

Hi,

>On Thu, 2010-11-18 at 17:53 +0200, Waldemar.Rymarkiewicz@tieto.com
>wrote:
>> Hi Johan,
>> 
>> >-----Original Message-----
>> >From: Rymarkiewicz Waldemar
>> >Sent: Wednesday, November 03, 2010 4:55 PM
>> >To: linux-bluetooth@vger.kernel.org
>> >Cc: Johan Hedberg; Marcel Holtmann; Rymarkiewicz Waldemar
>> >Subject: [PATCH] Remove doc/bluez-docs.xml.
>> >
>> >doc/bluez-docs.xml seems to be obsolate and not used anymore.
>> >---
>> > doc/bluez-docs.xml |   97 
>> >----------------------------------------------------
>> > 1 files changed, 0 insertions(+), 97 deletions(-)  delete mode 
>> >100644 doc/bluez-docs.xml
>> >
>> 
>> Can you put some comment on that patch.
>
>You didn't spell "obsolete" correctly.
>

Hrrr.. right. Has been fixed now :) See attached patch.

Thansk,
/Waldek






[-- Attachment #2: 0001-Remove-doc-bluez-docs.xml.patch --]
[-- Type: application/octet-stream, Size: 3383 bytes --]

From 63a9402b672beb3b4399d67bbcc0c86ef1392a1a Mon Sep 17 00:00:00 2001
From: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Date: Wed, 3 Nov 2010 16:51:50 +0100
Subject: [PATCH] Remove doc/bluez-docs.xml.

doc/bluez-docs.xml seems to be obsolete and not used anymore.
---
 doc/bluez-docs.xml |   97 ----------------------------------------------------
 1 files changed, 0 insertions(+), 97 deletions(-)
 delete mode 100644 doc/bluez-docs.xml

diff --git a/doc/bluez-docs.xml b/doc/bluez-docs.xml
deleted file mode 100644
index 74a8bd1..0000000
--- a/doc/bluez-docs.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
-<!ENTITY version SYSTEM "version.xml">
-]>
-<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
-  <bookinfo>
-    <title>BlueZ Reference Manual</title>
-    <releaseinfo>Version &version;</releaseinfo>
-    <authorgroup>
-      <author>
-	<firstname>Marcel</firstname>
-	<surname>Holtmann</surname>
-	<affiliation>
-	  <address>
-	    <email>marcel@holtmann.org</email>
-	  </address>
-	</affiliation>
-      </author>
-    </authorgroup>
-
-    <copyright>
-      <year>2002-2008</year>
-      <holder>Marcel Holtmann</holder>
-    </copyright>
-
-    <legalnotice>
-      <para>
-	Permission is granted to copy, distribute and/or modify this
-	document under the terms of the <citetitle>GNU Free
-	Documentation License</citetitle>, Version 1.1 or any later
-	version published by the Free Software Foundation with no
-	Invariant Sections, no Front-Cover Texts, and no Back-Cover
-	Texts. You may obtain a copy of the <citetitle>GNU Free
-	Documentation License</citetitle> from the Free Software
-	Foundation by visiting <ulink type="http"
-	url="http://www.fsf.org">their Web site</ulink> or by writing
-	to:
-
-	<address>
-	  The Free Software Foundation, Inc.,
-	  <street>59 Temple Place</street> - Suite 330,
-	  <city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>,
-	  <country>USA</country>
-	</address>
-      </para>
-    </legalnotice>
-  </bookinfo>
-
-  <reference id="manager">
-    <title>Manager interface</title>
-    <para>
-<programlisting><xi:include href="manager-api.txt" parse="text" /></programlisting>
-    </para>
-  </reference>
-
-  <reference id="adapter">
-    <title>Adapter interface</title>
-    <para>
-<programlisting><xi:include href="adapter-api.txt" parse="text" /></programlisting>
-    </para>
-  </reference>
-
-  <reference id="device">
-    <title>Device interface</title>
-    <para>
-<programlisting><xi:include href="device-api.txt" parse="text" /></programlisting>
-    </para>
-  </reference>
-
-  <reference id="agent">
-    <title>Agent interface</title>
-    <para>
-<programlisting><xi:include href="agent-api.txt" parse="text" /></programlisting>
-    </para>
-  </reference>
-
-  <reference id="reference">
-    <title>API Reference</title>
-    <partintro>
-      <para>
-	This part presents the function reference for BlueZ.
-      </para>
-    </partintro>
-  </reference>
-
-  <appendix id="license">
-    <title>License</title>
-    <para>
-<programlisting><xi:include href="../COPYING" parse="text" /></programlisting>
-    </para>
-  </appendix>
-
-  <index>
-    <title>Index</title>
-  </index>
-</book>
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH] Fix queries for contact with only one affiliation
From: Johan Hedberg @ 2010-11-18 16:48 UTC (permalink / raw)
  To: Bartosz Szatkowski; +Cc: linux-bluetooth
In-Reply-To: <1290092503-10324-1-git-send-email-bulislaw@linux.com>

Hi Bartosz,

On Thu, Nov 18, 2010, Bartosz Szatkowski wrote:
> Previously some fields may be omitted for contacts with only one affiliation,
> when querying for call history.
> ---
>  plugins/phonebook-tracker.c |   83 ++++++++++++++++++++++++++++---------------
>  1 files changed, 54 insertions(+), 29 deletions(-)

Pushed upstream, but I had to fix the commit message width first. Please
keep it at max 72 characters so that it's properly viewable with git log
on a 80 column wide terminal.

Johan

^ permalink raw reply

* Re: [PATCH] Add iwmmxt optimization for sbc for pxa series cpu
From: Johan Hedberg @ 2010-11-18 16:53 UTC (permalink / raw)
  To: Keith Mok; +Cc: Siarhei Siamashka, linux-bluetooth
In-Reply-To: <AANLkTi=rSK1zmW4kcPh7qopdZKN7mefX2RYWiBQZSacF@mail.gmail.com>

Hi Keith,

On Thu, Nov 18, 2010, Keith Mok wrote:
> Add iwmmxt optimization for sbc for pxa series cpu.
> 
> Benchmarked on ARM PXA platform:
> ===  Before (4 bands) ====
> $ time  ./sbcenc_orig  -s 4     long.au  > /dev/null
> real    0m 2.44s
> user    0m 2.39s
> sys     0m 0.05s
> ===  After (4 bands) ====
> $ time  ./sbcenc  -s 4     long.au  > /dev/null
> real    0m 1.59s
> user    0m 1.49s
> sys     0m 0.10s
> 
> ===  Before (8 bands) ====
> $ time  ./sbcenc_orig   -s 8     long.au  > /dev/null
> real    0m 4.05s
> user    0m 3.98s
> sys     0m 0.07s
> ===  After (8 bands) ====
> $ time  ./sbcenc  -s 8     long.au  > /dev/null
> real    0m 1.48s
> user    0m 1.41s
> sys     0m 0.06s
> 
> ===  Before (a2dp usage) ====
> $ time  ./sbcenc_orig   -b53 -s8 -j    long.au  > /dev/null
> real    0m 4.51s
> user    0m 4.41s
> sys     0m 0.10s
> ===  After (a2dp usage) ====
> $ time  ./sbcenc   -b53 -s8 -j    long.au  > /dev/null
> real    0m 2.05s
> user    0m 1.99s
> sys     0m 0.06s
> 
> ---
>  Makefile.am                 |    1 +
>  sbc/sbc_primitives.c        |    4 +
>  sbc/sbc_primitives_iwmmxt.c |  304 +++++++++++++++++++++++++++++++++++++++++++
>  sbc/sbc_primitives_iwmmxt.h |   42 ++++++
>  4 files changed, 351 insertions(+), 0 deletions(-)
>  create mode 100644 sbc/sbc_primitives_iwmmxt.c
>  create mode 100644 sbc/sbc_primitives_iwmmxt.h

Pushed upstream. Thanks.

Johan

^ permalink raw reply

* [PATCH v2 2/6] Add Find By Type Value Response encoding/decoding functions
From: Claudio Takahasi @ 2010-11-18 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <AANLkTikKFkhyjCQi4PzWbn4Y6kt3kqhNgvyUv4zNKxAQ@mail.gmail.com>

Find by type operation is used by Discover Primary Service by Service
UUID. Find By Type Value Response shall contain one or more group handles.
---
 attrib/att.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 attrib/att.h |    7 +++++++
 2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/attrib/att.c b/attrib/att.c
index 6c889f2..8655e5e 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -30,6 +30,8 @@
 #include <bluetooth/sdp.h>
 #include <bluetooth/sdp_lib.h>
 
+#include <glib.h>
+
 #include "att.h"
 
 const char *att_ecode2str(uint8_t status)
@@ -271,6 +273,50 @@ uint16_t dec_find_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
 	return len;
 }
 
+uint16_t enc_find_by_type_resp(GSList *matches, uint8_t *pdu, int len)
+{
+	GSList *l;
+	uint16_t offset;
+
+	if (pdu == NULL || len < 5)
+		return 0;
+
+	pdu[0] = ATT_OP_FIND_BY_TYPE_RESP;
+
+	for (l = matches, offset = 1; l && len >= (offset + 4);
+					l = l->next, offset += 4) {
+		struct att_range *range = l->data;
+
+		att_put_u16(range->start, &pdu[offset]);
+		att_put_u16(range->end, &pdu[offset + 2]);
+	}
+
+	return offset;
+}
+
+GSList *dec_find_by_type_resp(const uint8_t *pdu, int len)
+{
+	struct att_range *range;
+	GSList *matches;
+	int offset;
+
+	if (pdu == NULL || len < 5)
+		return NULL;
+
+	if (pdu[0] != ATT_OP_FIND_BY_TYPE_RESP)
+		return NULL;
+
+	for (offset = 1, matches = NULL; len >= (offset + 4); offset += 4) {
+		range = malloc(sizeof(struct att_range));
+		range->start = att_get_u16(&pdu[offset]);
+		range->end = att_get_u16(&pdu[offset + 2]);
+
+		matches = g_slist_append(matches, range);
+	}
+
+	return matches;
+}
+
 uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
 							uint8_t *pdu, int len)
 {
diff --git a/attrib/att.h b/attrib/att.h
index 9de338d..7c98b4a 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -122,6 +122,11 @@ struct att_data_list {
 	uint8_t **data;
 };
 
+struct att_range {
+	uint16_t start;
+	uint16_t end;
+};
+
 /* These functions do byte conversion */
 static inline uint8_t att_get_u8(const void *ptr)
 {
@@ -168,6 +173,8 @@ uint16_t enc_find_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
 			const uint8_t *value, int vlen, uint8_t *pdu, int len);
 uint16_t dec_find_by_type_req(const uint8_t *pdu, int len, uint16_t *start,
 		uint16_t *end, uuid_t *uuid, uint8_t *value, int *vlen);
+uint16_t enc_find_by_type_resp(GSList *ranges, uint8_t *pdu, int len);
+GSList *dec_find_by_type_resp(const uint8_t *pdu, int len);
 struct att_data_list *dec_read_by_grp_resp(const uint8_t *pdu, int len);
 uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, uuid_t *uuid,
 							uint8_t *pdu, int len);
-- 
1.7.3.2


^ permalink raw reply related

* [PATCH v2 3/6] Implement Find by Type Value Request in the atttribute server
From: Claudio Takahasi @ 2010-11-18 18:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <1290017386-23969-3-git-send-email-claudio.takahasi@openbossa.org>

GATT Discover Primary Service by Service UUID sub-procedure is based
on ATT Find By Type Value Request/Response.

Implement an extra verification for broken requests: "Ending Handle"
different than 0xFFFF. The Group End Handle may be greater than the
"Ending Handle" in the Find By Type Value Request. Forces the "Ending
Handle" in the response to 0xFFFF to avoid another request from the
clients. 0xFFFF means that the sub-procedure is complete.
---
 src/attrib-server.c |   80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 375b731..41c0ffc 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -383,6 +383,76 @@ static int find_info(uint16_t start, uint16_t end, uint8_t *pdu, int len)
 	return length;
 }
 
+static int find_by_type(uint16_t start, uint16_t end, uuid_t *uuid,
+			const uint8_t *value, int vlen, uint8_t *opdu, int mtu)
+{
+	struct attribute *a;
+	struct att_range *range;
+	GSList *l, *matches;
+	int len;
+
+	if (start > end || start == 0x0000)
+		return enc_error_resp(ATT_OP_FIND_BY_TYPE_REQ, start,
+					ATT_ECODE_INVALID_HANDLE, opdu, mtu);
+
+	/* Searching first requested handle number */
+	for (l = database, matches = NULL, range = NULL; l; l = l->next) {
+		a = l->data;
+
+		if (a->handle < start)
+			continue;
+
+		if (a->handle > end)
+			break;
+
+		/* Primary service? Attribute value matches? */
+		if ((sdp_uuid_cmp(&a->uuid, uuid) == 0) && (a->len == vlen) &&
+					(memcmp(a->data, value, vlen) == 0)) {
+
+			range = g_new0(struct att_range, 1);
+			range->start = a->handle;
+
+			matches = g_slist_append(matches, range);
+		} else if (range) {
+			/*
+			 * Update the last found handle or reset the pointer
+			 * to track that a new group started: Primary or
+			 * Secondary service.
+			 */
+			if (sdp_uuid_cmp(&a->uuid, &prim_uuid) == 0 ||
+					sdp_uuid_cmp(&a->uuid, &snd_uuid) == 0)
+				range = NULL;
+			else
+				range->end = a->handle;
+		}
+	}
+
+	if (range) {
+		if (l == NULL) {
+			/* Avoids another iteration */
+			range->end = 0xFFFF;
+		} else if (range->end == 0) {
+			/*
+			 * Broken requests: requested End Handle is not 0xFFFF.
+			 * Given handle is in the middle of a service definition.
+			 */
+			matches = g_slist_remove(matches, range);
+			g_free(range);
+		}
+	}
+
+	if (matches == NULL)
+		return enc_error_resp(ATT_OP_FIND_BY_TYPE_REQ, start,
+				ATT_ECODE_ATTR_NOT_FOUND, opdu, mtu);
+
+	len = enc_find_by_type_resp(matches, opdu, mtu);
+
+	g_slist_foreach(matches, (GFunc) g_free, NULL);
+	g_slist_free(matches);
+
+	return len;
+}
+
 static int handle_cmp(gconstpointer a, gconstpointer b)
 {
 	const struct attribute *attrib = a;
@@ -522,6 +592,16 @@ static void channel_handler(const uint8_t *ipdu, uint16_t len,
 			write_value(start, value, vlen);
 		return;
 	case ATT_OP_FIND_BY_TYPE_REQ:
+		length = dec_find_by_type_req(ipdu, len, &start, &end,
+							&uuid, value, &vlen);
+		if (length == 0) {
+			status = ATT_ECODE_INVALID_PDU;
+			goto done;
+		}
+
+		length = find_by_type(start, end, &uuid, value, vlen,
+							opdu, channel->mtu);
+		break;
 	case ATT_OP_READ_BLOB_REQ:
 	case ATT_OP_READ_MULTI_REQ:
 	case ATT_OP_PREP_WRITE_REQ:
-- 
1.7.3.2


^ permalink raw reply related

* [PATCH v2 6/6] Implement Discover Primary Service by Service UUID in the gatttool
From: Claudio Takahasi @ 2010-11-18 18:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi
In-Reply-To: <1290017386-23969-6-git-send-email-claudio.takahasi@openbossa.org>

Implement only the first interaction of the discovery procedure. If the
response doesn't fit in the MTU, "start" and "end" options can be used
to discover the handles ranges of the remaining primary service instances.
UUID16 and UUID128 are supported in the uuid option.

Usage example:
$gatttool -i hcix -b xx:xx:xx:xx:xx:xx --uuid=1801 --primary
---
 Makefile.am       |    3 +-
 attrib/gatttool.c |   65 ++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 03a9bf2..5f96975 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -178,7 +178,8 @@ if ATTRIBPLUGIN
 bin_PROGRAMS += attrib/gatttool
 
 attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
-			  attrib/gattrib.c btio/btio.c
+			  attrib/gattrib.c btio/btio.c \
+			  src/glib-helper.h src/glib-helper.c
 attrib_gatttool_LDADD = lib/libbluetooth.la @GLIB_LIBS@
 
 builtin_modules += attrib
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 1a74edd..e961431 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -41,6 +41,7 @@
 #include "att.h"
 #include "btio.h"
 #include "gattrib.h"
+#include "glib-helper.h"
 #include "gatt.h"
 
 /* Minimum MTU for L2CAP connections over BR/EDR */
@@ -50,6 +51,7 @@ static gchar *opt_src = NULL;
 static gchar *opt_dst = NULL;
 static gchar *opt_value = NULL;
 static gchar *opt_sec_level = "low";
+static uuid_t *opt_uuid = NULL;
 static int opt_start = 0x0001;
 static int opt_end = 0xffff;
 static int opt_handle = -1;
@@ -144,7 +146,7 @@ static GIOChannel *do_connect(gboolean le)
 	return chan;
 }
 
-static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void primary_all_cb(guint8 status, const guint8 *pdu, guint16 plen,
 							gpointer user_data)
 {
 	GAttrib *attrib = user_data;
@@ -200,9 +202,9 @@ static void primary_cb(guint8 status, const guint8 *pdu, guint16 plen,
 	 * Read by Group Type Request until Error Response is received and
 	 * the Error Code is set to Attribute Not Found.
 	 */
-	gatt_discover_primary(attrib, end + 1, opt_end, NULL, primary_cb,
-								attrib);
 
+	gatt_discover_primary(attrib, end + 1, opt_end, NULL, primary_all_cb,
+								attrib);
 	return;
 
 done:
@@ -210,6 +212,36 @@ done:
 		g_main_loop_quit(event_loop);
 }
 
+static void primary_by_uuid_cb(guint8 status, const guint8 *pdu, guint16 plen,
+							gpointer user_data)
+{
+	GSList *ranges, *l;
+
+	if (status != 0) {
+		g_printerr("Discover primary services by UUID failed: %s\n",
+							att_ecode2str(status));
+		goto done;
+	}
+
+	ranges = dec_find_by_type_resp(pdu, plen);
+	if (ranges == NULL) {
+		g_printerr("Protocol error!\n");
+		goto done;
+	}
+
+	for (l = ranges; l; l = l->next) {
+		struct att_range *range = l->data;
+		g_print("Starting handle: %04x Ending handle: %04x\n",
+						range->start, range->end);
+	}
+
+	g_slist_foreach(ranges, (GFunc) g_free, NULL);
+	g_slist_free(ranges);
+
+done:
+	g_main_loop_quit(event_loop);
+}
+
 static void events_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
 {
 	GAttrib *attrib = user_data;
@@ -260,8 +292,12 @@ static gboolean primary(gpointer user_data)
 {
 	GAttrib *attrib = user_data;
 
-	gatt_discover_primary(attrib, opt_start, opt_end, NULL, primary_cb,
-								attrib);
+	if (opt_uuid)
+		gatt_discover_primary(attrib, opt_start, opt_end, opt_uuid,
+						primary_by_uuid_cb, attrib);
+	else
+		gatt_discover_primary(attrib, opt_start, opt_end, NULL,
+						primary_all_cb, attrib);
 
 	return FALSE;
 }
@@ -486,11 +522,29 @@ static gboolean characteristics_desc(gpointer user_data)
 	return FALSE;
 }
 
+static gboolean parse_uuid(const char *key, const char *value,
+				gpointer user_data, GError **error)
+{
+	if (!value)
+		return FALSE;
+
+	opt_uuid = g_try_malloc(sizeof(uuid_t));
+	if (opt_uuid == NULL)
+		return FALSE;
+
+	if (bt_string2uuid(opt_uuid, value) < 0)
+		return FALSE;
+
+	return TRUE;
+}
+
 static GOptionEntry primary_char_options[] = {
 	{ "start", 's' , 0, G_OPTION_ARG_INT, &opt_start,
 		"Starting handle(optional)", "0x0001" },
 	{ "end", 'e' , 0, G_OPTION_ARG_INT, &opt_end,
 		"Ending handle(optional)", "0xffff" },
+	{ "uuid", 'u', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
+		parse_uuid, "UUID16 or UUID128(optional)", "0x1801"},
 	{ NULL },
 };
 
@@ -621,6 +675,7 @@ done:
 	g_option_context_free(context);
 	g_free(opt_src);
 	g_free(opt_dst);
+	g_free(opt_uuid);
 
 	if (got_error)
 		exit(EXIT_FAILURE);
-- 
1.7.3.2


^ permalink raw reply related

* Re: Apple Wireless Keyboard connection issue
From: Andre Kuehne @ 2010-11-18 18:56 UTC (permalink / raw)
  To: Gustavo F. Padovan, linux-bluetooth
In-Reply-To: <20101118084449.GA29790@jh-x301>

On 11/18/2010 09:44 AM, Johan Hedberg wrote:
> I was now able to get hold of a Bluetooth keyboard and fixed the issue.
> The problem was indeed in the commit that Gustavo originally pointed
> out. It's just that my original patch for it was incomplete and so
> didn't properly fix the issue. Anyway, a proper fix has now been pushed
> to git. Please test with that.

Thank you Johan and Gustavo, current git works fine for me.

Andre

^ permalink raw reply

* Re: [PATCH v2 2/6] Add Find By Type Value Response encoding/decoding functions
From: Johan Hedberg @ 2010-11-18 20:01 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1290102524-26493-1-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Thu, Nov 18, 2010, Claudio Takahasi wrote:
> Find by type operation is used by Discover Primary Service by Service
> UUID. Find By Type Value Response shall contain one or more group handles.
> ---
>  attrib/att.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  attrib/att.h |    7 +++++++
>  2 files changed, 53 insertions(+), 0 deletions(-)

Thanks for the update. This and the rest of your patches have been
pushed upstream.

Johan

^ permalink raw reply

* [PATCH 1/2] Bluetooth: Create a unified authentication request function
From: johan.hedberg @ 2010-11-18 20:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Johan Hedberg

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

This patch adds a single function that's responsible for requesting
authentication for outgoing connections. This is preparation for the
next patch which will add automated name requests and thereby move the
authentication requests to a different location.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
---
 net/bluetooth/hci_event.c |   54 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 8430276..9c6d9bc 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -677,6 +677,29 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
 	hci_dev_unlock(hdev);
 }
 
+static int hci_request_outgoing_auth(struct hci_dev *hdev,
+						struct hci_conn *conn)
+{
+	struct hci_cp_auth_requested cp;
+
+	if (conn->state != BT_CONFIG || !conn->out)
+		return 0;
+
+	if (conn->sec_level == BT_SECURITY_SDP)
+		return 0;
+
+	/* Only request authentication for SSP connections or non-SSP
+	 * devices with sec_level HIGH */
+	if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) &&
+					conn->sec_level != BT_SECURITY_HIGH)
+		return 0;
+
+	cp.handle = __cpu_to_le16(conn->handle);
+	hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
+
+	return 1;
+}
+
 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
 {
 	BT_DBG("%s status 0x%x", hdev->name, status);
@@ -1156,6 +1179,7 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
 {
 	struct hci_ev_remote_features *ev = (void *) skb->data;
 	struct hci_conn *conn;
+	int auth_requested;
 
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
@@ -1177,12 +1201,15 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
 		cp.page = 0x01;
 		hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES,
 							sizeof(cp), &cp);
-	} else if (!ev->status && conn->out &&
-			conn->sec_level == BT_SECURITY_HIGH) {
-		struct hci_cp_auth_requested cp;
-		cp.handle = ev->handle;
-		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
-	} else {
+		goto unlock;
+	}
+
+	if (!ev->status)
+		auth_requested = hci_request_outgoing_auth(hdev, conn);
+	else
+		auth_requested = 0;
+
+	if (!auth_requested) {
 		conn->state = BT_CONNECTED;
 		hci_proto_connect_cfm(conn, ev->status);
 		hci_conn_put(conn);
@@ -1640,6 +1667,7 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 {
 	struct hci_ev_remote_ext_features *ev = (void *) skb->data;
 	struct hci_conn *conn;
+	int auth_requested;
 
 	BT_DBG("%s", hdev->name);
 
@@ -1661,14 +1689,12 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 	if (conn->state != BT_CONFIG)
 		goto unlock;
 
-	if (!ev->status && hdev->ssp_mode > 0 &&
-			conn->ssp_mode > 0 && conn->out &&
-			conn->sec_level != BT_SECURITY_SDP) {
-		struct hci_cp_auth_requested cp;
-		cp.handle = ev->handle;
-		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
-				sizeof(cp), &cp);
-	} else {
+	if (!ev->status)
+		auth_requested = hci_request_outgoing_auth(hdev, conn);
+	else
+		auth_requested = 0;
+
+	if (!auth_requested) {
 		conn->state = BT_CONNECTED;
 		hci_proto_connect_cfm(conn, ev->status);
 		hci_conn_put(conn);
-- 
1.7.2.3


^ permalink raw reply related

* [PATCH 2/2] Bluetooth: Automate remote name requests
From: johan.hedberg @ 2010-11-18 20:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Johan Hedberg
In-Reply-To: <1290111749-8968-1-git-send-email-johan.hedberg@gmail.com>

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

In Bluetooth there are no automatic updates of remote device names when
they get changed on the remote side. Instead, it is a good idea to do a
manual name request when a new connection gets created (for whatever
reason) since at this point it is very cheap (no costly baseband
connection creation needed just for the sake of the name request).

So far userspace has been responsible for this extra name request but
tighter control is needed in order not to flood Bluetooth controllers
with two many commands during connection creation. It has been shown
that some controllers simply fail to function correctly if they get too
many (almost) simultaneous commands during connection creation. The
simplest way to acheive better control of these commands is to move
their sending completely to the kernel side.

This patch inserts name requests into the sequence of events that the
kernel performs during connection creation. It does this after the
remote features have been successfully requested and before any pending
authentication requests are performed. The code will work sub-optimally
with userspace versions that still do the name requesting themselves (it
shouldn't break anything though) so it is recommended to combine this
with a userspace software version that doesn't have automated name
requests.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
---
 net/bluetooth/hci_event.c |   72 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9c6d9bc..4165895 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -677,11 +677,9 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
 	hci_dev_unlock(hdev);
 }
 
-static int hci_request_outgoing_auth(struct hci_dev *hdev,
+static int hci_outgoing_auth_needed(struct hci_dev *hdev,
 						struct hci_conn *conn)
 {
-	struct hci_cp_auth_requested cp;
-
 	if (conn->state != BT_CONFIG || !conn->out)
 		return 0;
 
@@ -694,15 +692,35 @@ static int hci_request_outgoing_auth(struct hci_dev *hdev,
 					conn->sec_level != BT_SECURITY_HIGH)
 		return 0;
 
-	cp.handle = __cpu_to_le16(conn->handle);
-	hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
-
 	return 1;
 }
 
 static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
 {
+	struct hci_cp_remote_name_req *cp;
+	struct hci_conn *conn;
+
 	BT_DBG("%s status 0x%x", hdev->name, status);
+
+	/* If successful wait for the name req complete event before
+	 * checking for the need to do authentication */
+	if (!status)
+		return;
+
+	cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ);
+	if (!cp)
+		return;
+
+	hci_dev_lock(hdev);
+
+	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
+	if (conn && hci_outgoing_auth_needed(hdev, conn)) {
+		struct hci_cp_auth_requested cp;
+		cp.handle = __cpu_to_le16(conn->handle);
+		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
+	}
+
+	hci_dev_unlock(hdev);
 }
 
 static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status)
@@ -1113,9 +1131,23 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
 
 static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
+	struct hci_ev_remote_name *ev = (void *) skb->data;
+	struct hci_conn *conn;
+
 	BT_DBG("%s", hdev->name);
 
 	hci_conn_check_pending(hdev);
+
+	hci_dev_lock(hdev);
+
+	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
+	if (conn && hci_outgoing_auth_needed(hdev, conn)) {
+		struct hci_cp_auth_requested cp;
+		cp.handle = __cpu_to_le16(conn->handle);
+		hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
+	}
+
+	hci_dev_unlock(hdev);
 }
 
 static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
@@ -1179,7 +1211,6 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
 {
 	struct hci_ev_remote_features *ev = (void *) skb->data;
 	struct hci_conn *conn;
-	int auth_requested;
 
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
@@ -1204,12 +1235,15 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
 		goto unlock;
 	}
 
-	if (!ev->status)
-		auth_requested = hci_request_outgoing_auth(hdev, conn);
-	else
-		auth_requested = 0;
+	if (!ev->status) {
+		struct hci_cp_remote_name_req cp;
+		memset(&cp, 0, sizeof(cp));
+		bacpy(&cp.bdaddr, &conn->dst);
+		cp.pscan_rep_mode = 0x02;
+		hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
+	}
 
-	if (!auth_requested) {
+	if (!hci_outgoing_auth_needed(hdev, conn)) {
 		conn->state = BT_CONNECTED;
 		hci_proto_connect_cfm(conn, ev->status);
 		hci_conn_put(conn);
@@ -1667,7 +1701,6 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 {
 	struct hci_ev_remote_ext_features *ev = (void *) skb->data;
 	struct hci_conn *conn;
-	int auth_requested;
 
 	BT_DBG("%s", hdev->name);
 
@@ -1689,12 +1722,15 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 	if (conn->state != BT_CONFIG)
 		goto unlock;
 
-	if (!ev->status)
-		auth_requested = hci_request_outgoing_auth(hdev, conn);
-	else
-		auth_requested = 0;
+	if (!ev->status) {
+		struct hci_cp_remote_name_req cp;
+		memset(&cp, 0, sizeof(cp));
+		bacpy(&cp.bdaddr, &conn->dst);
+		cp.pscan_rep_mode = 0x02;
+		hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
+	}
 
-	if (!auth_requested) {
+	if (!hci_outgoing_auth_needed(hdev, conn)) {
 		conn->state = BT_CONNECTED;
 		hci_proto_connect_cfm(conn, ev->status);
 		hci_conn_put(conn);
-- 
1.7.2.3


^ permalink raw reply related

* [PATCH] Implement Characteristic Value Read using UUID in the gatttool
From: Sheldon Demario @ 2010-11-18 20:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

Sub-procedure used to read a Characteristic Value when the client
only knows the characteristic UUID and doesn't know the handle.
More than one handle and attribute value pair can be returned,
it is up to the user define the handles range based on the service
handles range.

Usage example:
$gatttool --char-read --uuid=2a00 -i hcix -b xx:xx:xx:xx:xx:xx
---
 attrib/gatt.c     |   13 ++++++++++++-
 attrib/gatt.h     |    4 ++++
 attrib/gatttool.c |   39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 2c87daf..72c6f5f 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -80,7 +80,18 @@ guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
 
 	sdp_uuid16_create(&uuid, GATT_CHARAC_UUID);
 
-	plen = enc_read_by_type_req(start, end, &uuid, pdu, sizeof(pdu));
+	return gatt_read_char_by_uuid(attrib, start, end, &uuid, func,
+							user_data);
+}
+
+guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
+					uuid_t *uuid, GAttribResultFunc func,
+							gpointer user_data)
+{
+	uint8_t pdu[ATT_DEFAULT_MTU];
+	guint16 plen;
+
+	plen = enc_read_by_type_req(start, end, uuid, pdu, sizeof(pdu));
 	if (plen == 0)
 		return 0;
 
diff --git a/attrib/gatt.h b/attrib/gatt.h
index 4e7d88b..1e1e628 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -41,3 +41,7 @@ guint gatt_find_info(GAttrib *attrib, uint16_t start, uint16_t end,
 
 guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, uint8_t *value, int vlen,
 				GDestroyNotify notify, gpointer user_data);
+
+guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
+				uuid_t *uuid, GAttribResultFunc func,
+				gpointer user_data);
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index e961431..d0ef6d3 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -398,10 +398,49 @@ done:
 		g_main_loop_quit(event_loop);
 }
 
+static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
+					guint16 plen, gpointer user_data)
+{
+	struct att_data_list *list;
+	int i;
+
+	if (status != 0) {
+		g_printerr("Read characteristics by UUID failed: %s\n",
+							att_ecode2str(status));
+		goto done;
+	}
+
+	list = dec_read_by_type_resp(pdu, plen);
+	if (list == NULL)
+		goto done;
+
+	for (i = 0; i < list->num; i++) {
+		uint8_t *value = list->data[i];
+		int j;
+
+		g_print("handle: 0x%04x \t value: ", att_get_u16(value));
+		value += 2;
+		for (j = 0; j < list->len - 2; j++, value++)
+			g_print("%02x ", *value);
+		g_print("\n");
+	}
+
+	att_data_list_free(list);
+
+done:
+	g_main_loop_quit(event_loop);
+}
+
 static gboolean characteristics_read(gpointer user_data)
 {
 	GAttrib *attrib = user_data;
 
+	if (opt_uuid != NULL) {
+		gatt_read_char_by_uuid(attrib, opt_start, opt_end, opt_uuid,
+						char_read_by_uuid_cb, attrib);
+		return FALSE;
+	}
+
 	if (opt_handle <= 0) {
 		g_printerr("A valid handle is required\n");
 		g_main_loop_quit(event_loop);
-- 
1.7.3.2


^ permalink raw reply related

* Re: [PATCH] Implement Characteristic Value Read using UUID in the gatttool
From: Johan Hedberg @ 2010-11-18 21:16 UTC (permalink / raw)
  To: Sheldon Demario; +Cc: linux-bluetooth
In-Reply-To: <1290113736-9432-1-git-send-email-sheldon.demario@openbossa.org>

Hi Sheldon,

On Thu, Nov 18, 2010, Sheldon Demario wrote:
> Sub-procedure used to read a Characteristic Value when the client
> only knows the characteristic UUID and doesn't know the handle.
> More than one handle and attribute value pair can be returned,
> it is up to the user define the handles range based on the service
> handles range.
> 
> Usage example:
> $gatttool --char-read --uuid=2a00 -i hcix -b xx:xx:xx:xx:xx:xx
> ---
>  attrib/gatt.c     |   13 ++++++++++++-
>  attrib/gatt.h     |    4 ++++
>  attrib/gatttool.c |   39 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 55 insertions(+), 1 deletions(-)

Doesn't compile:

attrib/gatt.c: In function ‘gatt_discover_char’:
attrib/gatt.c:79: error: unused variable ‘plen’
attrib/gatt.c:77: error: unused variable ‘pdu’
make[1]: *** [attrib/gatt.o] Error 1

Always check your patches against ./bootstrap-configure

Furthermore, there's at least one coding style issue:

> +guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
> +					uuid_t *uuid, GAttribResultFunc func,
> +							gpointer user_data)

The lines after the first one should all have the same indentation, i.e.
the third one has one tab too much.

Johan

^ permalink raw reply

* Re: [PATCH 2/2] Bluetooth: Automate remote name requests
From: Gustavo F. Padovan @ 2010-11-18 21:31 UTC (permalink / raw)
  To: johan.hedberg; +Cc: linux-bluetooth, Johan Hedberg
In-Reply-To: <1290111749-8968-2-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

* johan.hedberg@gmail.com <johan.hedberg@gmail.com> [2010-11-18 22:22:29 +0200]:

> From: Johan Hedberg <johan.hedberg@nokia.com>
> 
> In Bluetooth there are no automatic updates of remote device names when
> they get changed on the remote side. Instead, it is a good idea to do a
> manual name request when a new connection gets created (for whatever
> reason) since at this point it is very cheap (no costly baseband
> connection creation needed just for the sake of the name request).
> 
> So far userspace has been responsible for this extra name request but
> tighter control is needed in order not to flood Bluetooth controllers
> with two many commands during connection creation. It has been shown
> that some controllers simply fail to function correctly if they get too
> many (almost) simultaneous commands during connection creation. The
> simplest way to acheive better control of these commands is to move
> their sending completely to the kernel side.
> 
> This patch inserts name requests into the sequence of events that the
> kernel performs during connection creation. It does this after the
> remote features have been successfully requested and before any pending
> authentication requests are performed. The code will work sub-optimally
> with userspace versions that still do the name requesting themselves (it
> shouldn't break anything though) so it is recommended to combine this
> with a userspace software version that doesn't have automated name
> requests.
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
> ---
>  net/bluetooth/hci_event.c |   72 +++++++++++++++++++++++++++++++++-----------
>  1 files changed, 54 insertions(+), 18 deletions(-)

Both patches have been applied. Thanks.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* compat-wireless-2.6.37-rc2 is out
From: Luis R. Rodriguez @ 2010-11-18 23:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, linux-bluetooth

Just pushed out the compat-wireless-2.6.37-rc2 release. This is a
vanilla release.

http://wireless.kernel.org/en/users/Download/stable

  Luis

^ permalink raw reply

* [PATCH] Add command line option to change BCSP rate
From: Wade Brown @ 2010-11-19  2:01 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

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

Currently when using bccmd to do any communication, the UART is always
opened at 38.4kbps.  Once the CSR has been initialized to any other
speed, bccmd can no longer communicate with with the radio (unless by
resetting it through rfkill).  This patch adds a -b option allowing a
user to manually set a different speed, with the default 38400 still in
place.

Usage example:
$bccmd -t BCSP -b 921600 -d /dev/ttyHS1 chiprev

---
 tools/bccmd.c    |   45 ++++++++++++++++++++++++++++++++++++++++-----
 tools/csr.h      |    3 ++-
 tools/csr_bcsp.c |    4 ++--
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/tools/bccmd.c b/tools/bccmd.c
index 686e858..5cb9255 100644
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -59,7 +59,7 @@
 #define CSR_TYPE_ARRAY		CSR_TYPE_COMPLEX
 #define CSR_TYPE_BDADDR		CSR_TYPE_COMPLEX
 
-static inline int transport_open(int transport, char *device)
+static inline int transport_open(int transport, char *device, speed_t
bcsp_rate)
 {
 	switch (transport) {
 	case CSR_TRANSPORT_HCI:
@@ -69,7 +69,7 @@ static inline int transport_open(int transport, char
*device)
 		return csr_open_usb(device);
 #endif
 	case CSR_TRANSPORT_BCSP:
-		return csr_open_bcsp(device);
+		return csr_open_bcsp(device, bcsp_rate);
 	case CSR_TRANSPORT_H4:
 		return csr_open_h4(device);
 	case CSR_TRANSPORT_3WIRE:
@@ -1109,6 +1109,7 @@ static void usage(void)
 	printf("Options:\n"
 		"\t-t <transport>     Select the transport\n"
 		"\t-d <device>        Select the device\n"
+		"\t-b <bcsp rate>     Select the bcsp transfer rate\n"
 		"\t-h, --help         Display help\n"
 		"\n");
 
@@ -1137,6 +1138,7 @@ static void usage(void)
 static struct option main_options[] = {
 	{ "transport",	1, 0, 't' },
 	{ "device",	1, 0, 'd' },
+	{ "bcsprate", 1, 0, 'b'},
 	{ "help",	0, 0, 'h' },
 	{ 0, 0, 0, 0 }
 };
@@ -1145,8 +1147,9 @@ int main(int argc, char *argv[])
 {
 	char *device = NULL;
 	int i, err, opt, transport = CSR_TRANSPORT_HCI;
+	speed_t bcsp_rate = B38400;
 
-	while ((opt=getopt_long(argc, argv, "+t:d:i:h", main_options, NULL)) !
= EOF) {
+	while ((opt=getopt_long(argc, argv, "+t:d:i:b:h", main_options,
NULL)) != EOF) {
 		switch (opt) {
 		case 't':
 			if (!strcasecmp(optarg, "hci"))
@@ -1171,7 +1174,39 @@ int main(int argc, char *argv[])
 		case 'i':
 			device = strdup(optarg);
 			break;
-
+		case 'b':
+			switch (atoi(optarg)) {
+			case 9600: bcsp_rate = B9600; break;
+			case 19200: bcsp_rate = B19200; break;
+			case 38400: bcsp_rate = B38400; break;
+			case 57600: bcsp_rate = B57600; break;
+			case 115200: bcsp_rate = B115200; break;
+			case 230400: bcsp_rate = B230400; break;
+			case 460800: bcsp_rate = B460800; break;
+			case 500000: bcsp_rate = B500000; break;
+			case 576000: bcsp_rate = B576000; break;
+			case 921600: bcsp_rate = B921600; break;
+			case 1000000: bcsp_rate = B1000000; break;
+			case 1152000: bcsp_rate = B1152000; break;
+			case 1500000: bcsp_rate = B1500000; break;
+			case 2000000: bcsp_rate = B2000000; break;
+#ifdef B2500000
+			case 2500000: bcsp_rate = B2500000; break;
+#endif
+#ifdef B3000000
+			case 3000000: bcsp_rate = B3000000; break;
+#endif
+#ifdef B3500000
+			case 3500000: bcsp_rate = B3500000; break;
+#endif
+#ifdef B4000000
+			case 4000000: bcsp_rate = B4000000; break;
+#endif
+			default:
+				printf("Unknown BCSP baud rate specified, defaulting to 38400bps
\n");
+				bcsp_rate = B38400;
+			}
+			break;
 		case 'h':
 		default:
 			usage();
@@ -1188,7 +1223,7 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	if (transport_open(transport, device) < 0)
+	if (transport_open(transport, device, bcsp_rate) < 0)
 		exit(1);
 
 	if (device)
diff --git a/tools/csr.h b/tools/csr.h
index 1d70491..8b94d7b 100644
--- a/tools/csr.h
+++ b/tools/csr.h
@@ -22,6 +22,7 @@
  */
 
 #include <stdint.h>
+#include <termios.h>
 
 #define CSR_VARID_PS_CLR_ALL			0x000b	/* valueless */
 #define CSR_VARID_PS_FACTORY_SET		0x000c	/* valueless */
@@ -519,7 +520,7 @@ int csr_read_usb(uint16_t varid, uint8_t *value,
uint16_t length);
 int csr_write_usb(uint16_t varid, uint8_t *value, uint16_t length);
 void csr_close_usb(void);
 
-int csr_open_bcsp(char *device);
+int csr_open_bcsp(char *device, speed_t bcsp_rate);
 int csr_read_bcsp(uint16_t varid, uint8_t *value, uint16_t length);
 int csr_write_bcsp(uint16_t varid, uint8_t *value, uint16_t length);
 void csr_close_bcsp(void);
diff --git a/tools/csr_bcsp.c b/tools/csr_bcsp.c
index e551311..df247a2 100644
--- a/tools/csr_bcsp.c
+++ b/tools/csr_bcsp.c
@@ -46,7 +46,7 @@ static uint8_t send_buffer[512];
 static struct ubcsp_packet receive_packet;
 static uint8_t receive_buffer[512];
 
-int csr_open_bcsp(char *device)
+int csr_open_bcsp(char *device, speed_t bcsp_rate)
 {
 	struct termios ti;
 	uint8_t delay, activity = 0x00;
@@ -84,7 +84,7 @@ int csr_open_bcsp(char *device)
 	ti.c_cc[VMIN] = 1;
 	ti.c_cc[VTIME] = 0;
 
-	cfsetospeed(&ti, B38400);
+	cfsetospeed(&ti, bcsp_rate);
 
 	if (tcsetattr(fd, TCSANOW, &ti) < 0) {
 		fprintf(stderr, "Can't change port settings: %s (%d)\n",
--
1.7.0.4

-- 
Wade Brown



[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4916 bytes --]

^ permalink raw reply related

* How to control the bluetooth connetion time
From: Roc Bai @ 2010-11-19  2:02 UTC (permalink / raw)
  To: linux-bluetooth

Hi, All:
  When i pair my phone with the PC, i have to quickly input the PIN code
with the linux-2.6.35.1 kernel. But i can do it slowly with linux-2.6.26
kernel. All the application and library are same. So i think the waiting
timeout is changed, but i cann't find the changement. I hope get your help
on the issue. Thanks very much!

My hcid version is 3.36.

Best Regards

Bai Shuwei

--
Thinking before action, but you are wasting time if you don't do action.

^ permalink raw reply

* [PATCH] hciattach: send hci commands after hci socket bring up
From: Suraj Sumangala @ 2010-11-19  5:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jothikumar.Mothilal, Suraj Sumangala

This patch makes The Atheros AR300x specific initialization code
to send power management command over HCI socket after bringing up
the device.

---
 tools/hciattach_ath3k.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/hciattach_ath3k.c b/tools/hciattach_ath3k.c
index b891506..70ade30 100644
--- a/tools/hciattach_ath3k.c
+++ b/tools/hciattach_ath3k.c
@@ -884,6 +884,8 @@ int ath3k_post(int fd, int pm)
 	int dev_id, dd;
 	struct timespec tm = { 0, 50000 };
 
+	sleep(1);
+
 	dev_id = ioctl(fd, HCIUARTGETDEVICE, 0);
 	if (dev_id < 0) {
 		perror("cannot get device id");
@@ -896,11 +898,15 @@ int ath3k_post(int fd, int pm)
 		return dd;
 	}
 
-	sleep(2);
+	if (ioctl(dd, HCIDEVUP, dev_id) < 0 && errno != EALREADY) {
+		perror("hci down:Power management Disabled");
+		hci_close_dev(dd);
+		return -1;
+	}
 
 	/* send vendor specific command with Sleep feature Enabled */
 	if (hci_send_cmd(dd, OGF_VENDOR_CMD, HCI_SLEEP_CMD_OCF,	1, &pm) < 0)
-		perror("Power management Disabled");
+		perror("PM command failed, power management Disabled");
 
 	nanosleep(&tm, NULL);
 	hci_close_dev(dd);
-- 
1.7.0.4


^ permalink raw reply related

* Re: New Broadcom chip in W510
From: Lu Ran @ 2010-11-19  6:08 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <201009190926.51131.hephooey@gmail.com>

Hi,

I have made some progress today, appearently 28 is ENOSPC, meaning the usb 
host controller does not have enough bandwidth for the device. Indeed when I 
unplug my usb mouse I can have playback (mic is still missing with ENOSPC). Is 
there a way to reduce the package size from btusb, the mouse is the only 
device I can remove, there are a internal camera and figure print reader always 
connected.

-- 
Best Regards,
LR

On Sunday 19 September 2010 09:26:51 Lu Ran wrote:
> Hi all,
> 
> I am having trouble to make my headset work in my new W510, it works fine
> in an T61, with has almost identical software and setup with the new W510.
> The only difference is I am now using a pure 64 bit system, while the old
> T61 is a 32 bit one, and the bluetooth chip is different. the id of the
> chip in T61 is 0A5C:2110, while W510 has a chip from Broadcom with id
> 0A5C:217F. I noticed there is a SCO fix for 0A5C:2110 in btusb.c. I tried
> to copy the line and change the id to 0A5C:217F, but nothing changes. The
> headset can pair with the laptop with no problem, but there seems to be no
> data transmition. And I get a lot error messages in dmesg output like
> this:
> 
> btusb_submit_isoc_urb: hci0 urb ffff880060136e00 submission failed (28)
> 
> and
> 
> btusb_send_frame: hci0 urb ffff8801320e1a00 submission failed
> 
> the output of "hciconfig hci0 version" is
> 
> hci0:   Type: BR/EDR  Bus: USB
>         BD Address: 70:F3:95:34:2F:29  ACL MTU: 1021:8  SCO MTU: 64:8
>         HCI Version: 2.1 (0x4)  Revision: 0x168
>         LMP Version: 2.1 (0x4)  Subversion: 0x4203
>         Manufacturer: Broadcom Corporation (15)
> 
> And the output of "lsusb -v" is in the attachment. I will try to provide
> any other information you need to analyse the problem.

^ permalink raw reply

* [PATCH v2] Implement Characteristic Value Read using UUID in the gatttool
From: Sheldon Demario @ 2010-11-19 13:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

Sub-procedure used to read a Characteristic Value when the client
only knows the characteristic UUID and doesn't know the handle.
More than one handle and attribute value pair can be returned,
it is up to the user define the handles range based on the service
handles range.

Usage example:
$gatttool --char-read --uuid=2a00 -i hcix -b xx:xx:xx:xx:xx:xx
---
 attrib/gatt.c     |   15 ++++++++++++---
 attrib/gatt.h     |    4 ++++
 attrib/gatttool.c |   39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 2c87daf..bca8b49 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -74,13 +74,22 @@ guint gatt_discover_primary(GAttrib *attrib, uint16_t start, uint16_t end,
 guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
 				GAttribResultFunc func, gpointer user_data)
 {
-	uint8_t pdu[ATT_DEFAULT_MTU];
 	uuid_t uuid;
-	guint16 plen;
 
 	sdp_uuid16_create(&uuid, GATT_CHARAC_UUID);
 
-	plen = enc_read_by_type_req(start, end, &uuid, pdu, sizeof(pdu));
+	return gatt_read_char_by_uuid(attrib, start, end, &uuid, func,
+							user_data);
+}
+
+guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
+					uuid_t *uuid, GAttribResultFunc func,
+					gpointer user_data)
+{
+	uint8_t pdu[ATT_DEFAULT_MTU];
+	guint16 plen;
+
+	plen = enc_read_by_type_req(start, end, uuid, pdu, sizeof(pdu));
 	if (plen == 0)
 		return 0;
 
diff --git a/attrib/gatt.h b/attrib/gatt.h
index 4e7d88b..1e1e628 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -41,3 +41,7 @@ guint gatt_find_info(GAttrib *attrib, uint16_t start, uint16_t end,
 
 guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, uint8_t *value, int vlen,
 				GDestroyNotify notify, gpointer user_data);
+
+guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
+				uuid_t *uuid, GAttribResultFunc func,
+				gpointer user_data);
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index e961431..d0ef6d3 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -398,10 +398,49 @@ done:
 		g_main_loop_quit(event_loop);
 }
 
+static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
+					guint16 plen, gpointer user_data)
+{
+	struct att_data_list *list;
+	int i;
+
+	if (status != 0) {
+		g_printerr("Read characteristics by UUID failed: %s\n",
+							att_ecode2str(status));
+		goto done;
+	}
+
+	list = dec_read_by_type_resp(pdu, plen);
+	if (list == NULL)
+		goto done;
+
+	for (i = 0; i < list->num; i++) {
+		uint8_t *value = list->data[i];
+		int j;
+
+		g_print("handle: 0x%04x \t value: ", att_get_u16(value));
+		value += 2;
+		for (j = 0; j < list->len - 2; j++, value++)
+			g_print("%02x ", *value);
+		g_print("\n");
+	}
+
+	att_data_list_free(list);
+
+done:
+	g_main_loop_quit(event_loop);
+}
+
 static gboolean characteristics_read(gpointer user_data)
 {
 	GAttrib *attrib = user_data;
 
+	if (opt_uuid != NULL) {
+		gatt_read_char_by_uuid(attrib, opt_start, opt_end, opt_uuid,
+						char_read_by_uuid_cb, attrib);
+		return FALSE;
+	}
+
 	if (opt_handle <= 0) {
 		g_printerr("A valid handle is required\n");
 		g_main_loop_quit(event_loop);
-- 
1.7.3.2


^ permalink raw reply related

* [PATCH] Extract flags from advertising data
From: Bruna Moreira @ 2010-11-19 13:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bruna Moreira

These flags will be used to decide if GATT service discovery will happen
over LE (for single mode devices) or BR/EDR (for dual mode and non-LE
devices).
---
 src/adapter.c |   14 ++++++++++++++
 src/adapter.h |    1 +
 src/sdpd.h    |   10 ++++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8136229..648d2a8 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3053,6 +3053,18 @@ static struct remote_dev_info *get_found_dev(struct btd_adapter *adapter,
 	return dev;
 }
 
+static uint8_t extract_eir_flags(uint8_t *eir_data)
+{
+	if (eir_data[0] == 0)
+		return 0;
+
+	if (eir_data[1] != EIR_FLAGS)
+		return 0;
+
+	/* For now, only one octet is used for flags */
+	return eir_data[2];
+}
+
 void adapter_update_device_from_info(struct btd_adapter *adapter,
 						le_advertising_info *info)
 {
@@ -3084,6 +3096,8 @@ void adapter_update_device_from_info(struct btd_adapter *adapter,
 			g_free(dev->name);
 			dev->name = tmp_name;
 		}
+
+		dev->flags = extract_eir_flags(info->data);
 	}
 
 	/* FIXME: check if other information was changed before emitting the
diff --git a/src/adapter.h b/src/adapter.h
index 4af69b3..3a67539 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -74,6 +74,7 @@ struct remote_dev_info {
 	GSList *services;
 	uint8_t evt_type;
 	uint8_t bdaddr_type;
+	uint8_t flags;
 };
 
 struct hci_dev {
diff --git a/src/sdpd.h b/src/sdpd.h
index 5bab869..a46ad3c 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -36,6 +36,7 @@
 
 #define EIR_DATA_LENGTH  240
 
+#define EIR_FLAGS                   0x01  /* flags */
 #define EIR_UUID16_SOME             0x02  /* 16-bit UUID, more available */
 #define EIR_UUID16_ALL              0x03  /* 16-bit UUID, all listed */
 #define EIR_UUID32_SOME             0x04  /* 32-bit UUID, more available */
@@ -47,6 +48,15 @@
 #define EIR_TX_POWER                0x0A  /* transmit power level */
 #define EIR_DEVICE_ID               0x10  /* device ID */
 
+/* Flags Descriptions */
+#define EIR_LIM_DISC                0x01 /* LE Limited Discoverable Mode */
+#define EIR_GEN_DISC                0x02 /* LE General Discoverable Mode */
+#define EIR_BREDR_UNSUP             0x04 /* BR/EDR Not Supported */
+#define EIR_SIM_CONTROLLER          0x08 /* Simultaneous LE and BR/EDR to Same
+					    Device Capable (Controller) */
+#define EIR_SIM_HOST                0x10 /* Simultaneous LE and BR/EDR to Same
+					    Device Capable (Host) */
+
 typedef struct request {
 	bdaddr_t device;
 	bdaddr_t bdaddr;
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 1/2] Merge service UUIDs from different BR/EDR EIR data
From: Anderson Lizardo @ 2010-11-19 14:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

For LE devices, service UUIDs present in advertising data are merged
into a single list. This change makes the same thing for BR/EDR devices.
---
 src/adapter.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8136229..c650a63 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3004,12 +3004,6 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 	} else
 		alias = g_strdup(dev->alias);
 
-	if (dev->services) {
-		g_slist_foreach(dev->services, (GFunc) g_free, NULL);
-		g_slist_free(dev->services);
-		dev->services = NULL;
-	}
-
 	emit_device_found(adapter->path, paddr,
 			"Address", DBUS_TYPE_STRING, &paddr,
 			"Class", DBUS_TYPE_UINT32, &dev->class,
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 2/2] Avoid reallocations of services UUID array
From: Anderson Lizardo @ 2010-11-19 14:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1290178241-8358-1-git-send-email-anderson.lizardo@openbossa.org>

The array of service UUIDs used by the DeviceFound signal contains the
same information from the GSList of services. Instead of reallocating
this array on each signal, store it on the remote_dev_info structure and
only reallocate it if there are new UUIDs.
---
 src/adapter.c |   17 ++++++++---------
 src/adapter.h |    3 ++-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index c650a63..1e51d11 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2964,7 +2964,6 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 	dbus_bool_t paired = FALSE;
 	dbus_int16_t rssi = dev->rssi;
 	char *alias;
-	char **uuids = NULL;
 	size_t uuid_count;
 
 	ba2str(&dev->bdaddr, peer_addr);
@@ -2977,9 +2976,11 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 	/* Extract UUIDs from extended inquiry response if any */
 	dev->services = get_eir_uuids(eir_data, eir_length, dev->services);
 	uuid_count = g_slist_length(dev->services);
-
-	if (dev->services)
-		uuids = strlist2array(dev->services);
+	if (dev->services && dev->uuid_count != uuid_count) {
+		g_strfreev(dev->uuids);
+		dev->uuids = strlist2array(dev->services);
+		dev->uuid_count = uuid_count;
+	}
 
 	if (dev->le) {
 		emit_device_found(adapter->path, paddr,
@@ -2987,9 +2988,8 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 				"RSSI", DBUS_TYPE_INT16, &rssi,
 				"Name", DBUS_TYPE_STRING, &dev->name,
 				"Paired", DBUS_TYPE_BOOLEAN, &paired,
-				"UUIDs", DBUS_TYPE_ARRAY, &uuids, uuid_count,
-				NULL);
-		g_strfreev(uuids);
+				"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids,
+				dev->uuid_count, NULL);
 		return;
 	}
 
@@ -3013,11 +3013,10 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 			"Alias", DBUS_TYPE_STRING, &alias,
 			"LegacyPairing", DBUS_TYPE_BOOLEAN, &dev->legacy,
 			"Paired", DBUS_TYPE_BOOLEAN, &paired,
-			"UUIDs", DBUS_TYPE_ARRAY, &uuids, uuid_count,
+			"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids, dev->uuid_count,
 			NULL);
 
 	g_free(alias);
-	g_strfreev(uuids);
 }
 
 static struct remote_dev_info *get_found_dev(struct btd_adapter *adapter,
diff --git a/src/adapter.h b/src/adapter.h
index 4af69b3..955bb9a 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -70,7 +70,8 @@ struct remote_dev_info {
 	dbus_bool_t legacy;
 	name_status_t name_status;
 	gboolean le;
-	/* LE adv data */
+	char **uuids;
+	size_t uuid_count;
 	GSList *services;
 	uint8_t evt_type;
 	uint8_t bdaddr_type;
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH 2/2] Avoid reallocations of services UUID array
From: Anderson Lizardo @ 2010-11-19 14:53 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1290178241-8358-2-git-send-email-anderson.lizardo@openbossa.org>

On Fri, Nov 19, 2010 at 10:50 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> The array of service UUIDs used by the DeviceFound signal contains the
> same information from the GSList of services. Instead of reallocating
> this array on each signal, store it on the remote_dev_info structure and
> only reallocate it if there are new UUIDs.

Oops, just noticed I forgot to free the dev->uuids array. Will send a
fixed patch ASAP.

Regards,
-- 
Anderson Lizardo
OpenBossa Labs - INdT
Manaus - Brazil

^ permalink raw reply

* [PATCH v2 2/2] Avoid reallocations of services UUID array
From: Anderson Lizardo @ 2010-11-19 14:59 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

The array of service UUIDs used by the DeviceFound signal contains the
same information from the GSList of services. Instead of reallocating
this array on each signal, store it on the remote_dev_info structure and
only reallocate it if there are new UUIDs.
---
 src/adapter.c |   18 +++++++++---------
 src/adapter.h |    3 ++-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index c650a63..4fe8276 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -204,6 +204,7 @@ static void dev_info_free(struct remote_dev_info *dev)
 	g_free(dev->alias);
 	g_slist_foreach(dev->services, (GFunc) g_free, NULL);
 	g_slist_free(dev->services);
+	g_strfreev(dev->uuids);
 	g_free(dev);
 }
 
@@ -2964,7 +2965,6 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 	dbus_bool_t paired = FALSE;
 	dbus_int16_t rssi = dev->rssi;
 	char *alias;
-	char **uuids = NULL;
 	size_t uuid_count;
 
 	ba2str(&dev->bdaddr, peer_addr);
@@ -2977,9 +2977,11 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 	/* Extract UUIDs from extended inquiry response if any */
 	dev->services = get_eir_uuids(eir_data, eir_length, dev->services);
 	uuid_count = g_slist_length(dev->services);
-
-	if (dev->services)
-		uuids = strlist2array(dev->services);
+	if (dev->services && dev->uuid_count != uuid_count) {
+		g_strfreev(dev->uuids);
+		dev->uuids = strlist2array(dev->services);
+		dev->uuid_count = uuid_count;
+	}
 
 	if (dev->le) {
 		emit_device_found(adapter->path, paddr,
@@ -2987,9 +2989,8 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 				"RSSI", DBUS_TYPE_INT16, &rssi,
 				"Name", DBUS_TYPE_STRING, &dev->name,
 				"Paired", DBUS_TYPE_BOOLEAN, &paired,
-				"UUIDs", DBUS_TYPE_ARRAY, &uuids, uuid_count,
-				NULL);
-		g_strfreev(uuids);
+				"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids,
+				dev->uuid_count, NULL);
 		return;
 	}
 
@@ -3013,11 +3014,10 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 			"Alias", DBUS_TYPE_STRING, &alias,
 			"LegacyPairing", DBUS_TYPE_BOOLEAN, &dev->legacy,
 			"Paired", DBUS_TYPE_BOOLEAN, &paired,
-			"UUIDs", DBUS_TYPE_ARRAY, &uuids, uuid_count,
+			"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids, dev->uuid_count,
 			NULL);
 
 	g_free(alias);
-	g_strfreev(uuids);
 }
 
 static struct remote_dev_info *get_found_dev(struct btd_adapter *adapter,
diff --git a/src/adapter.h b/src/adapter.h
index 4af69b3..955bb9a 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -70,7 +70,8 @@ struct remote_dev_info {
 	dbus_bool_t legacy;
 	name_status_t name_status;
 	gboolean le;
-	/* LE adv data */
+	char **uuids;
+	size_t uuid_count;
 	GSList *services;
 	uint8_t evt_type;
 	uint8_t bdaddr_type;
-- 
1.7.0.4


^ permalink raw reply related


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