aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-02 15:58:21 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-02 15:58:21 -0500
commit6c032edc8a338f7a5d7bbd3dd8a08ac80d37dd86 (patch)
treec07d1788b0c6f3973a4afc8c61c05712cb6fa100 /net/bluetooth/hci_event.c
parenta4c9ea5e8fec680134d22aa99b54d1cd8c226ebd (diff)
parente64b4fb66cc428cef0a62ea899b671c1aad05f3a (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg say: ==================== pull request: bluetooth-next 2014-12-31 Here's the first batch of bluetooth patches for 3.20. - Cleanups & fixes to ieee802154 drivers - Fix synchronization of mgmt commands with respective HCI commands - Add self-tests for LE pairing crypto functionality - Remove 'BlueFritz!' specific handling from core using a new quirk flag - Public address configuration support for ath3012 - Refactor debugfs support into a dedicated file - Initial support for LE Data Length Extension feature from Bluetooth 4.2 Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c71
1 files changed, 69 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3f2e8b830cbd..0881efd0ad2d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -30,6 +30,8 @@
30#include <net/bluetooth/hci_core.h> 30#include <net/bluetooth/hci_core.h>
31#include <net/bluetooth/mgmt.h> 31#include <net/bluetooth/mgmt.h>
32 32
33#include "hci_request.h"
34#include "hci_debugfs.h"
33#include "a2mp.h" 35#include "a2mp.h"
34#include "amp.h" 36#include "amp.h"
35#include "smp.h" 37#include "smp.h"
@@ -1282,6 +1284,55 @@ static void hci_cc_le_read_supported_states(struct hci_dev *hdev,
1282 memcpy(hdev->le_states, rp->le_states, 8); 1284 memcpy(hdev->le_states, rp->le_states, 8);
1283} 1285}
1284 1286
1287static void hci_cc_le_read_def_data_len(struct hci_dev *hdev,
1288 struct sk_buff *skb)
1289{
1290 struct hci_rp_le_read_def_data_len *rp = (void *) skb->data;
1291
1292 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
1293
1294 if (rp->status)
1295 return;
1296
1297 hdev->le_def_tx_len = le16_to_cpu(rp->tx_len);
1298 hdev->le_def_tx_time = le16_to_cpu(rp->tx_time);
1299}
1300
1301static void hci_cc_le_write_def_data_len(struct hci_dev *hdev,
1302 struct sk_buff *skb)
1303{
1304 struct hci_cp_le_write_def_data_len *sent;
1305 __u8 status = *((__u8 *) skb->data);
1306
1307 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1308
1309 if (status)
1310 return;
1311
1312 sent = hci_sent_cmd_data(hdev, HCI_OP_LE_WRITE_DEF_DATA_LEN);
1313 if (!sent)
1314 return;
1315
1316 hdev->le_def_tx_len = le16_to_cpu(sent->tx_len);
1317 hdev->le_def_tx_time = le16_to_cpu(sent->tx_time);
1318}
1319
1320static void hci_cc_le_read_max_data_len(struct hci_dev *hdev,
1321 struct sk_buff *skb)
1322{
1323 struct hci_rp_le_read_max_data_len *rp = (void *) skb->data;
1324
1325 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
1326
1327 if (rp->status)
1328 return;
1329
1330 hdev->le_max_tx_len = le16_to_cpu(rp->tx_len);
1331 hdev->le_max_tx_time = le16_to_cpu(rp->tx_time);
1332 hdev->le_max_rx_len = le16_to_cpu(rp->rx_len);
1333 hdev->le_max_rx_time = le16_to_cpu(rp->rx_time);
1334}
1335
1285static void hci_cc_write_le_host_supported(struct hci_dev *hdev, 1336static void hci_cc_write_le_host_supported(struct hci_dev *hdev,
1286 struct sk_buff *skb) 1337 struct sk_buff *skb)
1287{ 1338{
@@ -2115,6 +2166,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2115 } else 2166 } else
2116 conn->state = BT_CONNECTED; 2167 conn->state = BT_CONNECTED;
2117 2168
2169 hci_debugfs_create_conn(conn);
2118 hci_conn_add_sysfs(conn); 2170 hci_conn_add_sysfs(conn);
2119 2171
2120 if (test_bit(HCI_AUTH, &hdev->flags)) 2172 if (test_bit(HCI_AUTH, &hdev->flags))
@@ -2130,7 +2182,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2130 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, 2182 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
2131 sizeof(cp), &cp); 2183 sizeof(cp), &cp);
2132 2184
2133 hci_update_page_scan(hdev, NULL); 2185 hci_update_page_scan(hdev);
2134 } 2186 }
2135 2187
2136 /* Set packet type for incoming connection */ 2188 /* Set packet type for incoming connection */
@@ -2316,7 +2368,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2316 if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) 2368 if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
2317 hci_remove_link_key(hdev, &conn->dst); 2369 hci_remove_link_key(hdev, &conn->dst);
2318 2370
2319 hci_update_page_scan(hdev, NULL); 2371 hci_update_page_scan(hdev);
2320 } 2372 }
2321 2373
2322 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); 2374 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
@@ -2854,6 +2906,18 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2854 hci_cc_le_read_supported_states(hdev, skb); 2906 hci_cc_le_read_supported_states(hdev, skb);
2855 break; 2907 break;
2856 2908
2909 case HCI_OP_LE_READ_DEF_DATA_LEN:
2910 hci_cc_le_read_def_data_len(hdev, skb);
2911 break;
2912
2913 case HCI_OP_LE_WRITE_DEF_DATA_LEN:
2914 hci_cc_le_write_def_data_len(hdev, skb);
2915 break;
2916
2917 case HCI_OP_LE_READ_MAX_DATA_LEN:
2918 hci_cc_le_read_max_data_len(hdev, skb);
2919 break;
2920
2857 case HCI_OP_WRITE_LE_HOST_SUPPORTED: 2921 case HCI_OP_WRITE_LE_HOST_SUPPORTED:
2858 hci_cc_write_le_host_supported(hdev, skb); 2922 hci_cc_write_le_host_supported(hdev, skb);
2859 break; 2923 break;
@@ -3584,6 +3648,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
3584 conn->handle = __le16_to_cpu(ev->handle); 3648 conn->handle = __le16_to_cpu(ev->handle);
3585 conn->state = BT_CONNECTED; 3649 conn->state = BT_CONNECTED;
3586 3650
3651 hci_debugfs_create_conn(conn);
3587 hci_conn_add_sysfs(conn); 3652 hci_conn_add_sysfs(conn);
3588 break; 3653 break;
3589 3654
@@ -4124,6 +4189,7 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
4124 hcon->disc_timeout = HCI_DISCONN_TIMEOUT; 4189 hcon->disc_timeout = HCI_DISCONN_TIMEOUT;
4125 hci_conn_drop(hcon); 4190 hci_conn_drop(hcon);
4126 4191
4192 hci_debugfs_create_conn(hcon);
4127 hci_conn_add_sysfs(hcon); 4193 hci_conn_add_sysfs(hcon);
4128 4194
4129 amp_physical_cfm(bredr_hcon, hcon); 4195 amp_physical_cfm(bredr_hcon, hcon);
@@ -4330,6 +4396,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
4330 conn->le_conn_latency = le16_to_cpu(ev->latency); 4396 conn->le_conn_latency = le16_to_cpu(ev->latency);
4331 conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout); 4397 conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout);
4332 4398
4399 hci_debugfs_create_conn(conn);
4333 hci_conn_add_sysfs(conn); 4400 hci_conn_add_sysfs(conn);
4334 4401
4335 hci_proto_connect_cfm(conn, ev->status); 4402 hci_proto_connect_cfm(conn, ev->status);