Bluetooth: Add LE vendor specific event handler
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 8 Sep 2016 05:26:15 +0000 (10:56 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 29 Apr 2025 03:38:23 +0000 (12:38 +0900)
This patch adds the vendor specific LE meta event handler.
It handles the vendor specific handles like,
LE_MULTI_ADV_STATE_CHANGE_SUB_EVENT, LE_RSSI_LINK_ALERT.

Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
[divide hci vendor speicif group event function]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Icdffedbd004fa25714b52a337039aa6712dccc04

include/net/bluetooth/hci.h
net/bluetooth/hci_event.c

index c0e6666396068a23f0f76208e422ad3a123ba4e0..0f850ad9b3fc207dc26c3a159af07505483a6e57 100644 (file)
@@ -2597,6 +2597,25 @@ struct hci_ev_sync_train_complete {
 
 #define HCI_EV_PERIPHERAL_PAGE_RESP_TIMEOUT    0x54
 
+#ifdef TIZEN_BT
+/*
+ * Vendor Specific HCI Event
+ * Vendor: Broadcom
+ * Purpose: This HCI Event gives RSSI Alerts for monitored LE Link
+ */
+#define HCI_EV_VENDOR_SPECIFIC         0xFF
+struct hci_ev_vendor_specific {
+       __u8    event_sub_code;
+} __packed;
+
+#define LE_META_VENDOR_SPECIFIC_GROUP_EVENT 0xE9
+struct hci_ev_ext_vendor_specific {
+       __u8    event_le_ext_sub_code;
+} __packed;
+
+#define LE_RSSI_LINK_ALERT 0x02
+#endif
+
 #define HCI_EV_LE_CONN_COMPLETE                0x01
 struct hci_ev_le_conn_complete {
        __u8     status;
index a124cd9538dc7daccc1f04dc0d05b6048a203dc9..55f170f9777a50a514a59b1b3f7ab3dece12f48b 100644 (file)
@@ -2203,6 +2203,51 @@ static u8 hci_cc_get_raw_rssi(struct hci_dev *hdev, void *data,
 
        return rp->status;
 }
+
+static void hci_vendor_specific_group_ext_evt(struct hci_dev *hdev,
+                                             struct sk_buff *skb)
+{
+       struct hci_ev_ext_vendor_specific *ev = (void *)skb->data;
+       __u8 event_le_ext_sub_code;
+
+       BT_DBG("RSSI event LE_META_VENDOR_SPECIFIC_GROUP_EVENT: %X",
+              LE_META_VENDOR_SPECIFIC_GROUP_EVENT);
+
+       skb_pull(skb, sizeof(*ev));
+       event_le_ext_sub_code = ev->event_le_ext_sub_code;
+
+       switch (event_le_ext_sub_code) {
+       case LE_RSSI_LINK_ALERT:
+               BT_DBG("RSSI event LE_RSSI_LINK_ALERT %X",
+                      LE_RSSI_LINK_ALERT);
+               mgmt_rssi_alert_evt(hdev, skb);
+               break;
+
+       default:
+               break;
+       }
+}
+
+static void hci_vendor_specific_evt(struct hci_dev *hdev, void *data,
+                                   struct sk_buff *skb)
+{
+       struct hci_ev_vendor_specific *ev = (void *)skb->data;
+       __u8 event_sub_code;
+
+       BT_DBG("hci_vendor_specific_evt");
+
+       skb_pull(skb, sizeof(*ev));
+       event_sub_code = ev->event_sub_code;
+
+       switch (event_sub_code) {
+       case LE_META_VENDOR_SPECIFIC_GROUP_EVENT:
+               hci_vendor_specific_group_ext_evt(hdev, skb);
+               break;
+
+       default:
+               break;
+       }
+}
 #endif
 
 static u8 hci_cc_read_rssi(struct hci_dev *hdev, void *data,
@@ -7456,8 +7501,14 @@ static const struct hci_ev {
        /* [0x3e = HCI_EV_LE_META] */
        HCI_EV_REQ_VL(HCI_EV_LE_META, hci_le_meta_evt,
                      sizeof(struct hci_ev_le_meta), HCI_MAX_EVENT_SIZE),
+#ifdef TIZEN_BT
+       /* [0xFF = HCI_EV_VENDOR_SPECIFIC] */
+       HCI_EV(HCI_EV_VENDOR_SPECIFIC, hci_vendor_specific_evt,
+              sizeof(struct hci_ev_vendor_specific)),
+#else
        /* [0xff = HCI_EV_VENDOR] */
        HCI_EV_VL(HCI_EV_VENDOR, msft_vendor_evt, 0, HCI_MAX_EVENT_SIZE),
+#endif
 };
 
 static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,