aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-09-06 11:39:26 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-09-18 21:27:29 -0400
commit92a25256f142d55e25f9959441cea6ddeabae57e (patch)
treeeb276a7076d59e7d29f14139b3993d441c3ea0fd /net/bluetooth/mgmt.c
parent5ad777958621524b48d1bdf4aaf3b26a363d4553 (diff)
Bluetooth: mgmt: Implement support for passkey notification
This patch adds support for Secure Simple Pairing with devices that have KeyboardOnly as their IO capability. Such devices will cause a passkey notification on our side and optionally also keypress notifications. Without this patch some keyboards cannot be paired using the mgmt interface. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05d4b83a0189..8e1ab59a9cef 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -99,6 +99,7 @@ static const u16 mgmt_events[] = {
99 MGMT_EV_DEVICE_BLOCKED, 99 MGMT_EV_DEVICE_BLOCKED,
100 MGMT_EV_DEVICE_UNBLOCKED, 100 MGMT_EV_DEVICE_UNBLOCKED,
101 MGMT_EV_DEVICE_UNPAIRED, 101 MGMT_EV_DEVICE_UNPAIRED,
102 MGMT_EV_PASSKEY_NOTIFY,
102}; 103};
103 104
104/* 105/*
@@ -3276,6 +3277,22 @@ int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
3276 MGMT_OP_USER_PASSKEY_NEG_REPLY); 3277 MGMT_OP_USER_PASSKEY_NEG_REPLY);
3277} 3278}
3278 3279
3280int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
3281 u8 link_type, u8 addr_type, u32 passkey,
3282 u8 entered)
3283{
3284 struct mgmt_ev_passkey_notify ev;
3285
3286 BT_DBG("%s", hdev->name);
3287
3288 bacpy(&ev.addr.bdaddr, bdaddr);
3289 ev.addr.type = link_to_bdaddr(link_type, addr_type);
3290 ev.passkey = __cpu_to_le32(passkey);
3291 ev.entered = entered;
3292
3293 return mgmt_event(MGMT_EV_PASSKEY_NOTIFY, hdev, &ev, sizeof(ev), NULL);
3294}
3295
3279int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 3296int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
3280 u8 addr_type, u8 status) 3297 u8 addr_type, u8 status)
3281{ 3298{