Diff between 9a07be8bd7a69724fe2d6c7510a513b18bc5e83f and 67269189caf7cb12e5b76328f3d9d8c2ad76052e

Changed Files

File Additions Deletions Status
tools/btmgmt.c +24 -1 modified

Full Patch

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 7442ad0..97215ba 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -958,7 +958,30 @@ static void cmd_ssp(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
 
 static void cmd_sc(struct mgmt *mgmt, uint16_t index, int argc, char **argv)
 {
-	cmd_setting(mgmt, index, MGMT_OP_SET_SECURE_CONN, argc, argv);
+	uint8_t val;
+
+	if (argc < 2) {
+		printf("Specify \"on\" or \"off\" or \"only\"\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (strcasecmp(argv[1], "on") == 0 || strcasecmp(argv[1], "yes") == 0)
+		val = 1;
+	else if (strcasecmp(argv[1], "off") == 0)
+		val = 0;
+	else if (strcasecmp(argv[1], "only") == 0)
+		val = 2;
+	else
+		val = atoi(argv[1]);
+
+	if (index == MGMT_INDEX_NONE)
+		index = 0;
+
+	if (send_cmd(mgmt, MGMT_OP_SET_SECURE_CONN, index,
+					sizeof(val), &val, setting_rsp) == 0) {
+		fprintf(stderr, "Unable to send set_secure_conn cmd\n");
+		exit(EXIT_FAILURE);
+	}
 }
 
 static void cmd_hs(struct mgmt *mgmt, uint16_t index, int argc, char **argv)