[PATCH v2 5/5] Bluetooth: Export LE connection parameters to debugfs

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

 



This patch exports LE connection parameters under hciX directory if
controller is LE capable. All parameter files have read and write
permissions. This means, we are able to change LE connection parameters
by writing new values into the files. For instance, to change the
default value for supervision_timeout we can run:
$ echo 0x0040 > /sys/kernel/debug/bluetooth/hci0/le_conn_supervision_timeout

Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx>
---
 net/bluetooth/hci_sysfs.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 78ef738..ba4f7c7 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -546,6 +546,7 @@ void hci_init_sysfs(struct hci_dev *hdev)
 void hci_sysfs_export_info(struct hci_dev *hdev)
 {
 	struct discovery_param *discov = &hdev->discovery_param;
+	struct le_conn_param *conn = &hdev->le_conn_param;
 
 	if (lmp_bredr_capable(hdev)) {
 		debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
@@ -558,6 +559,7 @@ void hci_sysfs_export_info(struct hci_dev *hdev)
 	}
 
 	if (lmp_le_capable(hdev)) {
+		/* Discovery parameters */
 		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,
@@ -566,6 +568,25 @@ void hci_sysfs_export_info(struct hci_dev *hdev)
 				   hdev->debugfs, &discov->scan_window);
 		debugfs_create_u16("discov_le_scan_timeout", S_IRUSR|S_IWUSR,
 				   hdev->debugfs, &discov->le_scan_timeout);
+
+		/* Connection parameters */
+		debugfs_create_x16("le_conn_scan_interval", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->scan_interval);
+		debugfs_create_x16("le_conn_scan_window", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->scan_window);
+		debugfs_create_x16("le_conn_interval_min", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->conn_interval_min);
+		debugfs_create_x16("le_conn_interval_max", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->conn_interval_max);
+		debugfs_create_x16("le_conn_supervision_timeout",
+				   S_IRUSR|S_IWUSR, hdev->debugfs,
+				   &conn->supervision_timeout);
+		debugfs_create_x16("le_conn_min_ce_lentgh", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->min_ce_lentgh);
+		debugfs_create_x16("le_conn_max_ce_lentgh", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->max_ce_lentgh);
+		debugfs_create_x16("le_conn_latency", S_IRUSR|S_IWUSR,
+				   hdev->debugfs, &conn->conn_latency);
 	}
 
 	if (lmp_le_capable(hdev) && lmp_bredr_capable(hdev)) {
-- 
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