Skip to content

Commit 134c2a8

Browse files
holtmannJohan Hedberg
authored andcommitted
Bluetooth: Add debugfs entry to show Secure Connections Only mode
For debugging purposes of Secure Connection Only support a simple debugfs entry is used to indicate if this mode is active or not. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 2c068e0 commit 134c2a8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

include/net/bluetooth/hci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ enum {
124124
HCI_LE_SCAN,
125125
HCI_SSP_ENABLED,
126126
HCI_SC_ENABLED,
127+
HCI_SC_ONLY,
127128
HCI_HS_ENABLED,
128129
HCI_LE_ENABLED,
129130
HCI_ADVERTISING,

net/bluetooth/hci_core.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,24 @@ static const struct file_operations force_sc_support_fops = {
461461
.llseek = default_llseek,
462462
};
463463

464+
static ssize_t sc_only_mode_read(struct file *file, char __user *user_buf,
465+
size_t count, loff_t *ppos)
466+
{
467+
struct hci_dev *hdev = file->private_data;
468+
char buf[3];
469+
470+
buf[0] = test_bit(HCI_SC_ONLY, &hdev->dev_flags) ? 'Y': 'N';
471+
buf[1] = '\n';
472+
buf[2] = '\0';
473+
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
474+
}
475+
476+
static const struct file_operations sc_only_mode_fops = {
477+
.open = simple_open,
478+
.read = sc_only_mode_read,
479+
.llseek = default_llseek,
480+
};
481+
464482
static int idle_timeout_set(void *data, u64 val)
465483
{
466484
struct hci_dev *hdev = data;
@@ -1491,6 +1509,8 @@ static int __hci_init(struct hci_dev *hdev)
14911509
hdev, &ssp_debug_mode_fops);
14921510
debugfs_create_file("force_sc_support", 0644, hdev->debugfs,
14931511
hdev, &force_sc_support_fops);
1512+
debugfs_create_file("sc_only_mode", 0444, hdev->debugfs,
1513+
hdev, &sc_only_mode_fops);
14941514
}
14951515

14961516
if (lmp_sniff_capable(hdev)) {

0 commit comments

Comments
 (0)