Thread (6 messages) read the whole thread 6 messages, 2 authors, 2013-09-16
STALE4700d

[PATCH v2 3/5] Bluetooth: Export discovery parameters to debugfs

From: Andre Guedes <hidden>
Date: 2013-08-23 20:01:09
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

This patch exports discovery parameters under hciX directory. All
parameter files have read and write permissions. This means, we
are able to change discovery parameters by writing new values into
the files. For instance, to change the default value for the scanning
interval we can run:
$ echo 0x0016 > /sys/kernel/debug/bluetooth/hci0/discov_scan_interval

Signed-off-by: Andre Guedes <redacted>
---
 net/bluetooth/hci_sysfs.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index c89032c..78ef738 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -545,11 +545,36 @@ void hci_init_sysfs(struct hci_dev *hdev)
 /* This function expects hdev has been already intialized */
 void hci_sysfs_export_info(struct hci_dev *hdev)
 {
+	struct discovery_param *discov = &hdev->discovery_param;
+
 	if (lmp_bredr_capable(hdev)) {
 		debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
 				    hdev, &inquiry_cache_fops);
 		debugfs_create_file("auto_accept_delay", 0444, hdev->debugfs,
 				    hdev, &auto_accept_delay_fops);
+		debugfs_create_x8("discov_bredr_inq_len", S_IRUSR|S_IWUSR,
+				  hdev->debugfs,
+				  &discov->bredr_inquiry_length);
+	}
+
+	if (lmp_le_capable(hdev)) {
+		debugfs_create_x8("discov_scan_type", S_IRUSR|S_IWUSR,
+				  hdev->debugfs, &discov->scan_type);
+		debugfs_create_x16("discov_scan_interval", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &discov->scan_interval);
+		debugfs_create_x16("discov_scan_window", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &discov->scan_window);
+		debugfs_create_u16("discov_le_scan_timeout", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &discov->le_scan_timeout);
+	}
+
+	if (lmp_le_capable(hdev) && lmp_bredr_capable(hdev)) {
+		debugfs_create_x8("discov_interleaved_inq_len",
+				  S_IRUSR|S_IWUSR, hdev->debugfs,
+				   &discov->interleaved_inquiry_length);
+		debugfs_create_u16("discov_interleaved_scan_timeout",
+				   S_IRUSR|S_IWUSR, hdev->debugfs,
+				   &discov->interleaved_scan_timeout);
 	}
 }
 
-- 
1.8.3.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help