2014-06-17 12:27:41

by Andrei Emeltchenko

[permalink] [raw]
Subject: [RFC] android/haltest: Auto-accept pairing

From: Andrei Emeltchenko <[email protected]>

Simplify PTS testing by automatically auto accept Just Works pairing.
---
android/client/if-bt.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 4d6ff83..764979e 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -266,7 +266,8 @@ static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
__func__, last_remote_addr, bd_name->name, cod,
bt_ssp_variant_t2str(pairing_variant), pass_key);

- if (pairing_variant == BT_SSP_VARIANT_PASSKEY_CONFIRMATION) {
+ switch (pairing_variant) {
+ case BT_SSP_VARIANT_PASSKEY_CONFIRMATION:
sprintf(prompt, "Does other device show %d [Y/n] ?", pass_key);

ssp_request_addr = *remote_bd_addr;
@@ -274,6 +275,14 @@ static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
ssp_request_pask_key = pass_key;

terminal_prompt_for(prompt, ssp_request_yes_no_answer);
+ break;
+ case BT_SSP_VARIANT_CONSENT:
+ EXEC(if_bluetooth->ssp_reply, remote_bd_addr, pairing_variant,
+ 1, 0);
+ break;
+ default:
+ haltest_info("Not automatically handled\n");
+ break;
}
}

--
1.8.3.2