[PATCH BlueZ] mgmt-tester: Add test for Limited/Device Privacy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This adds a test for Limited/Device Privacy (0x02):

@ MGMT Command: Set Privacy (0x002f) plen 17
        Privacy: Limited (0x02)
        Key: 01020304050607080102030405060708
@ MGMT Event: Command Complete (0x0001) plen 7
      Set Privacy (0x002f) plen 4
        Status: Success (0x00)
        Current settings: 0x00002080
          BR/EDR
          Privacy
@ MGMT Event: New Settings (0x0006) plen 4
        Current settings: 0x00002080
          BR/EDR
          Privacy
---
 tools/mgmt-tester.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 207168291..e9fcb2602 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -4136,15 +4136,29 @@ static const struct generic_data load_irks_not_supported_test = {
 	.expect_status = MGMT_STATUS_NOT_SUPPORTED,
 };
 
-static const char set_privacy_valid_param[] = { 0x01,
+static const char set_privacy_1_valid_param[] = { 0x01,
 			0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
 			0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
 static const char set_privacy_settings_param[] = { 0x80, 0x20, 0x00, 0x00 };
 
-static const struct generic_data set_privacy_success_test = {
+static const struct generic_data set_privacy_success_1_test = {
 	.send_opcode = MGMT_OP_SET_PRIVACY,
-	.send_param = set_privacy_valid_param,
-	.send_len = sizeof(set_privacy_valid_param),
+	.send_param = set_privacy_1_valid_param,
+	.send_len = sizeof(set_privacy_1_valid_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = set_privacy_settings_param,
+	.expect_len = sizeof(set_privacy_settings_param),
+	.expect_settings_set = MGMT_SETTING_PRIVACY,
+};
+
+static const char set_privacy_2_valid_param[] = { 0x02,
+			0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+			0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
+
+static const struct generic_data set_privacy_success_2_test = {
+	.send_opcode = MGMT_OP_SET_PRIVACY,
+	.send_param = set_privacy_2_valid_param,
+	.send_len = sizeof(set_privacy_2_valid_param),
 	.expect_status = MGMT_STATUS_SUCCESS,
 	.expect_param = set_privacy_settings_param,
 	.expect_len = sizeof(set_privacy_settings_param),
@@ -4154,8 +4168,8 @@ static const struct generic_data set_privacy_success_test = {
 static const struct generic_data set_privacy_powered_test = {
 	.setup_settings = settings_powered,
 	.send_opcode = MGMT_OP_SET_PRIVACY,
-	.send_param = set_privacy_valid_param,
-	.send_len = sizeof(set_privacy_valid_param),
+	.send_param = set_privacy_1_valid_param,
+	.send_len = sizeof(set_privacy_1_valid_param),
 	.expect_status = MGMT_STATUS_REJECTED,
 };
 
@@ -13063,8 +13077,11 @@ int main(int argc, char *argv[])
 				&load_irks_not_supported_test,
 				NULL, test_command_generic);
 
-	test_bredrle("Set Privacy - Success",
-				&set_privacy_success_test,
+	test_bredrle("Set Privacy - Success 1",
+				&set_privacy_success_1_test,
+				NULL, test_command_generic);
+	test_bredrle("Set Privacy - Success 2 (Device Mode)",
+				&set_privacy_success_2_test,
 				NULL, test_command_generic);
 	test_bredrle("Set Privacy - Rejected",
 				&set_privacy_powered_test,
-- 
2.31.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux