diff mbox series

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

Message ID 20200819082822.64903-2-daan@dptechnics.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series Added random address in mesh HCI initialization to prevent error 0x12 when enabling/disabling LE scans | expand

Commit Message

Daan Pape Aug. 19, 2020, 8:28 a.m. UTC
---
 mesh/mesh-io-generic.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

bluez.test.bot@gmail.com Aug. 19, 2020, 8:50 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.

Test Result:
checkgitlint Failed

Outputs:
1: T1 Title exceeds max length (102>72): "Added random address in mesh HCI initialization to prevent error 0x12 when enabling/disabling LE scans"
3: B6 Body message is missing



---
Regards,
Linux Bluetooth
Brian Gix Aug. 22, 2020, 2:27 p.m. UTC | #2
Applied with corrections to GIT policy errors
On Wed, 2020-08-19 at 10:28 +0200, Daan Pape wrote:
> ---
>  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);
diff mbox series

Patch

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);