Bluetooth: Add link_type information to the mgmt Connected event
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Sat, 20 Aug 2011 00:06:56 +0000 (21:06 -0300)
committerGustavo F. Padovan <padovan@profusion.mobi>
Wed, 21 Sep 2011 15:58:11 +0000 (12:58 -0300)
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>
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt.h
net/bluetooth/hci_event.c
net/bluetooth/mgmt.c

index 88566f2e0a6fa7c77616bac29676595d7a420e94..4b17cd7fb1648b98d0bcfc0a28521ce14b463082 100644 (file)
@@ -855,7 +855,7 @@ int mgmt_powered(u16 index, u8 powered);
 int mgmt_discoverable(u16 index, u8 discoverable);
 int mgmt_connectable(u16 index, u8 connectable);
 int mgmt_new_key(u16 index, struct link_key *key, u8 persistent);
-int mgmt_connected(u16 index, bdaddr_t *bdaddr);
+int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type);
 int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
 int mgmt_disconnect_failed(u16 index);
 int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
index 5428fd32ccec228a4df03c6be87539bcb2985919..1c914ddc6d7a668ccf9f4aaaad2a73d6742d79fc 100644 (file)
@@ -249,6 +249,7 @@ struct mgmt_ev_new_key {
 #define MGMT_EV_CONNECTED              0x000B
 struct mgmt_ev_connected {
        bdaddr_t bdaddr;
+       __u8 link_type;
 } __packed;
 
 #define MGMT_EV_DISCONNECTED           0x000C
index 7ef4eb4435fb4444585e9e8c6b54ef1effd486a9..e54d08222605a7ce730f9ff4703be5a9beb62036 100644 (file)
@@ -1412,7 +1412,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
                        conn->state = BT_CONFIG;
                        hci_conn_hold(conn);
                        conn->disc_timeout = HCI_DISCONN_TIMEOUT;
-                       mgmt_connected(hdev->id, &ev->bdaddr);
+                       mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
                } else
                        conn->state = BT_CONNECTED;
 
@@ -2816,7 +2816,7 @@ static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff
                goto unlock;
        }
 
-       mgmt_connected(hdev->id, &ev->bdaddr);
+       mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
 
        conn->sec_level = BT_SECURITY_LOW;
        conn->handle = __le16_to_cpu(ev->handle);
index 1ce8d80ce38da8be5a8371462a5c4de08a695d27..dac7d39b810b90c8af539cab8f7fe4fb04ae74cd 100644 (file)
@@ -2012,11 +2012,12 @@ int mgmt_new_key(u16 index, struct link_key *key, u8 persistent)
        return err;
 }
 
-int mgmt_connected(u16 index, bdaddr_t *bdaddr)
+int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type)
 {
        struct mgmt_ev_connected ev;
 
        bacpy(&ev.bdaddr, bdaddr);
+       ev.link_type = link_type;
 
        return mgmt_event(MGMT_EV_CONNECTED, index, &ev, sizeof(ev), NULL);
 }