[PATCH 1/5] Bluetooth: Expose supported LE states via debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It may be useful for debugging purposes to quickly retrieve supported LE
stated bit mask for controller.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@xxxxxxxxxxx>
---
 net/bluetooth/hci_debugfs.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c
index 51f5b1efc3a5..c0b11ebacf7d 100644
--- a/net/bluetooth/hci_debugfs.c
+++ b/net/bluetooth/hci_debugfs.c
@@ -679,6 +679,29 @@ static const struct file_operations force_static_address_fops = {
 	.llseek		= default_llseek,
 };
 
+static int le_states_show(struct seq_file *f, void *ptr)
+{
+	struct hci_dev *hdev = f->private;
+
+	hci_dev_lock(hdev);
+	seq_printf(f, "LE: %8ph\n", hdev->le_states);
+	hci_dev_unlock(hdev);
+
+	return 0;
+}
+
+static int le_states_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, le_states_show, inode->i_private);
+}
+
+static const struct file_operations le_states_fops = {
+	.open		= le_states_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
 static int white_list_show(struct seq_file *f, void *ptr)
 {
 	struct hci_dev *hdev = f->private;
@@ -956,6 +979,8 @@ void hci_debugfs_create_le(struct hci_dev *hdev)
 			    &random_address_fops);
 	debugfs_create_file("static_address", 0444, hdev->debugfs, hdev,
 			    &static_address_fops);
+	debugfs_create_file("le_states", 0444, hdev->debugfs, hdev,
+			    &le_states_fops);
 
 	/* For controllers with a public address, provide a debug
 	 * option to force the usage of the configured static
-- 
2.20.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux