From 5ec824d5005c4572de3694b1e1b28d189d4c4c4b 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 | 12 ++++++++++++ 4 files changed, 21 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 3bc674f0873d..a6c799a61898 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1590,6 +1590,7 @@ void mgmt_le_data_length_change_complete(struct hci_dev *hdev, u16 rx_octets, u16 rx_time); int hci_le_set_data_length(struct hci_conn *conn, u16 tx_octets, u16 tx_time); int hci_conn_streaming_mode(struct hci_conn *conn, bool streaming_mode); +void mgmt_rpa_updated_evt(struct hci_dev *hdev, bdaddr_t *rpa); #endif u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency, diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h index 066985a2b1fb..3a5eeaa31f34 100644 --- a/include/net/bluetooth/mgmt_tizen.h +++ b/include/net/bluetooth/mgmt_tizen.h @@ -339,4 +339,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 /* __MGMT_TIZEN_H */ diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index d6025d6e6d59..fd6389e1a229 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -356,6 +356,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 460c9a4be9d3..b2e79d6f98ad 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -7810,6 +7810,18 @@ void mgmt_le_data_length_change_complete(struct hci_dev *hdev, mgmt_event(MGMT_EV_LE_DATA_LENGTH_CHANGED, hdev, &ev, sizeof(ev), NULL); } +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 set_irk(struct sock *sk, struct hci_dev *hdev, void *cp_data, u16 len) { -- 2.34.1