aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2011-08-19 20:06:56 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-09-21 11:58:11 -0400
commitcfafccf730d363accacbd165542095ce6f7d2de8 (patch)
treee01d3f94ef6a6ddb80c16f7b59b446c378183569
parent160dc6ac1256ed15a507bec9a2ff1f6d24a5a3ff (diff)
Bluetooth: Add link_type information to the mgmt Connected event
One piece of information that was lost when using the mgmt interface, was the type of the connection. Using HCI events we used to know the type of the connection based on the type of the event, e.g. HCI_LE_Connection_Complete for LE links. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bluetooth/mgmt.h1
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/mgmt.c3
4 files changed, 6 insertions, 4 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 88566f2e0a6f..4b17cd7fb164 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -855,7 +855,7 @@ int mgmt_powered(u16 index, u8 powered);
855int mgmt_discoverable(u16 index, u8 discoverable); 855int mgmt_discoverable(u16 index, u8 discoverable);
856int mgmt_connectable(u16 index, u8 connectable); 856int mgmt_connectable(u16 index, u8 connectable);
857int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); 857int mgmt_new_key(u16 index, struct link_key *key, u8 persistent);
858int mgmt_connected(u16 index, bdaddr_t *bdaddr); 858int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type);
859int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); 859int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
860int mgmt_disconnect_failed(u16 index); 860int mgmt_disconnect_failed(u16 index);
861int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); 861int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 5428fd32ccec..1c914ddc6d7a 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -249,6 +249,7 @@ struct mgmt_ev_new_key {
249#define MGMT_EV_CONNECTED 0x000B 249#define MGMT_EV_CONNECTED 0x000B
250struct mgmt_ev_connected { 250struct mgmt_ev_connected {
251 bdaddr_t bdaddr; 251 bdaddr_t bdaddr;
252 __u8 link_type;
252} __packed; 253} __packed;
253 254
254#define MGMT_EV_DISCONNECTED 0x000C 255#define MGMT_EV_DISCONNECTED 0x000C
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 7ef4eb4435fb..e54d08222605 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1412,7 +1412,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1412 conn->state = BT_CONFIG; 1412 conn->state = BT_CONFIG;
1413 hci_conn_hold(conn); 1413 hci_conn_hold(conn);
1414 conn->disc_timeout = HCI_DISCONN_TIMEOUT; 1414 conn->disc_timeout = HCI_DISCONN_TIMEOUT;
1415 mgmt_connected(hdev->id, &ev->bdaddr); 1415 mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
1416 } else 1416 } else
1417 conn->state = BT_CONNECTED; 1417 conn->state = BT_CONNECTED;
1418 1418
@@ -2816,7 +2816,7 @@ static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff
2816 goto unlock; 2816 goto unlock;
2817 } 2817 }
2818 2818
2819 mgmt_connected(hdev->id, &ev->bdaddr); 2819 mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
2820 2820
2821 conn->sec_level = BT_SECURITY_LOW; 2821 conn->sec_level = BT_SECURITY_LOW;
2822 conn->handle = __le16_to_cpu(ev->handle); 2822 conn->handle = __le16_to_cpu(ev->handle);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1ce8d80ce38d..dac7d39b810b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2012,11 +2012,12 @@ int mgmt_new_key(u16 index, struct link_key *key, u8 persistent)
2012 return err; 2012 return err;
2013} 2013}
2014 2014
2015int mgmt_connected(u16 index, bdaddr_t *bdaddr) 2015int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type)
2016{ 2016{
2017 struct mgmt_ev_connected ev; 2017 struct mgmt_ev_connected ev;
2018 2018
2019 bacpy(&ev.bdaddr, bdaddr); 2019 bacpy(&ev.bdaddr, bdaddr);
2020 ev.link_type = link_type;
2020 2021
2021 return mgmt_event(MGMT_EV_CONNECTED, index, &ev, sizeof(ev), NULL); 2022 return mgmt_event(MGMT_EV_CONNECTED, index, &ev, sizeof(ev), NULL);
2022} 2023}