Bluetooth: Mesh: Provisioning: Fix input OOB support
The code was missing the sending of the Input Complete PDU, and was also setting the link.auth value too late. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
497fef85c3
commit
32399a4cd2
1 changed files with 20 additions and 4 deletions
|
@ -759,18 +759,30 @@ static void send_confirm(void)
|
|||
link.expect = PROV_RANDOM;
|
||||
}
|
||||
|
||||
static void send_input_complete(void)
|
||||
{
|
||||
struct net_buf_simple *buf = PROV_BUF(1);
|
||||
|
||||
prov_buf_init(buf, PROV_INPUT_COMPLETE);
|
||||
prov_send(buf);
|
||||
}
|
||||
|
||||
int bt_mesh_input_number(u32_t num)
|
||||
{
|
||||
BT_DBG("%u", num);
|
||||
|
||||
if (!atomic_test_and_clear_bit(link.flags, WAIT_NUMBER)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sys_put_be32(num, &link.auth[12]);
|
||||
|
||||
send_input_complete();
|
||||
|
||||
if (!atomic_test_bit(link.flags, HAVE_DHKEY)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sys_put_be32(num, &link.auth[12]);
|
||||
|
||||
if (atomic_test_and_clear_bit(link.flags, SEND_CONFIRM)) {
|
||||
send_confirm();
|
||||
}
|
||||
|
@ -780,16 +792,20 @@ int bt_mesh_input_number(u32_t num)
|
|||
|
||||
int bt_mesh_input_string(const char *str)
|
||||
{
|
||||
BT_DBG("%s", str);
|
||||
|
||||
if (!atomic_test_and_clear_bit(link.flags, WAIT_STRING)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
strncpy(link.auth, str, prov->input_size);
|
||||
|
||||
send_input_complete();
|
||||
|
||||
if (!atomic_test_bit(link.flags, HAVE_DHKEY)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
strncpy(link.auth, str, prov->input_size);
|
||||
|
||||
if (atomic_test_and_clear_bit(link.flags, SEND_CONFIRM)) {
|
||||
send_confirm();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue