From e509250ea730a771efb5c4ab6a3f47fbe1b1e55d Mon Sep 17 00:00:00 2001 From: "injun.yang" Date: Mon, 21 May 2018 17:32:16 +0900 Subject: [PATCH] Bluetooth: Report RPA changed event 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 Signed-off-by: DoHyun Pyun --- include/net/bluetooth/hci_core.h | 1 + include/net/bluetooth/mgmt_tizen.h | 5 +++++ net/bluetooth/hci_request.c | 3 +++ net/bluetooth/mgmt.c | 13 +++++++++++++ 4 files changed, 22 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 1e180eb..a68d10a 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -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); diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h index 747e65e..7b9b1f0 100644 --- a/include/net/bluetooth/mgmt_tizen.h +++ b/include/net/bluetooth/mgmt_tizen.h @@ -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 */ diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 7ce48ff..0a3c4cd 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -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; } diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index afc9934..4b3a0a7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -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) { -- 2.7.4