Bluetooth: host: Add keypress notification SMP handler
Add a dummy SMP command handler for keypress notification, that does nothing (yet). This allows the next commit to work properly. Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit is contained in:
parent
b0bd14b5fa
commit
98584a4bbc
2 changed files with 26 additions and 0 deletions
|
@ -2611,6 +2611,7 @@ static uint8_t legacy_pairing_rsp(struct bt_smp *smp)
|
|||
|
||||
if (!atomic_test_bit(smp->flags, SMP_FLAG_USER)) {
|
||||
atomic_set_bit(&smp->allowed_cmds, BT_SMP_CMD_PAIRING_CONFIRM);
|
||||
atomic_set_bit(&smp->allowed_cmds, BT_SMP_KEYPRESS_NOTIFICATION);
|
||||
return legacy_send_pairing_confirm(smp);
|
||||
}
|
||||
|
||||
|
@ -4075,6 +4076,9 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf)
|
|||
atomic_set_bit(&smp->allowed_cmds,
|
||||
BT_SMP_CMD_PAIRING_CONFIRM);
|
||||
|
||||
atomic_set_bit(&smp->allowed_cmds,
|
||||
BT_SMP_KEYPRESS_NOTIFICATION);
|
||||
|
||||
err = smp_send_pairing_confirm(smp);
|
||||
if (err) {
|
||||
return err;
|
||||
|
@ -4083,6 +4087,10 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf)
|
|||
case PASSKEY_INPUT:
|
||||
atomic_set_bit(smp->flags, SMP_FLAG_USER);
|
||||
bt_auth->passkey_entry(smp->chan.chan.conn);
|
||||
|
||||
atomic_set_bit(&smp->allowed_cmds,
|
||||
BT_SMP_KEYPRESS_NOTIFICATION);
|
||||
|
||||
break;
|
||||
case LE_SC_OOB:
|
||||
/* Step 6: Select random N */
|
||||
|
@ -4221,6 +4229,18 @@ static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t smp_keypress_notif(struct bt_smp *smp, struct net_buf *buf)
|
||||
{
|
||||
ARG_UNUSED(smp);
|
||||
ARG_UNUSED(buf);
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
/* Ignore packets until keypress notifications are fully supported. */
|
||||
atomic_set_bit(&smp->allowed_cmds, BT_SMP_KEYPRESS_NOTIFICATION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
uint8_t (*func)(struct bt_smp *smp, struct net_buf *buf);
|
||||
uint8_t expect_len;
|
||||
|
@ -4239,6 +4259,7 @@ static const struct {
|
|||
{ smp_security_request, sizeof(struct bt_smp_security_request) },
|
||||
{ smp_public_key, sizeof(struct bt_smp_public_key) },
|
||||
{ smp_dhkey_check, sizeof(struct bt_smp_dhkey_check) },
|
||||
{ smp_keypress_notif, sizeof(struct bt_smp_keypress_notif) },
|
||||
};
|
||||
|
||||
static int bt_smp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
|
||||
|
|
|
@ -123,6 +123,11 @@ struct bt_smp_dhkey_check {
|
|||
uint8_t e[16];
|
||||
} __packed;
|
||||
|
||||
#define BT_SMP_KEYPRESS_NOTIFICATION 0x0e
|
||||
struct bt_smp_keypress_notif {
|
||||
uint8_t type;
|
||||
} __packed;
|
||||
|
||||
int bt_smp_start_security(struct bt_conn *conn);
|
||||
bool bt_smp_request_ltk(struct bt_conn *conn, uint64_t rand, uint16_t ediv,
|
||||
uint8_t *ltk);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue