2012-03-30 14:58:16

by Hemant Gupta

[permalink] [raw]
Subject: [PATCH] Adapter: Fix Discovering state while Powering Off

This patch fixes the adater discovering state while powering off.
Without this fix, BlueZ sends incorrect discovering state to upper
layers while switching off.
---
src/adapter.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index f8f46f8..eb9745f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -289,6 +289,12 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
return err;

adapter->off_requested = TRUE;
+ /*
+ * Change the discovering state to FALSE, otherwise
+ * inquiry fails to start if BT is switched off and then on
+ * while inquiry is already active.
+ */
+ adapter->discovering = FALSE;

goto done;
}
--
1.7.0.4



2012-03-30 14:58:17

by Hemant Gupta

[permalink] [raw]
Subject: RE: [PATCH] Adapter: Fix Discovering state while Powering Off

Hi Johan,

-----Original Message-----
From: Johan Hedberg [mailto:[email protected]]
Sent: Friday, March 30, 2012 8:20 PM
To: Hemant GUPTA
Cc: [email protected]; Naresh-kumar GUPTA; Hemant Gupta
Subject: Re: [PATCH] Adapter: Fix Discovering state while Powering Off

Hi Hemant,

On Fri, Mar 30, 2012, Hemant Gupta wrote:
> This patch fixes the adater discovering state while powering off.
> Without this fix, BlueZ sends incorrect discovering state to upper
> layers while switching off.
> ---
> src/adapter.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c index f8f46f8..76fbe31
> 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -289,6 +289,12 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
> return err;
>
> adapter->off_requested = TRUE;
> + /*
> + * Change the discovering state to FALSE, otherwise
> + * inquiry fails to start if BT is switched off and then on
> + * while inquiry is already active.
> + */
> + adapter->discovering = FALSE;
>
> goto done;
> }

Functionality wise the patch seems fine but you're not following the coding style. We use tabs for indentation whereas your patch uses spaces. Please fix and resend (and configure your editor so that such mistakes do not happen again).

Thanks for the comments, I have fixed the coding style in the new patch, please have a look.

Johan

BR
Hemant

2012-03-30 14:50:25

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] Adapter: Fix Discovering state while Powering Off

Hi Hemant,

On Fri, Mar 30, 2012, Hemant Gupta wrote:
> This patch fixes the adater discovering state while powering off.
> Without this fix, BlueZ sends incorrect discovering state to upper
> layers while switching off.
> ---
> src/adapter.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index f8f46f8..76fbe31 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -289,6 +289,12 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
> return err;
>
> adapter->off_requested = TRUE;
> + /*
> + * Change the discovering state to FALSE, otherwise
> + * inquiry fails to start if BT is switched off and then on
> + * while inquiry is already active.
> + */
> + adapter->discovering = FALSE;
>
> goto done;
> }

Functionality wise the patch seems fine but you're not following the
coding style. We use tabs for indentation whereas your patch uses
spaces. Please fix and resend (and configure your editor so that such
mistakes do not happen again).

Johan