Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vinicius Costa Gomes and committed by
Gustavo F. Padovan
cfafccf7 160dc6ac

+6 -4
+1 -1
include/net/bluetooth/hci_core.h
··· 855 855 int mgmt_discoverable(u16 index, u8 discoverable); 856 856 int mgmt_connectable(u16 index, u8 connectable); 857 857 int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); 858 - int mgmt_connected(u16 index, bdaddr_t *bdaddr); 858 + int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type); 859 859 int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); 860 860 int mgmt_disconnect_failed(u16 index); 861 861 int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
+1
include/net/bluetooth/mgmt.h
··· 249 249 #define MGMT_EV_CONNECTED 0x000B 250 250 struct mgmt_ev_connected { 251 251 bdaddr_t bdaddr; 252 + __u8 link_type; 252 253 } __packed; 253 254 254 255 #define MGMT_EV_DISCONNECTED 0x000C
+2 -2
net/bluetooth/hci_event.c
··· 1412 1412 conn->state = BT_CONFIG; 1413 1413 hci_conn_hold(conn); 1414 1414 conn->disc_timeout = HCI_DISCONN_TIMEOUT; 1415 - mgmt_connected(hdev->id, &ev->bdaddr); 1415 + mgmt_connected(hdev->id, &ev->bdaddr, conn->type); 1416 1416 } else 1417 1417 conn->state = BT_CONNECTED; 1418 1418 ··· 2816 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 2821 conn->sec_level = BT_SECURITY_LOW; 2822 2822 conn->handle = __le16_to_cpu(ev->handle);
+2 -1
net/bluetooth/mgmt.c
··· 2012 2012 return err; 2013 2013 } 2014 2014 2015 - int mgmt_connected(u16 index, bdaddr_t *bdaddr) 2015 + int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type) 2016 2016 { 2017 2017 struct mgmt_ev_connected ev; 2018 2018 2019 2019 bacpy(&ev.bdaddr, bdaddr); 2020 + ev.link_type = link_type; 2020 2021 2021 2022 return mgmt_event(MGMT_EV_CONNECTED, index, &ev, sizeof(ev), NULL); 2022 2023 }