[PATCH BlueZ 1/1] Added random address in mesh HCI initialization to prevent error 0x12 when enabling/disabling LE scans

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

 



---
 mesh/mesh-io-generic.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mesh/mesh-io-generic.c b/mesh/mesh-io-generic.c
index 67b13a1b9..67304d201 100644
--- a/mesh/mesh-io-generic.c
+++ b/mesh/mesh-io-generic.c
@@ -209,6 +209,7 @@ static void configure_hci(struct mesh_io_private *io)
 	struct bt_hci_cmd_le_set_scan_parameters cmd;
 	struct bt_hci_cmd_set_event_mask cmd_sem;
 	struct bt_hci_cmd_le_set_event_mask cmd_slem;
+	struct bt_hci_cmd_le_set_random_address cmd_raddr;
 
 	/* Set scan parameters */
 	cmd.type = 0x00; /* Passive Scanning. No scanning PDUs shall be sent */
@@ -261,6 +262,10 @@ static void configure_hci(struct mesh_io_private *io)
 	cmd_slem.mask[6] = 0x00;
 	cmd_slem.mask[7] = 0x00;
 
+	/* Set LE random address */
+	l_getrandom(cmd_raddr.addr, 6);
+	cmd_raddr.addr[5] |= 0xc0;
+
 	/* TODO: Move to suitable place. Set suitable masks */
 	/* Reset Command */
 	bt_hci_send(io->hci, BT_HCI_CMD_RESET, NULL, 0, hci_generic_callback,
@@ -282,6 +287,10 @@ static void configure_hci(struct mesh_io_private *io)
 	bt_hci_send(io->hci, BT_HCI_CMD_LE_SET_EVENT_MASK, &cmd_slem,
 			sizeof(cmd_slem), hci_generic_callback, NULL, NULL);
 
+	/* Set LE random address */
+	bt_hci_send(io->hci, BT_HCI_CMD_LE_SET_RANDOM_ADDRESS, &cmd_raddr,
+			sizeof(cmd_raddr), hci_generic_callback, NULL, NULL);
+
 	/* Scan Params */
 	bt_hci_send(io->hci, BT_HCI_CMD_LE_SET_SCAN_PARAMETERS, &cmd,
 				sizeof(cmd), hci_generic_callback, NULL, NULL);
-- 
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