From aeb1d7dba0387fc4f9397cbb15a03033b7d91103 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sat, 31 Mar 2018 21:27:29 +0200 Subject: [PATCH] pts/sm_test: trigger passkey entry failed by decline bonding --- test/pts/sm_test.c | 6 +----- test/pts/sm_test.py | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/pts/sm_test.c b/test/pts/sm_test.c index 689fe150b..1052d9918 100644 --- a/test/pts/sm_test.c +++ b/test/pts/sm_test.c @@ -311,8 +311,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * static void stdin_process(char c){ // passkey input - if (ui_digits_for_passkey){ - if (c < '0' || c > '9') return; + if (ui_digits_for_passkey && c >= '0' && c <= '9'){ printf("%c", c); fflush(stdout); ui_passkey = ui_passkey * 10 + c - '0'; @@ -322,9 +321,6 @@ static void stdin_process(char c){ printf("\n"); fflush(stdout); sm_keypress_notification(connection_handle, SM_KEYPRESS_PASSKEY_ENTRY_COMPLETED); - if (sm_failure == SM_REASON_PASSKEY_ENTRY_FAILED){ - ui_passkey--; - } sm_passkey_input(connection_handle, ui_passkey); } return; diff --git a/test/pts/sm_test.py b/test/pts/sm_test.py index eec83c026..cb8c9911e 100755 --- a/test/pts/sm_test.py +++ b/test/pts/sm_test.py @@ -205,7 +205,10 @@ def run(test_descriptor, nodes): else: test_descriptor['waiting_node'].write(test_descriptor['passkey']) elif line.startswith('PASSKEY_INPUT_NUMBER'): - if state == 'W4_PASSKEY_INPUT': + if node.get_name() == 'tester' and test_descriptor['tester_failure'] == '1': + print('Decline bonding') + node.write('d') + elif state == 'W4_PASSKEY_INPUT': node.write(test_descriptor['passkey']) else: test_descriptor['waiting_node'] = node