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

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

 



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 <andre.guedes@xxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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