diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-12-31 17:43:19 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-01-02 16:22:04 -0500 |
commit | cb0d2faeb1356f7d453bab3f1028f169d8ffe99c (patch) | |
tree | 47f541cf3d76c4c60dfaa57762a9178248917105 /net | |
parent | 05b3c3e7905d00a1fe2e9184fdd9b5eac427c736 (diff) |
Bluetooth: Fix scope of sc_only_mode debugfs entry
The sc_only_mode debugfs entry is used to read the current state of the
Secure Connections Only mode. Before Bluetooth 4.2 this mode was only
for BR/EDR controllers and with that tight to the support Secure Simple
Pairing. Since Secure Connections is now available for BR/EDR and LE
this debugfs entry is no longer correctly place.
Move it to the common section and enable it when either BR/EDR Secure
Connections feature is supported or when the controller has LE support.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_debugfs.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c index d72ebc2b11fa..ead89a5ad9ce 100644 --- a/net/bluetooth/hci_debugfs.c +++ b/net/bluetooth/hci_debugfs.c | |||
@@ -212,6 +212,24 @@ static int conn_info_max_age_get(void *data, u64 *val) | |||
212 | DEFINE_SIMPLE_ATTRIBUTE(conn_info_max_age_fops, conn_info_max_age_get, | 212 | DEFINE_SIMPLE_ATTRIBUTE(conn_info_max_age_fops, conn_info_max_age_get, |
213 | conn_info_max_age_set, "%llu\n"); | 213 | conn_info_max_age_set, "%llu\n"); |
214 | 214 | ||
215 | static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf, | ||
216 | size_t count, loff_t *ppos) | ||
217 | { | ||
218 | struct hci_dev *hdev = file->private_data; | ||
219 | char buf[3]; | ||
220 | |||
221 | buf[0] = test_bit(HCI_SC_ONLY, &hdev->dev_flags) ? 'Y': 'N'; | ||
222 | buf[1] = '\n'; | ||
223 | buf[2] = '\0'; | ||
224 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
225 | } | ||
226 | |||
227 | static const struct file_operations sc_only_mode_fops = { | ||
228 | .open = simple_open, | ||
229 | .read = sc_only_mode_read, | ||
230 | .llseek = default_llseek, | ||
231 | }; | ||
232 | |||
215 | void hci_debugfs_create_common(struct hci_dev *hdev) | 233 | void hci_debugfs_create_common(struct hci_dev *hdev) |
216 | { | 234 | { |
217 | debugfs_create_file("features", 0444, hdev->debugfs, hdev, | 235 | debugfs_create_file("features", 0444, hdev->debugfs, hdev, |
@@ -230,6 +248,10 @@ void hci_debugfs_create_common(struct hci_dev *hdev) | |||
230 | &conn_info_min_age_fops); | 248 | &conn_info_min_age_fops); |
231 | debugfs_create_file("conn_info_max_age", 0644, hdev->debugfs, hdev, | 249 | debugfs_create_file("conn_info_max_age", 0644, hdev->debugfs, hdev, |
232 | &conn_info_max_age_fops); | 250 | &conn_info_max_age_fops); |
251 | |||
252 | if (lmp_sc_capable(hdev) || lmp_le_capable(hdev)) | ||
253 | debugfs_create_file("sc_only_mode", 0444, hdev->debugfs, | ||
254 | hdev, &sc_only_mode_fops); | ||
233 | } | 255 | } |
234 | 256 | ||
235 | static int inquiry_cache_show(struct seq_file *f, void *p) | 257 | static int inquiry_cache_show(struct seq_file *f, void *p) |
@@ -357,24 +379,6 @@ static int auto_accept_delay_get(void *data, u64 *val) | |||
357 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, | 379 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, |
358 | auto_accept_delay_set, "%llu\n"); | 380 | auto_accept_delay_set, "%llu\n"); |
359 | 381 | ||
360 | static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf, | ||
361 | size_t count, loff_t *ppos) | ||
362 | { | ||
363 | struct hci_dev *hdev = file->private_data; | ||
364 | char buf[3]; | ||
365 | |||
366 | buf[0] = test_bit(HCI_SC_ONLY, &hdev->dev_flags) ? 'Y': 'N'; | ||
367 | buf[1] = '\n'; | ||
368 | buf[2] = '\0'; | ||
369 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
370 | } | ||
371 | |||
372 | static const struct file_operations sc_only_mode_fops = { | ||
373 | .open = simple_open, | ||
374 | .read = sc_only_mode_read, | ||
375 | .llseek = default_llseek, | ||
376 | }; | ||
377 | |||
378 | static int idle_timeout_set(void *data, u64 val) | 382 | static int idle_timeout_set(void *data, u64 val) |
379 | { | 383 | { |
380 | struct hci_dev *hdev = data; | 384 | struct hci_dev *hdev = data; |
@@ -470,12 +474,9 @@ void hci_debugfs_create_bredr(struct hci_dev *hdev) | |||
470 | debugfs_create_file("voice_setting", 0444, hdev->debugfs, hdev, | 474 | debugfs_create_file("voice_setting", 0444, hdev->debugfs, hdev, |
471 | &voice_setting_fops); | 475 | &voice_setting_fops); |
472 | 476 | ||
473 | if (lmp_ssp_capable(hdev)) { | 477 | if (lmp_ssp_capable(hdev)) |
474 | debugfs_create_file("auto_accept_delay", 0644, hdev->debugfs, | 478 | debugfs_create_file("auto_accept_delay", 0644, hdev->debugfs, |
475 | hdev, &auto_accept_delay_fops); | 479 | hdev, &auto_accept_delay_fops); |
476 | debugfs_create_file("sc_only_mode", 0444, hdev->debugfs, | ||
477 | hdev, &sc_only_mode_fops); | ||
478 | } | ||
479 | 480 | ||
480 | if (lmp_sniff_capable(hdev)) { | 481 | if (lmp_sniff_capable(hdev)) { |
481 | debugfs_create_file("idle_timeout", 0644, hdev->debugfs, | 482 | debugfs_create_file("idle_timeout", 0644, hdev->debugfs, |