summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-01-15 14:48:12 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2014-01-15 14:48:12 +0200
commit3b7d6cae7b4c1c76206f427093d4bea22db40495 (patch)
treecda3bb5e4966e53e28e6290583bd8f228edb0231
parent3c08f447152c9ef0e973efab36cc69cf63059038 (diff)
tools/mgmt-tester: Include PIN callback as a necessary test condition
-rw-r--r--tools/mgmt-tester.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index b2fd9d0a2..8ee663509 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -380,6 +380,7 @@ struct generic_data {
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;
@@ -2335,6 +2336,7 @@ static const struct generic_data pair_device_reject_test_1 = {
.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),
};
@@ -2360,6 +2362,7 @@ static const struct generic_data pair_device_reject_test_3 = {
.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),
};
@@ -2908,6 +2911,8 @@ static void pin_code_request_callback(uint16_t index, uint16_t length,
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));
@@ -2957,8 +2962,13 @@ static void test_setup(const void *test_data)
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);