[PATCH v1 0/1] Bluetooth: mgmt: Add helper function for Address Type

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

 



This patch adds helper function for converting address type received
from user space to corresponding Address types as per BT spec.

Signed-off-by: Hemant Gupta <hemant.gupta@xxxxxxxxxxxxxx>
---
 net/bluetooth/mgmt.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 880b7c9..cb83644 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1644,6 +1644,25 @@ static u8 link_to_mgmt(u8 link_type, u8 addr_type)
 	}
 }
 
+static u8 mgmt_to_link(u8 link_type, u8 addr_type)
+{
+	switch (link_type) {
+	case LE_LINK:
+		switch (addr_type) {
+		case MGMT_ADDR_LE_PUBLIC:
+			return ADDR_LE_DEV_PUBLIC;
+
+		default:
+			/* Fallback to LE Random address type */
+			return ADDR_LE_DEV_RANDOM;
+		}
+
+	default:
+		/* Fallback to BR/EDR type */
+		return ACL_LINK;
+	}
+}
+
 static int get_connections(struct sock *sk, struct hci_dev *hdev, void *data,
 			   u16 data_len)
 {
-- 
1.7.0.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