Bluetooth: Report RPA changed event
authorinjun.yang <injun.yang@samsung.com>
Mon, 21 May 2018 08:32:16 +0000 (17:32 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 27 Feb 2019 02:13:11 +0000 (11:13 +0900)
When RPA changed, The updated RPA is not applied on
VSC advertising. This patchset generates new event
and resolves the problem.

Change-Id: Icc3dd74da0449cb8e456c27bc34995f43326efe1
Signed-off-by: injun.yang <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt_tizen.h
net/bluetooth/hci_request.c
net/bluetooth/mgmt.c

index 1e180eb..a68d10a 100644 (file)
@@ -1746,6 +1746,7 @@ int mgmt_le_conn_updated(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
                u16 supervision_timeout);
 int mgmt_le_conn_update_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
                u8 link_type, u8 addr_type, u8 status);
+void mgmt_rpa_updated_evt(struct hci_dev *hdev, bdaddr_t *rpa);
 #endif
 bool mgmt_get_connectable(struct hci_dev *hdev);
 void mgmt_set_connectable_complete(struct hci_dev *hdev, u8 status);
index 747e65e..7b9b1f0 100644 (file)
@@ -313,4 +313,9 @@ struct mgmt_ev_le_data_length_changed {
        __le16 max_rx_time;
 } __packed;
 
+#define MGMT_EV_RPA_CHANGED                    (TIZEN_EV_BASE + 0x0e)
+struct mgmt_ev_rpa_changed {
+       bdaddr_t bdaddr;
+} __packed;
+
 #endif   /* CONFIG_TIZEN_WIP */
index 7ce48ff..0a3c4cd 100644 (file)
@@ -1440,6 +1440,9 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
                to = msecs_to_jiffies(hdev->rpa_timeout * 1000);
                queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to);
 
+#ifdef CONFIG_TIZEN_WIP
+               mgmt_rpa_updated_evt(hdev, &hdev->rpa);
+#endif
                return 0;
        }
 
index afc9934..4b3a0a7 100644 (file)
@@ -4684,6 +4684,19 @@ done:
        hci_dev_unlock(hdev);
        return err;
 }
+
+void mgmt_rpa_updated_evt(struct hci_dev *hdev, bdaddr_t *rpa)
+{
+       struct mgmt_ev_rpa_changed mgmt_ev;
+
+       BT_DBG("RPA updated");
+
+       bacpy(&mgmt_ev.bdaddr, rpa);
+
+       mgmt_event(MGMT_EV_RPA_CHANGED, hdev, &mgmt_ev,
+                               sizeof(struct mgmt_ev_rpa_changed), NULL);
+}
+
 static int connect_bt_6lowpan(struct sock *sk, struct hci_dev *hdev,
                        void *data, u16 len)
 {