diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2011-03-30 06:18:12 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-04 17:47:38 -0400 |
commit | a88a9652d25a63ce10b6a5fe680d0ad8f33b9c9b (patch) | |
tree | 57d8fed21320201e302eb40fafab35284b60409d | |
parent | e17acd40f6006d0a0e0b1b3f7359ba4d543011c6 (diff) |
Bluetooth: Add mgmt_remote_name event
This patch adds a new remote_name event to the Management interface
which is sent every time the name of a remote device is resolved (over
BR/EDR).
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 3 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 12 |
4 files changed, 22 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 2a88fc82429b..4093133c1283 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -789,6 +789,7 @@ int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer, | |||
789 | u8 status); | 789 | u8 status); |
790 | int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, | 790 | int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, |
791 | u8 *eir); | 791 | u8 *eir); |
792 | int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); | ||
792 | 793 | ||
793 | /* HCI info for socket */ | 794 | /* HCI info for socket */ |
794 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 795 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 864d0cbd2d57..6b6ff92ab499 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -275,3 +275,9 @@ struct mgmt_ev_device_found { | |||
275 | __s8 rssi; | 275 | __s8 rssi; |
276 | __u8 eir[HCI_MAX_EIR_LENGTH]; | 276 | __u8 eir[HCI_MAX_EIR_LENGTH]; |
277 | } __packed; | 277 | } __packed; |
278 | |||
279 | #define MGMT_EV_REMOTE_NAME 0x0013 | ||
280 | struct mgmt_ev_remote_name { | ||
281 | bdaddr_t bdaddr; | ||
282 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
283 | } __packed; | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d04011c06be0..7a3398d9cd65 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1497,6 +1497,9 @@ static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb | |||
1497 | 1497 | ||
1498 | hci_dev_lock(hdev); | 1498 | hci_dev_lock(hdev); |
1499 | 1499 | ||
1500 | if (ev->status == 0 && test_bit(HCI_MGMT, &hdev->flags)) | ||
1501 | mgmt_remote_name(hdev->id, &ev->bdaddr, ev->name); | ||
1502 | |||
1500 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); | 1503 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); |
1501 | if (conn && hci_outgoing_auth_needed(hdev, conn)) { | 1504 | if (conn && hci_outgoing_auth_needed(hdev, conn)) { |
1502 | struct hci_cp_auth_requested cp; | 1505 | struct hci_cp_auth_requested cp; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 86fb50215485..9a61320c5f2e 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2063,3 +2063,15 @@ int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, | |||
2063 | 2063 | ||
2064 | return mgmt_event(MGMT_EV_DEVICE_FOUND, index, &ev, sizeof(ev), NULL); | 2064 | return mgmt_event(MGMT_EV_DEVICE_FOUND, index, &ev, sizeof(ev), NULL); |
2065 | } | 2065 | } |
2066 | |||
2067 | int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name) | ||
2068 | { | ||
2069 | struct mgmt_ev_remote_name ev; | ||
2070 | |||
2071 | memset(&ev, 0, sizeof(ev)); | ||
2072 | |||
2073 | bacpy(&ev.bdaddr, bdaddr); | ||
2074 | memcpy(ev.name, name, HCI_MAX_NAME_LENGTH); | ||
2075 | |||
2076 | return mgmt_event(MGMT_EV_REMOTE_NAME, index, &ev, sizeof(ev), NULL); | ||
2077 | } | ||