All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd
@ 2010-08-23 19:30 Anderson Briglia
  2010-08-23 19:30 ` [PATCH 2/2] Bluetooth: Implement LE Set Scan " Anderson Briglia
  2010-09-08 21:43 ` [PATCH 1/2] Bluetooth: Implement LE Set Advertise " Gustavo F. Padovan
  0 siblings, 2 replies; 7+ messages in thread
From: Anderson Briglia @ 2010-08-23 19:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

This patch implements LE Set Advertise Enable command for dual mode and
Low Energy hci controllers. It also adds new HCI flags in order to
indicate the Advertising state for userland applications and kernel
itself.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
---
 include/net/bluetooth/hci.h |    6 ++++++
 net/bluetooth/hci_event.c   |   27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index bcbdd6d..cae1816 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -76,6 +76,7 @@ enum {
 	HCI_INQUIRY,
 
 	HCI_RAW,
+	HCI_LE_ADV,
 };
 
 /* HCI ioctl defines */
@@ -593,6 +594,11 @@ struct hci_rp_read_bd_addr {
 	bdaddr_t bdaddr;
 } __packed;
 
+/* --- HCI LE Commands --- */
+#define HCI_OP_LE_SET_ADVERTISE_ENABLE	0x200a
+	#define ADVERTISE_ENABLED	0x01
+	#define ADVERTISE_DISABLED	0x00
+
 /* ---- HCI Events ---- */
 #define HCI_EV_INQUIRY_COMPLETE		0x01
 
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index bfef5ba..c86c655 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -822,6 +822,29 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
 	hci_dev_unlock(hdev);
 }
 
+static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
+{
+	__u8 status = *((__u8 *) skb->data);
+	void *sent;
+
+	BT_DBG("%s status 0x%x", hdev->name, status);
+
+	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADVERTISE_ENABLE);
+	if (!sent)
+		return;
+
+	if (!status) {
+		__u8 param = *((__u8 *) sent);
+
+		clear_bit(HCI_LE_ADV, &hdev->flags);
+
+		if (param & ADVERTISE_ENABLED)
+			set_bit(HCI_LE_ADV, &hdev->flags);
+	}
+
+	hci_req_complete(hdev, status);
+}
+
 static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	__u8 status = *((__u8 *) skb->data);
@@ -1310,6 +1333,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
 		hci_cc_read_bd_addr(hdev, skb);
 		break;
 
+	case HCI_OP_LE_SET_ADVERTISE_ENABLE:
+		hci_cc_le_set_advertise(hdev, skb);
+		break;
+
 	default:
 		BT_DBG("%s opcode 0x%x", hdev->name, opcode);
 		break;
-- 
1.7.0.4


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

* [PATCH 2/2] Bluetooth: Implement LE Set Scan Enable cmd
  2010-08-23 19:30 [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd Anderson Briglia
@ 2010-08-23 19:30 ` Anderson Briglia
  2010-09-08 22:05   ` Gustavo F. Padovan
  2010-09-08 21:43 ` [PATCH 1/2] Bluetooth: Implement LE Set Advertise " Gustavo F. Padovan
  1 sibling, 1 reply; 7+ messages in thread
From: Anderson Briglia @ 2010-08-23 19:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

This patch implements LE Set Scan Enable command for dual
mode and Low Energy hci controllers. It also adds new HCI flags
in order to indicate the LE Scanning state for userland applications
and kernel itself.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
---
 include/net/bluetooth/hci.h |    5 +++++
 net/bluetooth/hci_event.c   |   25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index cae1816..268aa94 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -77,6 +77,7 @@ enum {
 
 	HCI_RAW,
 	HCI_LE_ADV,
+	HCI_LE_SCAN,
 };
 
 /* HCI ioctl defines */
@@ -599,6 +600,10 @@ struct hci_rp_read_bd_addr {
 	#define ADVERTISE_ENABLED	0x01
 	#define ADVERTISE_DISABLED	0x00
 
+#define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
+	#define LESCAN_ENABLED		0x01
+	#define LESCAN_DISABLED		0x00
+
 /* ---- HCI Events ---- */
 #define HCI_EV_INQUIRY_COMPLETE		0x01
 
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index c86c655..f483801 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -845,6 +845,27 @@ static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
 	hci_req_complete(hdev, status);
 }
 
+static void hci_cc_le_set_scan(struct hci_dev *hdev, struct sk_buff *skb)
+{
+	__u8 status = *((__u8 *) skb->data);
+	void *sent;
+
+	BT_DBG("%s status 0x%x", hdev->name, status);
+
+	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE);
+	if (!sent)
+		return;
+
+	clear_bit(HCI_LE_SCAN, &hdev->flags);
+	if (!status) {
+		__u8 param = *((__u8 *) sent);
+		if (param & LESCAN_ENABLED)
+			set_bit(HCI_LE_SCAN, &hdev->flags);
+	}
+
+	hci_req_complete(hdev, status);
+}
+
 static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	__u8 status = *((__u8 *) skb->data);
@@ -1337,6 +1358,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
 		hci_cc_le_set_advertise(hdev, skb);
 		break;
 
+	case HCI_OP_LE_SET_SCAN_ENABLE:
+		hci_cc_le_set_scan(hdev, skb);
+		break;
+
 	default:
 		BT_DBG("%s opcode 0x%x", hdev->name, opcode);
 		break;
-- 
1.7.0.4


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

* Re: [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd
  2010-08-23 19:30 [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd Anderson Briglia
  2010-08-23 19:30 ` [PATCH 2/2] Bluetooth: Implement LE Set Scan " Anderson Briglia
@ 2010-09-08 21:43 ` Gustavo F. Padovan
  2010-09-08 22:06   ` Gustavo F. Padovan
  2010-09-09 19:48   ` Anderson Briglia
  1 sibling, 2 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-09-08 21:43 UTC (permalink / raw)
  To: Anderson Briglia; +Cc: linux-bluetooth

Hi Anderson,

* Anderson Briglia <anderson.briglia@openbossa.org> [2010-08-23 15:30:14 -0400]:

> This patch implements LE Set Advertise Enable command for dual mode and
> Low Energy hci controllers. It also adds new HCI flags in order to
> indicate the Advertising state for userland applications and kernel
> itself.
> 
> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> ---
>  include/net/bluetooth/hci.h |    6 ++++++
>  net/bluetooth/hci_event.c   |   27 +++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index bcbdd6d..cae1816 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -76,6 +76,7 @@ enum {
>  	HCI_INQUIRY,
>  
>  	HCI_RAW,

Skip a line here and then add the new LE commands

> +	HCI_LE_ADV,
>  };
>  
>  /* HCI ioctl defines */
> @@ -593,6 +594,11 @@ struct hci_rp_read_bd_addr {
>  	bdaddr_t bdaddr;
>  } __packed;
>  
> +/* --- HCI LE Commands --- */
> +#define HCI_OP_LE_SET_ADVERTISE_ENABLE	0x200a
> +	#define ADVERTISE_ENABLED	0x01
> +	#define ADVERTISE_DISABLED	0x00
> +
>  /* ---- HCI Events ---- */
>  #define HCI_EV_INQUIRY_COMPLETE		0x01
>  
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index bfef5ba..c86c655 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -822,6 +822,29 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
>  	hci_dev_unlock(hdev);
>  }
>  
> +static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
> +{
> +	__u8 status = *((__u8 *) skb->data);
> +	void *sent;
> +
> +	BT_DBG("%s status 0x%x", hdev->name, status);
> +
> +	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADVERTISE_ENABLE);
> +	if (!sent)
> +		return;
> +
> +	if (!status) {
> +		__u8 param = *((__u8 *) sent);
> +
> +		clear_bit(HCI_LE_ADV, &hdev->flags);
> +
> +		if (param & ADVERTISE_ENABLED)
> +			set_bit(HCI_LE_ADV, &hdev->flags);

We could do that this way:

		if (param == ADVERTISE_ENABLED)
			set_bit(HCI_LE_ADV, &hdev->flags);
		else
			clear_bit(HCI_LE_ADV, &hdev->flags);

> --
> 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

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

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

* Re: [PATCH 2/2] Bluetooth: Implement LE Set Scan Enable cmd
  2010-08-23 19:30 ` [PATCH 2/2] Bluetooth: Implement LE Set Scan " Anderson Briglia
@ 2010-09-08 22:05   ` Gustavo F. Padovan
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-09-08 22:05 UTC (permalink / raw)
  To: Anderson Briglia; +Cc: linux-bluetooth

Hi Anderson,

* Anderson Briglia <anderson.briglia@openbossa.org> [2010-08-23 15:30:15 -0400]:

> This patch implements LE Set Scan Enable command for dual
> mode and Low Energy hci controllers. It also adds new HCI flags
> in order to indicate the LE Scanning state for userland applications
> and kernel itself.
> 
> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> ---
>  include/net/bluetooth/hci.h |    5 +++++
>  net/bluetooth/hci_event.c   |   25 +++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index cae1816..268aa94 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -77,6 +77,7 @@ enum {
>  
>  	HCI_RAW,
>  	HCI_LE_ADV,
> +	HCI_LE_SCAN,
>  };
>  
>  /* HCI ioctl defines */
> @@ -599,6 +600,10 @@ struct hci_rp_read_bd_addr {
>  	#define ADVERTISE_ENABLED	0x01
>  	#define ADVERTISE_DISABLED	0x00
>  
> +#define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
> +	#define LESCAN_ENABLED		0x01
> +	#define LESCAN_DISABLED		0x00

Make these LE_SCAN_ENABLED and LE_SCAN_DISABLED.

>  /* ---- HCI Events ---- */
>  #define HCI_EV_INQUIRY_COMPLETE		0x01
>  
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index c86c655..f483801 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -845,6 +845,27 @@ static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
>  	hci_req_complete(hdev, status);
>  }
>  
> +static void hci_cc_le_set_scan(struct hci_dev *hdev, struct sk_buff *skb)
> +{
> +	__u8 status = *((__u8 *) skb->data);
> +	void *sent;
> +
> +	BT_DBG("%s status 0x%x", hdev->name, status);
> +
> +	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE);
> +	if (!sent)
> +		return;
> +
> +	clear_bit(HCI_LE_SCAN, &hdev->flags);

Why do you have this clear_bit() outside of the if below? if
status != 0, i.e, the command has failed we can say for sure that
scanning is disabled.

> +	if (!status) {
> +		__u8 param = *((__u8 *) sent);
> +		if (param & LESCAN_ENABLED)
> +			set_bit(HCI_LE_SCAN, &hdev->flags);
> +	}
> +
> +	hci_req_complete(hdev, status);

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

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

* Re: [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd
  2010-09-08 21:43 ` [PATCH 1/2] Bluetooth: Implement LE Set Advertise " Gustavo F. Padovan
@ 2010-09-08 22:06   ` Gustavo F. Padovan
  2010-09-09 19:48   ` Anderson Briglia
  1 sibling, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-09-08 22:06 UTC (permalink / raw)
  To: Anderson Briglia; +Cc: linux-bluetooth

* Gustavo F. Padovan <padovan@profusion.mobi> [2010-09-08 18:43:59 -0300]:

> Hi Anderson,
> 
> * Anderson Briglia <anderson.briglia@openbossa.org> [2010-08-23 15:30:14 -0400]:
> 
> > This patch implements LE Set Advertise Enable command for dual mode and
> > Low Energy hci controllers. It also adds new HCI flags in order to
> > indicate the Advertising state for userland applications and kernel
> > itself.
> > 
> > Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> > ---
> >  include/net/bluetooth/hci.h |    6 ++++++
> >  net/bluetooth/hci_event.c   |   27 +++++++++++++++++++++++++++
> >  2 files changed, 33 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index bcbdd6d..cae1816 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -76,6 +76,7 @@ enum {
> >  	HCI_INQUIRY,
> >  
> >  	HCI_RAW,
> 
> Skip a line here and then add the new LE commands
> 
> > +	HCI_LE_ADV,
> >  };
> >  
> >  /* HCI ioctl defines */
> > @@ -593,6 +594,11 @@ struct hci_rp_read_bd_addr {
> >  	bdaddr_t bdaddr;
> >  } __packed;
> >  
> > +/* --- HCI LE Commands --- */
> > +#define HCI_OP_LE_SET_ADVERTISE_ENABLE	0x200a
> > +	#define ADVERTISE_ENABLED	0x01
> > +	#define ADVERTISE_DISABLED	0x00

And make these LE_ADVERTISE...

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

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

* Re: [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd
  2010-09-08 21:43 ` [PATCH 1/2] Bluetooth: Implement LE Set Advertise " Gustavo F. Padovan
  2010-09-08 22:06   ` Gustavo F. Padovan
@ 2010-09-09 19:48   ` Anderson Briglia
  2010-09-09 20:31     ` Gustavo F. Padovan
  1 sibling, 1 reply; 7+ messages in thread
From: Anderson Briglia @ 2010-09-09 19:48 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth

On 09/08/2010 05:43 PM, Gustavo F. Padovan wrote:
> Hi Anderson,
>
> * Anderson Briglia<anderson.briglia@openbossa.org>  [2010-08-23 15:30:14 -0400]:
>
>    
>> This patch implements LE Set Advertise Enable command for dual mode and
>> Low Energy hci controllers. It also adds new HCI flags in order to
>> indicate the Advertising state for userland applications and kernel
>> itself.
>>
>> Signed-off-by: Anderson Briglia<anderson.briglia@openbossa.org>
>> ---
>>   include/net/bluetooth/hci.h |    6 ++++++
>>   net/bluetooth/hci_event.c   |   27 +++++++++++++++++++++++++++
>>   2 files changed, 33 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
>> index bcbdd6d..cae1816 100644
>> --- a/include/net/bluetooth/hci.h
>> +++ b/include/net/bluetooth/hci.h
>> @@ -76,6 +76,7 @@ enum {
>>   	HCI_INQUIRY,
>>
>>   	HCI_RAW,
>>      
> Skip a line here and then add the new LE commands
>
>    
>> +	HCI_LE_ADV,
>>   };
>>
>>   /* HCI ioctl defines */
>> @@ -593,6 +594,11 @@ struct hci_rp_read_bd_addr {
>>   	bdaddr_t bdaddr;
>>   } __packed;
>>
>> +/* --- HCI LE Commands --- */
>> +#define HCI_OP_LE_SET_ADVERTISE_ENABLE	0x200a
>> +	#define ADVERTISE_ENABLED	0x01
>> +	#define ADVERTISE_DISABLED	0x00
>> +
>>   /* ---- HCI Events ---- */
>>   #define HCI_EV_INQUIRY_COMPLETE		0x01
>>
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index bfef5ba..c86c655 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -822,6 +822,29 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
>>   	hci_dev_unlock(hdev);
>>   }
>>
>> +static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
>> +{
>> +	__u8 status = *((__u8 *) skb->data);
>> +	void *sent;
>> +
>> +	BT_DBG("%s status 0x%x", hdev->name, status);
>> +
>> +	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADVERTISE_ENABLE);
>> +	if (!sent)
>> +		return;
>> +
>> +	if (!status) {
>> +		__u8 param = *((__u8 *) sent);
>> +
>> +		clear_bit(HCI_LE_ADV,&hdev->flags);
>> +
>> +		if (param&  ADVERTISE_ENABLED)
>> +			set_bit(HCI_LE_ADV,&hdev->flags);
>>      
> We could do that this way:
>
> 		if (param == ADVERTISE_ENABLED)
> 			set_bit(HCI_LE_ADV,&hdev->flags);
> 		else
> 			clear_bit(HCI_LE_ADV,&hdev->flags);
>    

Actually I just followed the design implemented on previous functions.. 
If you check this file you could note this.

>    
>> --
>> 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	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd
  2010-09-09 19:48   ` Anderson Briglia
@ 2010-09-09 20:31     ` Gustavo F. Padovan
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-09-09 20:31 UTC (permalink / raw)
  To: Anderson Briglia; +Cc: linux-bluetooth

* Anderson Briglia <anderson.briglia@openbossa.org> [2010-09-09 15:48:21 -0400]:

> On 09/08/2010 05:43 PM, Gustavo F. Padovan wrote:
> > Hi Anderson,
> >
> > * Anderson Briglia<anderson.briglia@openbossa.org>  [2010-08-23 15:30:14 -0400]:
> >
> >    
> >> This patch implements LE Set Advertise Enable command for dual mode and
> >> Low Energy hci controllers. It also adds new HCI flags in order to
> >> indicate the Advertising state for userland applications and kernel
> >> itself.
> >>
> >> Signed-off-by: Anderson Briglia<anderson.briglia@openbossa.org>
> >> ---
> >>   include/net/bluetooth/hci.h |    6 ++++++
> >>   net/bluetooth/hci_event.c   |   27 +++++++++++++++++++++++++++
> >>   2 files changed, 33 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> >> index bcbdd6d..cae1816 100644
> >> --- a/include/net/bluetooth/hci.h
> >> +++ b/include/net/bluetooth/hci.h
> >> @@ -76,6 +76,7 @@ enum {
> >>   	HCI_INQUIRY,
> >>
> >>   	HCI_RAW,
> >>      
> > Skip a line here and then add the new LE commands
> >
> >    
> >> +	HCI_LE_ADV,
> >>   };
> >>
> >>   /* HCI ioctl defines */
> >> @@ -593,6 +594,11 @@ struct hci_rp_read_bd_addr {
> >>   	bdaddr_t bdaddr;
> >>   } __packed;
> >>
> >> +/* --- HCI LE Commands --- */
> >> +#define HCI_OP_LE_SET_ADVERTISE_ENABLE	0x200a
> >> +	#define ADVERTISE_ENABLED	0x01
> >> +	#define ADVERTISE_DISABLED	0x00
> >> +
> >>   /* ---- HCI Events ---- */
> >>   #define HCI_EV_INQUIRY_COMPLETE		0x01
> >>
> >> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> >> index bfef5ba..c86c655 100644
> >> --- a/net/bluetooth/hci_event.c
> >> +++ b/net/bluetooth/hci_event.c
> >> @@ -822,6 +822,29 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
> >>   	hci_dev_unlock(hdev);
> >>   }
> >>
> >> +static void hci_cc_le_set_advertise(struct hci_dev *hdev, struct sk_buff *skb)
> >> +{
> >> +	__u8 status = *((__u8 *) skb->data);
> >> +	void *sent;
> >> +
> >> +	BT_DBG("%s status 0x%x", hdev->name, status);
> >> +
> >> +	sent = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADVERTISE_ENABLE);
> >> +	if (!sent)
> >> +		return;
> >> +
> >> +	if (!status) {
> >> +		__u8 param = *((__u8 *) sent);
> >> +
> >> +		clear_bit(HCI_LE_ADV,&hdev->flags);
> >> +
> >> +		if (param&  ADVERTISE_ENABLED)
> >> +			set_bit(HCI_LE_ADV,&hdev->flags);
> >>      
> > We could do that this way:
> >
> > 		if (param == ADVERTISE_ENABLED)
> > 			set_bit(HCI_LE_ADV,&hdev->flags);
> > 		else
> > 			clear_bit(HCI_LE_ADV,&hdev->flags);
> >    
> 
> Actually I just followed the design implemented on previous functions.. 
> If you check this file you could note this.

Actually not, the standard there is using if..else. Only
hci_cc_write_scan_enable() does clear_bit() if() set_bit().

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

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

end of thread, other threads:[~2010-09-09 20:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 19:30 [PATCH 1/2] Bluetooth: Implement LE Set Advertise Enable cmd Anderson Briglia
2010-08-23 19:30 ` [PATCH 2/2] Bluetooth: Implement LE Set Scan " Anderson Briglia
2010-09-08 22:05   ` Gustavo F. Padovan
2010-09-08 21:43 ` [PATCH 1/2] Bluetooth: Implement LE Set Advertise " Gustavo F. Padovan
2010-09-08 22:06   ` Gustavo F. Padovan
2010-09-09 19:48   ` Anderson Briglia
2010-09-09 20:31     ` Gustavo F. Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.