Skip to content

Commit 28ec852

Browse files
[revert] zephyr: sm: add wid 175, update wid 108
WID 175 is added for test case SM/CEN/JW/BI-06-C Please confirm that IUT reports the Confirm Value Failed to the Upper Tester. Due to limitation on zephyr the same WID is added for zephyr because SMP failure is converted in zephyr. SM/CEN/JW/BV-01-C needs bondable flag to be disabled.
1 parent a32aa41 commit 28ec852

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

autopts/ptsprojects/zephyr/sm_wid.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import logging
1717

18+
from autopts.ptsprojects.stack import get_stack
1819
from autopts.ptsprojects.zephyr.iutctl import get_iut
1920
from autopts.pybtp import btp
2021
from autopts.wid import generic_wid_hdl
@@ -28,11 +29,28 @@ def sm_wid_hdl(wid, description, test_case_name):
2829

2930

3031
# wid handlers section begin
31-
def hdl_wid_143(desc):
32+
def hdl_wid_143(_):
33+
"""Confirm IUT readiness and read controller information."""
3234
zephyrctl = get_iut()
3335

3436
zephyrctl.wait_iut_ready_event()
3537
btp.core_reg_svc_gap()
3638
btp.gap_read_ctrl_info()
3739

3840
return True
41+
42+
43+
def hdl_wid_175(_):
44+
"""
45+
Please confirm that IUT reports the Confirm Value Failed to the Upper Tester
46+
"""
47+
48+
stack = get_stack()
49+
_, _, reason = stack.gap.gap_wait_for_pairing_fail(10)
50+
51+
# BT_SMP_ERR_CONFIRM_FAILED(0x04) is converted to BT_SECURITY_ERR_AUTH_FAIL(0x01)
52+
# in zephyr host.
53+
if reason == 0x01:
54+
return True
55+
56+
return False

autopts/pybtp/defs.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,3 +989,23 @@ def BIT(bit):
989989
BTP_SDP_EV_SERVICE_RECORD_HANDLE = 0x80
990990

991991
# GENERATOR append 2
992+
993+
# The reason codes for pairing failures.
994+
# Vol 3, Part H, Section 3.5.5
995+
BTP_SMP_PAIR_FAIL_REASON_SUCCESS = 0x00
996+
BTP_SMP_PAIR_FAIL_REASON_PASSKEY_ENTRY_FAILED = 0x01
997+
BTP_SMP_PAIR_FAIL_REASON_OOB_NOT_AVAILABLE = 0x02
998+
BTP_SMP_PAIR_FAIL_REASON_AUTHENTICATION_REQUIREMENTS = 0x03
999+
BTP_SMP_PAIR_FAIL_REASON_CONFIRM_VALUE_FAILED = 0x04
1000+
BTP_SMP_PAIR_FAIL_REASON_PAIRING_NOT_SUPPORTED = 0x05
1001+
BTP_SMP_PAIR_FAIL_REASON_ENC_KEY_SIZE = 0x06
1002+
BTP_SMP_PAIR_FAIL_REASON_COMMAND_NOT_SUPPORTED = 0x07
1003+
BTP_SMP_PAIR_FAIL_REASON_UNSPECIFIED = 0x08
1004+
BTP_SMP_PAIR_FAIL_REASON_REPEATED_ATTEMPTS = 0x09
1005+
BTP_SMP_PAIR_FAIL_REASON_INVALID_PARAMS = 0x0A
1006+
BTP_SMP_PAIR_FAIL_REASON_DHKEY_CHECK_FAILED = 0x0B
1007+
BTP_SMP_PAIR_FAIL_REASON_NUMERIC_COMPARISON_FAILED = 0x0C
1008+
BTP_SMP_PAIR_FAIL_REASON_BR_EDR_PAIRING_IN_PROGRESS = 0x0D
1009+
BTP_SMP_PAIR_FAIL_REASON_CROSS_TRANSPORT_KEY_NOT_SUPPORTED = 0x0E
1010+
BTP_SMP_PAIR_FAIL_REASON_KEY_REJECTED = 0x0F
1011+
BTP_SMP_PAIR_FAIL_REASON_BUSY = 0x10

autopts/wid/sm.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ def hdl_wid_107(params: WIDParams):
101101

102102

103103
def hdl_wid_108(params: WIDParams):
104+
"""
105+
Please start pairing process.
106+
"""
107+
108+
# SM/CEN/JW/BV-01-C AuthReq bonding flag needs to be set to 0x00
109+
if params.test_case_name in ['SM/CEN/JW/BV-01-C']:
110+
btp.gap_set_bondable_off()
111+
104112
btp.gap_pair()
105113
return True
106114

@@ -245,6 +253,20 @@ def hdl_wid_174(_: WIDParams):
245253
return True
246254

247255

256+
def hdl_wid_175(_: WIDParams):
257+
"""
258+
Please confirm that IUT reports the Confirm Value Failed to the Upper Tester
259+
"""
260+
261+
stack = get_stack()
262+
_, _, reason = stack.gap.gap_wait_for_pairing_fail(10)
263+
264+
if reason == defs.BTP_SMP_PAIR_FAIL_REASON_CONFIRM_VALUE_FAILED:
265+
return True
266+
267+
return False
268+
269+
248270
def hdl_wid_1009(params: WIDParams):
249271
return btp.var_store_get_passkey(params.description)
250272

0 commit comments

Comments
 (0)