diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index b2fd9d0..8ee6635 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
const void *expect_hci_param;
uint8_t expect_hci_len;
const void * (*expect_hci_func)(uint8_t *len);
+ bool expect_pin;
uint8_t pin_len;
const void *pin;
uint8_t client_pin_len;
.expect_func = pair_device_expect_param_func,
.expect_hci_command = BT_HCI_CMD_PIN_CODE_REQUEST_NEG_REPLY,
.expect_hci_func = client_bdaddr_param_func,
+ .expect_pin = true,
.client_pin = pair_device_pin,
.client_pin_len = sizeof(pair_device_pin),
};
.expect_func = pair_device_expect_param_func,
.expect_hci_command = BT_HCI_CMD_PIN_CODE_REQUEST_NEG_REPLY,
.expect_hci_func = client_bdaddr_param_func,
+ .expect_pin = true,
.client_pin = pair_device_pin,
.client_pin_len = sizeof(pair_device_pin),
};
const struct generic_data *test = data->test_data;
struct mgmt_cp_pin_code_reply cp;
+ test_condition_complete(data);
+
memset(&cp, 0, sizeof(cp));
memcpy(&cp.addr, &ev->addr, sizeof(cp.addr));
if (!test)
goto proceed;
- mgmt_register(data->mgmt, MGMT_EV_PIN_CODE_REQUEST, data->mgmt_index,
- pin_code_request_callback, data, NULL);
+ if (test->pin || test->expect_pin) {
+ mgmt_register(data->mgmt, MGMT_EV_PIN_CODE_REQUEST,
+ data->mgmt_index, pin_code_request_callback,
+ data, NULL);
+ test_add_condition(data);
+ }
+
mgmt_register(data->mgmt, MGMT_EV_USER_CONFIRM_REQUEST,
data->mgmt_index, user_confirm_request_callback,
data, NULL);