Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH BlueZ 1/3] android/hid: Add handling of incoming connections
From: Johan Hedberg @ 2013-10-31 13:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1383221988-1601-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Thu, Oct 31, 2013, Luiz Augusto von Dentz wrote:
> ---
>  android/hid.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 90 insertions(+)

All three patches have been applied (with one minor coding style fix to
2/3). Thanks.

Johan

^ permalink raw reply

* [PATCH v2 1/2] android: Always enable SSP if supported by controller
From: Szymon Janc @ 2013-10-31 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

There is no HAL function to enable/disable SSP so always enable it if
supported by controller.
---

v2:
  use missing_settings mask for checking if setting is enabled

 android/adapter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/android/adapter.c b/android/adapter.c
index a3f9aa6..c6fcf96 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -490,6 +490,7 @@ static void read_info_complete(uint8_t status, uint16_t length, const void *para
 							void *user_data)
 {
 	const struct mgmt_rp_read_info *rp = param;
+	uint32_t missing_settings;
 	int err;
 
 	DBG("");
@@ -528,6 +529,13 @@ static void read_info_complete(uint8_t status, uint16_t length, const void *para
 	load_link_keys(NULL);
 
 	set_io_capability();
+
+	missing_settings = adapter->current_settings ^
+						adapter->supported_settings;
+
+	if (missing_settings & MGMT_SETTING_SSP)
+		set_mode(MGMT_OP_SET_SSP, 0x01);
+
 	set_mode(MGMT_OP_SET_PAIRABLE, 0x01);
 
 	return;
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH v2 2/2] android: Set pairable mode only if it is not set
From: Szymon Janc @ 2013-10-31 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1383225309-7260-1-git-send-email-szymon.janc@tieto.com>

There is no need to set already set setting.
---
 android/adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/adapter.c b/android/adapter.c
index c6fcf96..f1a4258 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -536,7 +536,8 @@ static void read_info_complete(uint8_t status, uint16_t length, const void *para
 	if (missing_settings & MGMT_SETTING_SSP)
 		set_mode(MGMT_OP_SET_SSP, 0x01);
 
-	set_mode(MGMT_OP_SET_PAIRABLE, 0x01);
+	if (missing_settings & MGMT_SETTING_PAIRABLE)
+		set_mode(MGMT_OP_SET_PAIRABLE, 0x01);
 
 	return;
 
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH] android: Add supported uuids when adapter initialized
From: Marcin Kraglak @ 2013-10-31 13:17 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcin Kraglak

It will set class of device with proper service hints.
We set it statically because we don't want to change
class of device while adding/removing sdp services.
---
 android/adapter.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/android/adapter.c b/android/adapter.c
index a3f9aa6..5a1cc9b 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -39,6 +39,29 @@
 
 static GIOChannel *notification_io = NULL;
 
+/*
+ * This is an array of supported uuids and service hints. We add them via mgmt
+ * interface when adapter is initialized. Uuids are in reverse orded.
+ */
+static const struct mgmt_cp_add_uuid sup_uuids[] = {
+	/* OBEX_OPP_UUID */
+	{ .uuid = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x05, 0x11, 0x00, 0x00 },
+	.svc_hint = 0x10 },
+	/* HFP_AG_UUID */
+	{ .uuid = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x1f, 0x11, 0x00, 0x00 },
+	.svc_hint = 0x40 },
+	/* ADVANCED_AUDIO_UUID */
+	{ .uuid = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x0d, 0x11, 0x00, 0x00 },
+	.svc_hint = 0x08 },
+	/* PANU_UUID */
+	{ .uuid = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00, 0x15, 0x11, 0x00, 0x00 },
+	.svc_hint = 0x02 }
+};
+
 struct bt_adapter {
 	uint16_t index;
 	struct mgmt *mgmt;
@@ -438,6 +461,38 @@ static void load_link_keys(GSList *keys)
 	}
 }
 
+static void add_uuid_complete(uint8_t status, uint16_t length,
+					const void *param, void *user_data)
+{
+	if (status != MGMT_STATUS_SUCCESS) {
+		error("Failed to add UUID: %s (0x%02x)",
+						mgmt_errstr(status), status);
+		return;
+	}
+
+	mgmt_dev_class_changed_event(adapter->index, length, param, NULL);
+}
+
+static void add_uuids(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < sizeof(sup_uuids) / sizeof(sup_uuids[0]); i++)
+		mgmt_send(adapter->mgmt, MGMT_OP_ADD_UUID, adapter->index,
+				sizeof(sup_uuids[i]), &sup_uuids[i],
+				add_uuid_complete, NULL, NULL);
+}
+
+static void clear_uuids(void)
+{
+	struct mgmt_cp_remove_uuid cp;
+
+	memset(&cp, 0, sizeof(cp));
+
+	mgmt_send(adapter->mgmt, MGMT_OP_REMOVE_UUID, adapter->index,
+			sizeof(cp), &cp, NULL, NULL, NULL);
+}
+
 static void set_mode_complete(uint8_t status, uint16_t length,
 					const void *param, void *user_data)
 {
@@ -530,6 +585,9 @@ static void read_info_complete(uint8_t status, uint16_t length, const void *para
 	set_io_capability();
 	set_mode(MGMT_OP_SET_PAIRABLE, 0x01);
 
+	clear_uuids();
+	add_uuids();
+
 	return;
 
 failed:
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH] android/client: Don't alignt name property while printing
From: Szymon Janc @ 2013-10-31 13:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Received name property is guaranteed to be NULL terminated so there is
no need to use length specifier. This also fix really long space while
printing due to text alignment to the right.
---
 android/client/if-bt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 16bd882..c9681fc 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -88,8 +88,7 @@ static char *btproperty2str(bt_property_t property)
 	switch (property.type) {
 	case BT_PROPERTY_BDNAME:
 	case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
-		sprintf(p, "%*s", property.len,
-					((bt_bdname_t *) property.val)->name);
+		sprintf(p, "%s", ((bt_bdname_t *) property.val)->name);
 		break;
 
 	case BT_PROPERTY_BDADDR:
-- 
1.8.4.1


^ permalink raw reply related

* RE: l2cap sockets not properly multiplexed on ARM
From: Tim Tisdall @ 2013-10-31 13:31 UTC (permalink / raw)
  To: Alexander Holler, Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <527190DA.6000805@ahsoftware.de>

> As Anderson Lizardo already mentioned, maybe first verify that the x86=0A=
> kernel 3.4 doesn't have the same problem and that it's really a problem=
=0A=
> of the ARM kernel. Up to now he didn't say what kernel version he uses=0A=
> on x86.=0A=
=0A=
here's my desktop version:=0A=
$ uname -a=0A=
Linux tzing 3.8.0-32-generic #47-Ubuntu SMP Tue Oct 1 22:35:23 UTC 2013 x86=
_64 x86_64 x86_64 GNU/Linux=0A=
=0A=
I'm trying to get an older version of the kernel running on another machine=
 and then I'll report back=0A=

^ permalink raw reply

* Re: [PATCH] android/daemon: Fix error setting property
From: Johan Hedberg @ 2013-10-31 13:45 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1383220358-5436-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Thu, Oct 31, 2013, Andrei Emeltchenko wrote:
> Do not return error setting property which is already set. This fixes
> bug with set_scan_mode which might return HAL_STATUS_DONE.
> ---
>  android/adapter.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [RFC] android/daemon: Fix not reporting scan mode to Java
From: Johan Hedberg @ 2013-10-31 13:46 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1383223355-4628-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Thu, Oct 31, 2013, Andrei Emeltchenko wrote:
> After set_adapter_property() higher layer expects callback to be returned
> even if property is not changes. Otherwise Java timeouts and reset Bluetooth
> enetring to the loop.
> ...
> BluetoothAdapterState( 2850): Timeout will setting scan mode..
>   Continuing with disable...
> ...
> ---
>  android/adapter.c |   12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH v2 1/2] android: Always enable SSP if supported by controller
From: Johan Hedberg @ 2013-10-31 13:47 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1383225309-7260-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Thu, Oct 31, 2013, Szymon Janc wrote:
> There is no HAL function to enable/disable SSP so always enable it if
> supported by controller.
> ---
> 
> v2:
>   use missing_settings mask for checking if setting is enabled
> 
>  android/adapter.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] android/client: Don't alignt name property while printing
From: Johan Hedberg @ 2013-10-31 13:48 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1383225721-7579-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Thu, Oct 31, 2013, Szymon Janc wrote:
> Received name property is guaranteed to be NULL terminated so there is
> no need to use length specifier. This also fix really long space while
> printing due to text alignment to the right.
> ---
>  android/client/if-bt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied (after the obvious typo fix for the subject). Thanks.

Johan

^ permalink raw reply

* [PATCH] android/hidhost: Fix not unregistering HID
From: Andrei Emeltchenko @ 2013-10-31 13:51 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

If HID is not unregistered it cannot be registered again and we get
following error:
...
E/BluetoothHidServiceJni( 2849): Failed to initialize Bluetooth HID, status: 1
...
---
 android/hal-hidhost.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index a72410b..a81fea5 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -301,12 +301,17 @@ static bt_status_t hh_init(bthh_callbacks_t *callbacks)
 
 static void hh_cleanup(void)
 {
+	struct hal_cmd_unregister_module cmd;
+
 	DBG("");
 
 	if (!interface_ready())
 		return;
 
 	bt_hh_cbacks = NULL;
+
+	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
 }
 
 static bthh_interface_t hh_if = {
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH 1/2] Bluetooth: Remove debug statement for features complete event
From: Johan Hedberg @ 2013-10-31 13:56 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1383220473-33584-1-git-send-email-marcel@holtmann.org>

Hi Marcel,

On Thu, Oct 31, 2013, Marcel Holtmann wrote:
> The complete list of local features are available through debugfs and
> so there is no need to add a debug print here.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_event.c | 6 ------
>  1 file changed, 6 deletions(-)

Both patches have been applied to bluetooth-next. Thanks.

Johan

^ permalink raw reply

* [PATCH] android: Add support for setting adapters name
From: Grzegorz Kolodziejczyk @ 2013-10-31 14:00 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/adapter.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h |  2 ++
 2 files changed, 55 insertions(+)

diff --git a/android/adapter.c b/android/adapter.c
index 15b65e5..5dadc2e 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -129,6 +129,27 @@ static void scan_mode_changed(void)
 	g_free(ev);
 }
 
+static void adapter_name_changed(const uint8_t *name)
+{
+	struct hal_ev_adapter_props_changed *ev;
+	uint8_t buf[sizeof(*ev) + sizeof(struct hal_property) +
+							HAL_MAX_NAME_LENGTH];
+
+	memset(buf, 0, sizeof(buf));
+	ev = (void *) buf;
+
+	ev->num_props = 1;
+	ev->status = HAL_STATUS_SUCCESS;
+	ev->props[0].type = HAL_PROP_ADAPTER_NAME;
+	ev->props[0].len = HAL_MAX_NAME_LENGTH;
+	memcpy(ev->props->val, name, HAL_MAX_NAME_LENGTH);
+
+	DBG("Adapter name changed to: %s", ev->props->val);
+
+	ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);
+}
+
 static void settings_changed(uint32_t settings)
 {
 	uint32_t changed_mask;
@@ -286,6 +307,37 @@ static bool set_mode(uint16_t opcode, uint8_t mode)
 	return false;
 }
 
+static void set_adapter_name_complete(uint8_t status, uint16_t length,
+					const void *param, void *user_data)
+{
+	const struct mgmt_cp_set_local_name *rp = param;
+
+	if (status != MGMT_STATUS_SUCCESS) {
+		error("Failed to set name: %s (0x%02x)",
+						mgmt_errstr(status), status);
+		return;
+	}
+
+	adapter_name_changed(rp->name);
+}
+
+static bool set_adapter_name(uint8_t *name, uint16_t len)
+{
+	struct mgmt_cp_set_local_name cp;
+
+	memset(&cp, 0, sizeof(cp));
+	memcpy(cp.name, name, len);
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_LOCAL_NAME, adapter->index,
+			sizeof(cp), &cp, set_adapter_name_complete, NULL,
+								NULL) > 0)
+		return true;
+
+	error("Failed to set name");
+
+	return false;
+}
+
 static void read_info_complete(uint8_t status, uint16_t length, const void *param,
 							void *user_data)
 {
@@ -472,6 +524,7 @@ static uint8_t set_property(void *buf, uint16_t len)
 	case HAL_PROP_ADAPTER_SCAN_MODE:
 		return set_scan_mode(cmd->val, cmd->len);
 	case HAL_PROP_ADAPTER_NAME:
+		return set_adapter_name(cmd->val, cmd->len);
 	case HAL_PROP_ADAPTER_DISC_TIMEOUT:
 	default:
 		DBG("Unhandled property type 0x%x", cmd->type);
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 80b47d6..506d10c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -89,6 +89,8 @@ struct hal_cmd_get_adapter_prop {
 	uint8_t type;
 } __attribute__((packed));
 
+#define HAL_MAX_NAME_LENGTH		249
+
 #define HAL_PROP_ADAPTER_NAME			0x01
 #define HAL_PROP_ADAPTER_ADDR			0x02
 #define HAL_PROP_ADAPTER_UUIDS			0x03
-- 
1.8.4.1


^ permalink raw reply related

* Re: [PATCH 00/10] Add GATT support to haltest
From: Johan Hedberg @ 2013-10-31 14:03 UTC (permalink / raw)
  To: Jerzy Kasenberg; +Cc: linux-bluetooth
In-Reply-To: <1383216315-30627-1-git-send-email-jerzy.kasenberg@tieto.com>

Hi Jerzy,

On Thu, Oct 31, 2013, Jerzy Kasenberg wrote:
> This patachset adds code to call GATT hal methods.
> Compiles on Android 4.3 and host.
> On 4.2 it's source code is not included.
> 
> Status that is used in callbacks is currently printed as number.
> This number corresponds to series of defines from file:
> external/bluedroid/stack/include/gatt_api.h
> This file looks like implementation detail for bluedroid.
> It's to be decided it defines should be copied to bluez source code.
> Until that status is printed as numbers.
> Same applies to tGATT_WRITE_TYPE which is used as argument in
> write_characteristic and write_descriptor.
> 
> Jerzy Kasenberg (10):
>   android/client: Add skeleton for GATT interface
>   android/client: Add GATT client callbacks code
>   android/client: Add complex GATT type formating
>   android/client: Add init/cleanup for GATT
>   android/client: Add helper macros to verify args
>   android/client: Add GATT client method calls
>   android/client: Add GATT complex type parsing
>   android/client: Add tab completion to GATT client
>   android/client: Add GATT server callbacks code
>   android/client: Add GATT server methods
> 
>  android/Android.mk       |    7 +
>  android/Makefile.am      |    2 +
>  android/client/haltest.c |    5 +
>  android/client/if-bt.c   |    2 +
>  android/client/if-gatt.c | 1733 ++++++++++++++++++++++++++++++++++++++++++++++
>  android/client/if-main.h |   14 +
>  6 files changed, 1763 insertions(+)
>  create mode 100644 android/client/if-gatt.c

All patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] android/hidhost: Fix not unregistering HID
From: Johan Hedberg @ 2013-10-31 14:04 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1383227514-22944-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Thu, Oct 31, 2013, Andrei Emeltchenko wrote:
> If HID is not unregistered it cannot be registered again and we get
> following error:
> ...
> E/BluetoothHidServiceJni( 2849): Failed to initialize Bluetooth HID, status: 1
> ...
> ---
>  android/hal-hidhost.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
> index a72410b..a81fea5 100644
> --- a/android/hal-hidhost.c
> +++ b/android/hal-hidhost.c
> @@ -301,12 +301,17 @@ static bt_status_t hh_init(bthh_callbacks_t *callbacks)
>  
>  static void hh_cleanup(void)
>  {
> +	struct hal_cmd_unregister_module cmd;
> +
>  	DBG("");
>  
>  	if (!interface_ready())
>  		return;
>  
>  	bt_hh_cbacks = NULL;
> +
> +	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
> +					sizeof(cmd), &cmd, 0, NULL, NULL);
>  }

Did you test this at all? It looks completely broken to me since you
pass an uninitialized variable to hal_ipc_cmd. You should be at least
setting the right service id for HID in the cmd struct.

Johan

^ permalink raw reply

* Re: [PATCH] android/hidhost: Fix not unregistering HID
From: Andrei Emeltchenko @ 2013-10-31 14:08 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <20131031140458.GB27325@x220.p-661hnu-f1>

Hi Johan,

On Thu, Oct 31, 2013 at 04:04:58PM +0200, Johan Hedberg wrote:
> Hi Andrei,
> 
> On Thu, Oct 31, 2013, Andrei Emeltchenko wrote:
> > If HID is not unregistered it cannot be registered again and we get
> > following error:
> > ...
> > E/BluetoothHidServiceJni( 2849): Failed to initialize Bluetooth HID, status: 1
> > ...
> > ---
> >  android/hal-hidhost.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
> > index a72410b..a81fea5 100644
> > --- a/android/hal-hidhost.c
> > +++ b/android/hal-hidhost.c
> > @@ -301,12 +301,17 @@ static bt_status_t hh_init(bthh_callbacks_t *callbacks)
> >  
> >  static void hh_cleanup(void)
> >  {
> > +	struct hal_cmd_unregister_module cmd;
> > +
> >  	DBG("");
> >  
> >  	if (!interface_ready())
> >  		return;
> >  
> >  	bt_hh_cbacks = NULL;
> > +
> > +	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
> > +					sizeof(cmd), &cmd, 0, NULL, NULL);
> >  }
> 
> Did you test this at all? It looks completely broken to me since you
> pass an uninitialized variable to hal_ipc_cmd. You should be at least
> setting the right service id for HID in the cmd struct.

Sorry, I will send the right one (after testing)

Best regards 
Andrei Emeltchenko 

^ permalink raw reply

* RE: l2cap sockets not properly multiplexed on ARM
From: Tim Tisdall @ 2013-10-31 14:14 UTC (permalink / raw)
  To: Alexander Holler, Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <D9B9EB3A112B8F489DFFA00A6D5C0FE203241BE2@AD-BR-EX-2.adroot.flemingc.local>

Okay, I got the same issue on an x86 machine running "Linux debian 3.2.0-4-486 #1 Debian 3.2.51-1 i686 GNU/Linux".  So, it's not only the ARM machines.

What versions of the kernel are currently supported by the bluetooth team?  (ie when there are bug fixes, how far back will you backport those fixes?)  Am I coming across some issue that's already been fixed in newer versions of the kernel?

-Tim

^ permalink raw reply

* RE: l2cap sockets not properly multiplexed on ARM
From: Tim Tisdall @ 2013-10-31 14:18 UTC (permalink / raw)
  To: Alexander Holler, Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <D9B9EB3A112B8F489DFFA00A6D5C0FE203241C36@AD-BR-EX-2.adroot.flemingc.local>

Sorry, forgot to mention how I set up my testing environment...  I download=
ed the latest version of Debian 7.2 which uses the 3.2 kernel and ran it as=
 a live image off a USB drive.  So, you guys should be able to recreate it =
(if you wish) by snagging http://cdimage.debian.org/debian-cd/current-live/=
i386/iso-hybrid/debian-live-7.2-i386-standard.iso and then following http:/=
/www.debian.org/CD/faq/#write-usb to create a live usb image.=0A=
=0A=

^ permalink raw reply

* Re: l2cap sockets not properly multiplexed on ARM
From: Marcel Holtmann @ 2013-10-31 14:19 UTC (permalink / raw)
  To: Tim Tisdall; +Cc: Alexander Holler, linux-bluetooth@vger.kernel.org
In-Reply-To: <D9B9EB3A112B8F489DFFA00A6D5C0FE203241C36@AD-BR-EX-2.adroot.flemingc.local>

Hi Tim,

> Okay, I got the same issue on an x86 machine running "Linux debian 3.2.0-4-486 #1 Debian 3.2.51-1 i686 GNU/Linux".  So, it's not only the ARM machines.
> 
> What versions of the kernel are currently supported by the bluetooth team?  (ie when there are bug fixes, how far back will you backport those fixes?)  Am I coming across some issue that's already been fixed in newer versions of the kernel?

the upstream people are not backporting anything. The closest you get with upstream is if a patch is cheery picked into -stable. For everything else it is the distro’s job to backport.

Regards

Marcel


^ permalink raw reply

* Re: l2cap sockets not properly multiplexed on ARM
From: Marcel Holtmann @ 2013-10-31 14:20 UTC (permalink / raw)
  To: Tim Tisdall; +Cc: Alexander Holler, linux-bluetooth@vger.kernel.org
In-Reply-To: <D9B9EB3A112B8F489DFFA00A6D5C0FE203241BE2@AD-BR-EX-2.adroot.flemingc.local>

Hi Tim,

>> As Anderson Lizardo already mentioned, maybe first verify that the x86
>> kernel 3.4 doesn't have the same problem and that it's really a problem
>> of the ARM kernel. Up to now he didn't say what kernel version he uses
>> on x86.
> 
> here's my desktop version:
> $ uname -a
> Linux tzing 3.8.0-32-generic #47-Ubuntu SMP Tue Oct 1 22:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> 
> I'm trying to get an older version of the kernel running on another machine and then I'll report back

I actually need to know if bluetooth-next tree still has this issue. That is first and foremost the one thing that needs to be checked.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH] android: Add support for setting adapters name
From: Andrei Emeltchenko @ 2013-10-31 14:21 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth
In-Reply-To: <1383228038-4306-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>

Hi Grzegorz,

On Thu, Oct 31, 2013 at 03:00:38PM +0100, Grzegorz Kolodziejczyk wrote:
> ---
>  android/adapter.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  android/hal-msg.h |  2 ++
>  2 files changed, 55 insertions(+)
> 
> diff --git a/android/adapter.c b/android/adapter.c
> index 15b65e5..5dadc2e 100644
> --- a/android/adapter.c
> +++ b/android/adapter.c
> @@ -129,6 +129,27 @@ static void scan_mode_changed(void)
>  	g_free(ev);
>  }
>  
> +static void adapter_name_changed(const uint8_t *name)
> +{
> +	struct hal_ev_adapter_props_changed *ev;
> +	uint8_t buf[sizeof(*ev) + sizeof(struct hal_property) +
> +							HAL_MAX_NAME_LENGTH];
> +
> +	memset(buf, 0, sizeof(buf));
> +	ev = (void *) buf;
> +
> +	ev->num_props = 1;
> +	ev->status = HAL_STATUS_SUCCESS;
> +	ev->props[0].type = HAL_PROP_ADAPTER_NAME;
> +	ev->props[0].len = HAL_MAX_NAME_LENGTH;

Do we need to pass always HAL_MAX_NAME_LENGTH ?

Best regards 
Andrei Emeltchenko 

> +	memcpy(ev->props->val, name, HAL_MAX_NAME_LENGTH);
> +
> +	DBG("Adapter name changed to: %s", ev->props->val);
> +
> +	ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
> +			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);
> +}
> +
>  static void settings_changed(uint32_t settings)
>  {
>  	uint32_t changed_mask;
> @@ -286,6 +307,37 @@ static bool set_mode(uint16_t opcode, uint8_t mode)
>  	return false;
>  }
>  
> +static void set_adapter_name_complete(uint8_t status, uint16_t length,
> +					const void *param, void *user_data)
> +{
> +	const struct mgmt_cp_set_local_name *rp = param;
> +
> +	if (status != MGMT_STATUS_SUCCESS) {
> +		error("Failed to set name: %s (0x%02x)",
> +						mgmt_errstr(status), status);
> +		return;
> +	}
> +
> +	adapter_name_changed(rp->name);
> +}
> +
> +static bool set_adapter_name(uint8_t *name, uint16_t len)
> +{
> +	struct mgmt_cp_set_local_name cp;
> +
> +	memset(&cp, 0, sizeof(cp));
> +	memcpy(cp.name, name, len);
> +
> +	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_LOCAL_NAME, adapter->index,
> +			sizeof(cp), &cp, set_adapter_name_complete, NULL,
> +								NULL) > 0)
> +		return true;
> +
> +	error("Failed to set name");
> +
> +	return false;
> +}
> +
>  static void read_info_complete(uint8_t status, uint16_t length, const void *param,
>  							void *user_data)
>  {
> @@ -472,6 +524,7 @@ static uint8_t set_property(void *buf, uint16_t len)
>  	case HAL_PROP_ADAPTER_SCAN_MODE:
>  		return set_scan_mode(cmd->val, cmd->len);
>  	case HAL_PROP_ADAPTER_NAME:
> +		return set_adapter_name(cmd->val, cmd->len);
>  	case HAL_PROP_ADAPTER_DISC_TIMEOUT:
>  	default:
>  		DBG("Unhandled property type 0x%x", cmd->type);
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 80b47d6..506d10c 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -89,6 +89,8 @@ struct hal_cmd_get_adapter_prop {
>  	uint8_t type;
>  } __attribute__((packed));
>  
> +#define HAL_MAX_NAME_LENGTH		249
> +
>  #define HAL_PROP_ADAPTER_NAME			0x01
>  #define HAL_PROP_ADAPTER_ADDR			0x02
>  #define HAL_PROP_ADAPTER_UUIDS			0x03
> -- 
> 1.8.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 1/5] android: Add support for starting and cancelling device discovery
From: Jakub Tyszkowski @ 2013-10-31 14:25 UTC (permalink / raw)
  To: linux-bluetooth

Android will cancel ongoing discovery after some period of time so there
is no need for another timeout inside the daemon itself.

---
 android/adapter.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 107 insertions(+), 1 deletion(-)

diff --git a/android/adapter.c b/android/adapter.c
index 02f356d..a12ccb3 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -26,8 +26,9 @@
 #include <glib.h>
 
 #include "lib/bluetooth.h"
-#include "src/shared/mgmt.h"
+#include "lib/sdp.h"
 #include "lib/mgmt.h"
+#include "src/shared/mgmt.h"
 #include "log.h"
 #include "hal-msg.h"
 #include "ipc.h"
@@ -52,6 +53,8 @@ struct bt_adapter {
 
 	uint32_t supported_settings;
 	uint32_t current_settings;
+
+	bool discovering;
 };
 
 static struct bt_adapter *adapter;
@@ -349,6 +352,35 @@ static void user_passkey_notify_callback(uint16_t index, uint16_t length,
 								ev->passkey);
 }
 
+static void mgmt_discovering_event(uint16_t index, uint16_t length,
+					const void *param, void *user_data)
+{
+	const struct mgmt_ev_discovering *ev = param;
+	struct hal_ev_discovery_state_changed cp;
+
+	if (length < sizeof(*ev)) {
+		error("Too small discovering event");
+		return;
+	}
+
+	DBG("hci%u type %u discovering %u", adapter->index, ev->type,
+							ev->discovering);
+
+	if (adapter->discovering == !!ev->discovering)
+		return;
+
+	adapter->discovering = !!ev->discovering;
+
+	DBG("new discovering state %u", ev->discovering);
+
+	cp.state = adapter->discovering ? HAL_DISCOVERY_STATE_STARTED :
+						HAL_DISCOVERY_STATE_STOPPED;
+
+	ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+						HAL_EV_DISCOVERY_STATE_CHANGED,
+						sizeof(cp), &cp, -1);
+}
+
 static void register_mgmt_handlers(void)
 {
 	mgmt_register(adapter->mgmt, MGMT_EV_NEW_SETTINGS, adapter->index,
@@ -379,6 +411,10 @@ static void register_mgmt_handlers(void)
 	mgmt_register(adapter->mgmt, MGMT_EV_PASSKEY_NOTIFY, adapter->index,
 				user_passkey_notify_callback, NULL, NULL);
 
+	mgmt_register(adapter->mgmt, MGMT_EV_DISCOVERING, adapter->index,
+							mgmt_discovering_event,
+							NULL, NULL);
+
 }
 
 static void load_link_keys_complete(uint8_t status, uint16_t length,
@@ -551,6 +587,7 @@ void bt_adapter_init(uint16_t index, struct mgmt *mgmt, bt_adapter_ready cb)
 
 	adapter->mgmt = mgmt_ref(mgmt);
 	adapter->index = index;
+	adapter->discovering = false;
 	adapter->ready = cb;
 
 	if (mgmt_send(mgmt, MGMT_OP_READ_INFO, index, 0, NULL,
@@ -624,6 +661,46 @@ static bool get_property(void *buf, uint16_t len)
 	}
 }
 
+static bool start_discovery(void)
+{
+	struct mgmt_cp_start_discovery cp;
+	uint8_t type = 1 << BDADDR_BREDR;
+
+	if (adapter->current_settings & type)
+		cp.type = type;
+	else
+		cp.type = 0;
+
+	DBG("type=0x%x", type);
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_START_DISCOVERY, adapter->index,
+			sizeof(cp), &cp, NULL, NULL, NULL) > 0)
+		return true;
+
+	error("Failed to start discovery");
+	return false;
+}
+
+static bool stop_discovery(void)
+{
+	struct mgmt_cp_stop_discovery cp;
+	uint8_t type = 1 << BDADDR_BREDR;
+
+	if (adapter->current_settings & type)
+		cp.type = type;
+	else
+		cp.type = 0;
+
+	DBG("type=0x%x", type);
+
+	if (mgmt_send(adapter->mgmt, MGMT_OP_STOP_DISCOVERY, adapter->index,
+			sizeof(cp), &cp, NULL, NULL, NULL) > 0)
+		return true;
+
+	error("Failed to start discovery");
+	return false;
+}
+
 static uint8_t set_scan_mode(void *buf, uint16_t len)
 {
 	uint8_t *mode = buf;
@@ -987,6 +1064,35 @@ void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
 		status = ssp_reply(buf, len);
 		if (status != HAL_STATUS_SUCCESS)
 			goto error;
+		break;
+	case HAL_OP_START_DISCOVERY:
+		if (adapter->discovering) {
+			status = HAL_STATUS_DONE;
+			goto error;
+		}
+
+		if (!(adapter->current_settings & MGMT_SETTING_POWERED)) {
+			status = HAL_STATUS_NOT_READY;
+			goto error;
+		}
+
+		if (!start_discovery())
+			goto error;
+
+		break;
+	case HAL_OP_CANCEL_DISCOVERY:
+		if (!adapter->discovering) {
+			status = HAL_STATUS_DONE;
+			goto error;
+		}
+
+		if (!(adapter->current_settings & MGMT_SETTING_POWERED)) {
+			status = HAL_STATUS_NOT_READY;
+			goto error;
+		}
+
+		if (!stop_discovery())
+			goto error;
 
 		break;
 	default:
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH 2/5] android: Add device discovery mgmt event handling
From: Jakub Tyszkowski @ 2013-10-31 14:25 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1383229534-17157-1-git-send-email-jakub.tyszkowski@tieto.com>

This patch provides basic handling of device found events from management
interface. Temporary device adress list is being used to determine which
devices has already been reported and device property changed event should
be sent instead of device found event.

---
 android/Android.mk  |   2 +
 android/Makefile.am |   2 +
 android/adapter.c   | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 111 insertions(+), 2 deletions(-)

diff --git a/android/Android.mk b/android/Android.mk
index e47f4a9..ef9ebf3 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -32,6 +32,8 @@ LOCAL_SRC_FILES := \
 	../src/sdpd-service.c \
 	../src/sdpd-request.c \
 	../src/sdpd-server.c \
+	../src/glib-helper.c \
+	../src/eir.c \
 	../lib/sdp.c \
 	../lib/bluetooth.c \
 	../lib/hci.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index 05a124e..989b54d 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -7,6 +7,8 @@ android_bluetoothd_SOURCES =	android/main.c \
 				android/utils.h \
 				src/sdpd-database.c src/sdpd-server.c \
 				src/sdpd-service.c src/sdpd-request.c \
+				src/glib-helper.h src/glib-helper.c \
+				src/eir.h src/eir.c \
 				src/shared/util.h src/shared/util.c \
 				src/shared/mgmt.h src/shared/mgmt.c \
 				android/adapter.h android/adapter.c \
diff --git a/android/adapter.c b/android/adapter.c
index a12ccb3..154dd06 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -29,6 +29,8 @@
 #include "lib/sdp.h"
 #include "lib/mgmt.h"
 #include "src/shared/mgmt.h"
+#include "src/glib-helper.h"
+#include "src/eir.h"
 #include "log.h"
 #include "hal-msg.h"
 #include "ipc.h"
@@ -58,6 +60,7 @@ struct bt_adapter {
 };
 
 static struct bt_adapter *adapter;
+static GSList *found_devices = NULL;
 
 static void mgmt_local_name_changed_event(uint16_t index, uint16_t length,
 					const void *param, void *user_data)
@@ -373,14 +376,113 @@ static void mgmt_discovering_event(uint16_t index, uint16_t length,
 
 	DBG("new discovering state %u", ev->discovering);
 
-	cp.state = adapter->discovering ? HAL_DISCOVERY_STATE_STARTED :
-						HAL_DISCOVERY_STATE_STOPPED;
+	if (adapter->discovering) {
+		cp.state = HAL_DISCOVERY_STATE_STARTED;
+	} else {
+		g_slist_free_full(found_devices, g_free);
+		found_devices = NULL;
+
+		cp.state = HAL_DISCOVERY_STATE_STOPPED;
+	}
 
 	ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
 						HAL_EV_DISCOVERY_STATE_CHANGED,
 						sizeof(cp), &cp, -1);
 }
 
+static int bdaddr_cmp(gconstpointer a, gconstpointer b)
+{
+	const bdaddr_t *bda = a;
+	const bdaddr_t *bdb = b;
+
+	return bacmp(bdb, bda);
+}
+
+static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
+					int8_t rssi, bool confirm,
+					const uint8_t *data, uint8_t data_len)
+{
+	bool is_new_dev = false;
+	struct eir_data eir;
+	GSList *l;
+	bdaddr_t *remote = NULL;
+	int err;
+
+	memset(&eir, 0, sizeof(eir));
+
+	err = eir_parse(&eir, data, data_len);
+	if (err < 0) {
+		error("Error parsing EIR data: %s (%d)", strerror(-err), -err);
+		return;
+	}
+
+	l = g_slist_find_custom(found_devices, bdaddr, bdaddr_cmp);
+	if (l)
+		remote = l->data;
+
+	if (!remote) {
+		char addr[18];
+
+		remote = g_new0(bdaddr_t, 1);
+		bacpy(remote, bdaddr);
+
+		found_devices = g_slist_prepend(found_devices, remote);
+		is_new_dev = true;
+
+		ba2str(remote, addr);
+		DBG("New device found: %s", addr);
+	}
+
+	if (is_new_dev) {
+		/* TODO: notify device found */
+	} else {
+		/* TODO: notify device state changed */
+	}
+
+	/* TODO: name confirmation */
+
+	eir_data_free(&eir);
+}
+
+static void mgmt_device_found_event(uint16_t index, uint16_t length,
+					const void *param, void *user_data)
+{
+	const struct mgmt_ev_device_found *ev = param;
+	const uint8_t *eir;
+	uint16_t eir_len;
+	uint32_t flags;
+	bool confirm_name;
+	char addr[18];
+
+	if (length < sizeof(*ev)) {
+		error("Too short device found event (%u bytes)", length);
+		return;
+	}
+
+	eir_len = btohs(ev->eir_len);
+	if (length != sizeof(*ev) + eir_len) {
+		error("Device found event size mismatch (%u != %zu)",
+					length, sizeof(*ev) + eir_len);
+		return;
+	}
+
+	if (eir_len == 0)
+		eir = NULL;
+	else
+		eir = ev->eir;
+
+	flags = btohl(ev->flags);
+
+	ba2str(&ev->addr.bdaddr, addr);
+	DBG("hci%u addr %s, rssi %d flags 0x%04x eir_len %u eir %u",
+				index, addr, ev->rssi, flags, eir_len, *eir);
+
+	confirm_name = flags & MGMT_DEV_FOUND_CONFIRM_NAME;
+
+	update_found_device(&ev->addr.bdaddr, ev->addr.type, ev->rssi,
+						confirm_name, eir, eir_len);
+}
+
 static void register_mgmt_handlers(void)
 {
 	mgmt_register(adapter->mgmt, MGMT_EV_NEW_SETTINGS, adapter->index,
@@ -415,6 +517,9 @@ static void register_mgmt_handlers(void)
 							mgmt_discovering_event,
 							NULL, NULL);
 
+	mgmt_register(adapter->mgmt, MGMT_EV_DEVICE_FOUND,
+					adapter->index, mgmt_device_found_event,
+					NULL, NULL);
 }
 
 static void load_link_keys_complete(uint8_t status, uint16_t length,
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH 3/5] android: Add name property length define
From: Jakub Tyszkowski @ 2013-10-31 14:25 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1383229534-17157-1-git-send-email-jakub.tyszkowski@tieto.com>

Add define for adapter and remote device name property.

---
 android/hal-msg.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/android/hal-msg.h b/android/hal-msg.h
index b792411..8a344d8 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -89,6 +89,8 @@ struct hal_cmd_get_adapter_prop {
 	uint8_t type;
 } __attribute__((packed));
 
+#define HAL_MAX_NAME_LENGTH		249
+
 #define HAL_PROP_ADAPTER_NAME			0x01
 #define HAL_PROP_ADAPTER_ADDR			0x02
 #define HAL_PROP_ADAPTER_UUIDS			0x03
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH 4/5] android: Add device found notifications passing
From: Jakub Tyszkowski @ 2013-10-31 14:25 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1383229534-17157-1-git-send-email-jakub.tyszkowski@tieto.com>

This patch adds remote device found and remote device properties changed
notifications passing using IPC.

---
 android/adapter.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 82 insertions(+), 2 deletions(-)

diff --git a/android/adapter.c b/android/adapter.c
index 154dd06..e72e45b 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -398,11 +398,45 @@ static int bdaddr_cmp(gconstpointer a, gconstpointer b)
 	return bacmp(bdb, bda);
 }
 
+static int fill_device_props(struct hal_property *prop, bdaddr_t *addr,
+					uint32_t cod, int8_t rssi, char *name)
+{
+	uint8_t num_props = 0;
+
+	/* fill cod */
+	prop->type = HAL_PROP_DEVICE_CLASS;
+	prop->len = sizeof(cod);
+	memcpy(prop->val, &cod, prop->len);
+	prop = ((void *) prop) + sizeof(*prop) + sizeof(cod);
+	num_props++;
+
+	/* fill rssi */
+	prop->type = HAL_PROP_DEVICE_RSSI;
+	prop->len = sizeof(rssi);
+	memcpy(prop->val, &rssi, prop->len);
+	prop = ((void *) prop) + sizeof(*prop) + sizeof(rssi);
+	num_props++;
+
+	/* fill name */
+	if (name) {
+		prop->type = HAL_PROP_DEVICE_NAME;
+		prop->len = HAL_MAX_NAME_LENGTH;
+		strncpy((char *) prop->val, name, HAL_MAX_NAME_LENGTH - 1);
+		prop = ((void *) prop) + sizeof(*prop) + HAL_MAX_NAME_LENGTH;
+		num_props++;
+	}
+
+	return num_props;
+}
+
 static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
 					int8_t rssi, bool confirm,
 					const uint8_t *data, uint8_t data_len)
 {
 	bool is_new_dev = false;
+	size_t props_size = 0;
+	size_t buff_size = 0;
+	void *buf;
 	struct eir_data eir;
 	GSList *l;
 	bdaddr_t *remote = NULL;
@@ -433,10 +467,56 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
 		DBG("New device found: %s", addr);
 	}
 
+	props_size += sizeof(struct hal_property) + sizeof(eir.class);
+	props_size += sizeof(struct hal_property) + sizeof(rssi);
+
+	if (eir.name)
+		props_size += sizeof(struct hal_property) + HAL_MAX_NAME_LENGTH;
+
 	if (is_new_dev) {
-		/* TODO: notify device found */
+		struct hal_ev_device_found *ev = NULL;
+		struct hal_property *prop = NULL;
+
+		/* with new device we also send bdaddr prop */
+		props_size += sizeof(struct hal_property) + sizeof(eir.addr);
+
+		buff_size = sizeof(struct hal_ev_device_found) + props_size;
+		buf = g_new0(char, buff_size);
+		ev = buf;
+		prop = ev->props;
+
+		/* fill first prop with bdaddr */
+		prop->type = HAL_PROP_DEVICE_ADDR;
+		prop->len = sizeof(bdaddr_t);
+		bdaddr2android(bdaddr, prop->val);
+		prop = ((void *) prop) + sizeof(*prop) + sizeof(bdaddr_t);
+		ev->num_props += 1;
+
+		/* fill eir, name, and cod props */
+		ev->num_props += fill_device_props(prop, remote, eir.class,
+								rssi, eir.name);
+
+		ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+							HAL_EV_DEVICE_FOUND,
+							buff_size, ev, -1);
+		g_free(buf);
 	} else {
-		/* TODO: notify device state changed */
+		struct hal_ev_remote_device_props *ev = NULL;
+
+		buff_size = sizeof(*ev) + props_size;
+		buf = g_new0(char, buff_size);
+		ev = buf;
+
+		ev->num_props = fill_device_props(ev->props, remote, eir.class,
+								rssi, eir.name);
+
+		ev->status = HAL_STATUS_SUCCESS;
+		bdaddr2android(bdaddr, ev->bdaddr);
+
+		ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+						HAL_EV_REMOTE_DEVICE_PROPS,
+						buff_size, ev, -1);
+		g_free(buf);
 	}
 
 	/* TODO: name confirmation */
-- 
1.8.4.1


^ 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