Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] android: Fix type of discovery on start/stop discovery
@ 2014-03-07 10:28 Lukasz Rymanowski
  2014-03-07 10:28 ` [PATCH 2/2] android: Support LE discovery if adapter supports LE Lukasz Rymanowski
  2014-03-09 14:09 ` [PATCH 1/2] android: Fix type of discovery on start/stop discovery Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Rymanowski @ 2014-03-07 10:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski

Discovering type was confused with adapter settings. With this patch it
is fixed
---
 android/bluetooth.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 1101b64..6d08a50 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2408,14 +2408,13 @@ static void get_adapter_properties(void)
 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;
+	if (adapter.current_settings & MGMT_SETTING_BREDR)
+		cp.type = 1 << BDADDR_BREDR;
 	else
 		cp.type = 0;
 
-	DBG("type=0x%x", type);
+	DBG("type=0x%x", cp.type);
 
 	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
 					sizeof(cp), &cp, NULL, NULL, NULL) > 0)
@@ -2428,14 +2427,13 @@ static bool start_discovery(void)
 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;
+	if (adapter.current_settings & MGMT_SETTING_BREDR)
+		cp.type = 1 << BDADDR_BREDR;
 	else
 		cp.type = 0;
 
-	DBG("type=0x%x", type);
+	DBG("type=0x%x", cp.type);
 
 	if (mgmt_send(mgmt_if, MGMT_OP_STOP_DISCOVERY, adapter.index,
 					sizeof(cp), &cp, NULL, NULL, NULL) > 0)
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] android: Support LE discovery if adapter supports LE
  2014-03-07 10:28 [PATCH 1/2] android: Fix type of discovery on start/stop discovery Lukasz Rymanowski
@ 2014-03-07 10:28 ` Lukasz Rymanowski
  2014-03-09 14:09 ` [PATCH 1/2] android: Fix type of discovery on start/stop discovery Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Rymanowski @ 2014-03-07 10:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski

---
 android/bluetooth.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 6d08a50..c6e40ca 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2414,6 +2414,9 @@ static bool start_discovery(void)
 	else
 		cp.type = 0;
 
+	if (adapter.current_settings & MGMT_SETTING_LE)
+		cp.type |= (1 << BDADDR_LE_PUBLIC) | (1 << BDADDR_LE_RANDOM);
+
 	DBG("type=0x%x", cp.type);
 
 	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
@@ -2433,6 +2436,9 @@ static bool stop_discovery(void)
 	else
 		cp.type = 0;
 
+	if (adapter.current_settings & MGMT_SETTING_LE)
+		cp.type |= (1 << BDADDR_LE_PUBLIC) | (1 << BDADDR_LE_RANDOM);
+
 	DBG("type=0x%x", cp.type);
 
 	if (mgmt_send(mgmt_if, MGMT_OP_STOP_DISCOVERY, adapter.index,
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] android: Fix type of discovery on start/stop discovery
  2014-03-07 10:28 [PATCH 1/2] android: Fix type of discovery on start/stop discovery Lukasz Rymanowski
  2014-03-07 10:28 ` [PATCH 2/2] android: Support LE discovery if adapter supports LE Lukasz Rymanowski
@ 2014-03-09 14:09 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-03-09 14:09 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth

Hi Łukasz,

On Friday 07 of March 2014 11:28:29 Lukasz Rymanowski wrote:
> Discovering type was confused with adapter settings. With this patch it
> is fixed
> ---
>  android/bluetooth.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 1101b64..6d08a50 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -2408,14 +2408,13 @@ static void get_adapter_properties(void)
>  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;
> +	if (adapter.current_settings & MGMT_SETTING_BREDR)
> +		cp.type = 1 << BDADDR_BREDR;
>  	else
>  		cp.type = 0;
> 
> -	DBG("type=0x%x", type);
> +	DBG("type=0x%x", cp.type);
> 
>  	if (mgmt_send(mgmt_if, MGMT_OP_START_DISCOVERY, adapter.index,
>  					sizeof(cp), &cp, NULL, NULL, NULL) > 0)
> @@ -2428,14 +2427,13 @@ static bool start_discovery(void)
>  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;
> +	if (adapter.current_settings & MGMT_SETTING_BREDR)
> +		cp.type = 1 << BDADDR_BREDR;
>  	else
>  		cp.type = 0;
> 
> -	DBG("type=0x%x", type);
> +	DBG("type=0x%x", cp.type);
> 
>  	if (mgmt_send(mgmt_if, MGMT_OP_STOP_DISCOVERY, adapter.index,
>  					sizeof(cp), &cp, NULL, NULL, NULL) > 0)

Both patches applied. Thanks.

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-09 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 10:28 [PATCH 1/2] android: Fix type of discovery on start/stop discovery Lukasz Rymanowski
2014-03-07 10:28 ` [PATCH 2/2] android: Support LE discovery if adapter supports LE Lukasz Rymanowski
2014-03-09 14:09 ` [PATCH 1/2] android: Fix type of discovery on start/stop discovery Szymon Janc

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