summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_debugfs.c
diff options
context:
space:
mode:
authorMarcel Holtmann2015-02-01 00:12:06 +0100
committerJohan Hedberg2015-02-01 08:14:19 +0100
commit0886aea6acd27006888c36bad1fa5f80dac1e171 (patch)
tree7ddc71d63b81a2e0b0c85f35ff8b296bf78f66da /net/bluetooth/hci_debugfs.c
parentBluetooth: Track changes from HCI Write Simple Pairing Debug Mode command (diff)
downloadkernel-qcow2-linux-0886aea6acd27006888c36bad1fa5f80dac1e171.tar.gz
kernel-qcow2-linux-0886aea6acd27006888c36bad1fa5f80dac1e171.tar.xz
kernel-qcow2-linux-0886aea6acd27006888c36bad1fa5f80dac1e171.zip
Bluetooth: Expose debug keys usage setting via debugfs
To allow easier debugging when debug keys are generated, provide debugfs entry for checking the setting of debug keys usage. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_debugfs.c')
-rw-r--r--net/bluetooth/hci_debugfs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c
index 51a424cfa94a..2272384755d5 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)
DEFINE_SIMPLE_ATTRIBUTE(conn_info_max_age_fops, conn_info_max_age_get,
conn_info_max_age_set, "%llu\n");
+static ssize_t use_debug_keys_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct hci_dev *hdev = file->private_data;
+ char buf[3];
+
+ buf[0] = test_bit(HCI_USE_DEBUG_KEYS, &hdev->dev_flags) ? 'Y': 'N';
+ buf[1] = '\n';
+ buf[2] = '\0';
+ return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
+}
+
+static const struct file_operations use_debug_keys_fops = {
+ .open = simple_open,
+ .read = use_debug_keys_read,
+ .llseek = default_llseek,
+};
+
static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
@@ -249,6 +267,10 @@ void hci_debugfs_create_common(struct hci_dev *hdev)
debugfs_create_file("conn_info_max_age", 0644, hdev->debugfs, hdev,
&conn_info_max_age_fops);
+ if (lmp_ssp_capable(hdev) || lmp_le_capable(hdev))
+ debugfs_create_file("use_debug_keys", 0444, hdev->debugfs,
+ hdev, &use_debug_keys_fops);
+
if (lmp_sc_capable(hdev) || lmp_le_capable(hdev))
debugfs_create_file("sc_only_mode", 0444, hdev->debugfs,
hdev, &sc_only_mode_fops);