summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSudha Bheemanna <b.sudha@samsung.com>2016-08-25 10:17:19 +0530
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:53:07 +0900
commit12867e37edd1d2f33f648cbb32ba9552f9790961 (patch)
tree730c0fe1e9e3f756d0ef2d3f90bc5dec41b79021 /net
parent75006bd7d6f8e54097b91651abace6e9925cddb2 (diff)
Bluetooth: Update device name on remote_name_event
This patch updates the device name on receiving the HCI event remote_name_event during connection establishment. Change-Id: I9a217e6760b1803a70af201a3f6903e722079749 Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_event.c10
-rw-r--r--net/bluetooth/mgmt.c24
2 files changed, 34 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 987b9db6f958..24d6845cd76f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1717,15 +1717,25 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
struct discovery_state *discov = &hdev->discovery;
struct inquiry_entry *e;
+#ifdef TIZEN_BT
/* Update the mgmt connected state if necessary. Be careful with
* conn objects that exist but are not (yet) connected however.
* Only those in BT_CONFIG or BT_CONNECTED states can be
* considered connected.
*/
if (conn &&
+ (conn->state == BT_CONFIG || conn->state == BT_CONNECTED)) {
+ if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
+ mgmt_device_connected(hdev, conn, 0, name, name_len);
+ else
+ mgmt_device_name_update(hdev, bdaddr, name, name_len);
+ }
+#else
+ if (conn &&
(conn->state == BT_CONFIG || conn->state == BT_CONNECTED) &&
!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_connected(hdev, conn, 0, name, name_len);
+#endif
if (discov->state == DISCOVERY_STOPPED)
return;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 28da6d31f80d..c97ef3317e6c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7634,6 +7634,30 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
return eir_len;
}
+#ifdef TIZEN_BT
+int mgmt_device_name_update(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name,
+ u8 name_len)
+{
+ char buf[512];
+ struct mgmt_ev_device_name_update *ev = (void *)buf;
+ u16 eir_len = 0;
+
+ if (name_len <= 0)
+ return -EINVAL;
+
+ bacpy(&ev->addr.bdaddr, bdaddr);
+ ev->addr.type = BDADDR_BREDR;
+
+ eir_len = eir_append_data(ev->eir, 0, EIR_NAME_COMPLETE, name,
+ name_len);
+
+ ev->eir_len = cpu_to_le16(eir_len);
+
+ return mgmt_event(MGMT_EV_DEVICE_NAME_UPDATE, hdev, buf,
+ sizeof(*ev) + eir_len, NULL);
+}
+#endif
+
static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
u16 opcode, struct sk_buff *skb)
{