2014-08-20 08:10:23

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 1/2] android/bluetooth: Fix bdaddr_type in pairing scenario

With this patch correct bdaddr type is used in ssp pairing scenario
---
android/bluetooth.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 64a7696..59dd047 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -4500,11 +4500,13 @@ static void handle_ssp_reply_cmd(const void *buf, uint16_t len)
switch (cmd->ssp_variant) {
case HAL_SSP_VARIANT_CONFIRM:
case HAL_SSP_VARIANT_CONSENT:
- status = user_confirm_reply(&dev->bdaddr, dev->bdaddr_type,
- cmd->accept);
+ status = user_confirm_reply(&dev->bdaddr,
+ select_device_bearer(dev),
+ cmd->accept);
break;
case HAL_SSP_VARIANT_ENTRY:
- status = user_passkey_reply(&dev->bdaddr, dev->bdaddr_type,
+ status = user_passkey_reply(&dev->bdaddr,
+ select_device_bearer(dev),
cmd->accept, cmd->passkey);
break;
case HAL_SSP_VARIANT_NOTIF:
--
1.8.4



2014-08-20 10:02:58

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/bluetooth: Fix bdaddr_type in pairing scenario

Hi Ɓukasz,

On Wednesday 20 of August 2014 10:10:23 Lukasz Rymanowski wrote:
> With this patch correct bdaddr type is used in ssp pairing scenario
> ---
> android/bluetooth.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 64a7696..59dd047 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -4500,11 +4500,13 @@ static void handle_ssp_reply_cmd(const void *buf,
> uint16_t len) switch (cmd->ssp_variant) {
> case HAL_SSP_VARIANT_CONFIRM:
> case HAL_SSP_VARIANT_CONSENT:
> - status = user_confirm_reply(&dev->bdaddr, dev->bdaddr_type,
> - cmd->accept);
> + status = user_confirm_reply(&dev->bdaddr,
> + select_device_bearer(dev),
> + cmd->accept);
> break;
> case HAL_SSP_VARIANT_ENTRY:
> - status = user_passkey_reply(&dev->bdaddr, dev->bdaddr_type,
> + status = user_passkey_reply(&dev->bdaddr,
> + select_device_bearer(dev),
> cmd->accept, cmd->passkey);
> break;
> case HAL_SSP_VARIANT_NOTIF:

Both patches applied, thanks.

--
BR
Szymon Janc

2014-08-20 08:10:24

by Lukasz Rymanowski

[permalink] [raw]
Subject: [PATCH 2/2] android/bluetooth: Add debug log to select_device_bearer

This patch refactor a bit select_device_bearer function so we can get
debug log out of it. This log might be very useful in dual mode devices
scenarios
---
android/bluetooth.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 59dd047..20f2c8c 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -4216,14 +4216,21 @@ static void pair_device_complete(uint8_t status, uint16_t length,

static uint8_t select_device_bearer(struct device *dev)
{
+ uint8_t res;
+
if (dev->bredr && dev->le) {
if (dev->le_seen > dev->bredr_seen)
- return dev->bdaddr_type;
+ res = dev->bdaddr_type;
+ else
+ res = BDADDR_BREDR;

- return BDADDR_BREDR;
+ } else {
+ res = dev->bredr ? BDADDR_BREDR : dev->bdaddr_type;
}

- return dev->bredr ? BDADDR_BREDR : dev->bdaddr_type;
+ DBG("Selected bearer %d", res);
+
+ return res;
}

uint8_t bt_device_last_seen_bearer(const bdaddr_t *bdaddr)
--
1.8.4