* [PATCH v2] Bluetooth: Implement LE Set Advertise Enable cmd
@ 2010-08-19 15:42 Anderson Briglia
2010-08-20 10:31 ` Ville Tervo
0 siblings, 1 reply; 2+ messages in thread
From: Anderson Briglia @ 2010-08-19 15:42 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] 2+ messages in thread* Re: [PATCH v2] Bluetooth: Implement LE Set Advertise Enable cmd
2010-08-19 15:42 [PATCH v2] Bluetooth: Implement LE Set Advertise Enable cmd Anderson Briglia
@ 2010-08-20 10:31 ` Ville Tervo
0 siblings, 0 replies; 2+ messages in thread
From: Ville Tervo @ 2010-08-20 10:31 UTC (permalink / raw)
To: ext Anderson Briglia; +Cc: linux-bluetooth@vger.kernel.org
Hi,
On Thu, Aug 19, 2010 at 05:42:38PM +0200, ext Anderson Briglia wrote:
> 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(-)
Patch looks good to me, but I don't have working hardware to verify it currently.
--
Ville
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-20 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 15:42 [PATCH v2] Bluetooth: Implement LE Set Advertise Enable cmd Anderson Briglia
2010-08-20 10:31 ` Ville Tervo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox