From: Marcin Kraglak <marcin.kraglak@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCHv3 3/4] android/gatt:Add test command to increase security on link
Date: Wed, 18 Jun 2014 11:08:18 +0200 [thread overview]
Message-ID: <1403082499-2349-3-git-send-email-marcin.kraglak@tieto.com> (raw)
In-Reply-To: <1403082499-2349-1-git-send-email-marcin.kraglak@tieto.com>
---
android/gatt.c | 17 +++++++++++++++++
android/hal-msg.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/android/gatt.c b/android/gatt.c
index 4540e95..814dc50 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -3762,6 +3762,20 @@ static uint8_t test_read_write(bdaddr_t *bdaddr, bt_uuid_t *uuid, uint16_t op,
return HAL_STATUS_SUCCESS;
}
+static uint8_t test_increase_security(bdaddr_t *bdaddr, uint16_t u1)
+{
+ struct gatt_device *device;
+
+ device = find_device_by_addr(bdaddr);
+ if (!device)
+ return HAL_STATUS_FAILED;
+
+ if (!set_security(device, u1))
+ return HAL_STATUS_FAILED;
+
+ return HAL_STATUS_SUCCESS;
+}
+
static void handle_client_test_command(const void *buf, uint16_t len)
{
const struct hal_cmd_gatt_client_test_command *cmd = buf;
@@ -3813,6 +3827,9 @@ static void handle_client_test_command(const void *buf, uint16_t len)
status = test_read_write(&bdaddr, &uuid, cmd->u1, cmd->u2,
cmd->u3, cmd->u4, cmd->u5);
break;
+ case GATT_CLIENT_TEST_CMD_INCREASE_SECURITY:
+ status = test_increase_security(&bdaddr, cmd->u1);
+ break;
case GATT_CLIENT_TEST_CMD_PAIRING_CONFIG:
default:
status = HAL_STATUS_FAILED;
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 57872c6..af859c6 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -756,6 +756,7 @@ struct hal_cmd_gatt_client_set_adv_data {
#define GATT_CLIENT_TEST_CMD_DISCOVER 0x04
#define GATT_CLIENT_TEST_CMD_READ 0xe0
#define GATT_CLIENT_TEST_CMD_WRITE 0xe1
+#define GATT_CLIENT_TEST_CMD_INCREASE_SECURITY 0xe2
#define GATT_CLIENT_TEST_CMD_PAIRING_CONFIG 0xf0
#define HAL_OP_GATT_CLIENT_TEST_COMMAND 0x16
--
1.9.3
next prev parent reply other threads:[~2014-06-18 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 9:08 [PATCHv3 1/4] android/hal-msg: Add defines of HAL_GATT_AUTHENTICATION values Marcin Kraglak
2014-06-18 9:08 ` [PATCHv3 2/4] android/gatt: Set security level if user requested Marcin Kraglak
2014-06-18 9:08 ` Marcin Kraglak [this message]
2014-06-18 9:08 ` [PATCHv3 4/4] android/pts: Update PTS GAP results Marcin Kraglak
2014-06-18 13:36 ` [PATCHv3 1/4] android/hal-msg: Add defines of HAL_GATT_AUTHENTICATION values Szymon Janc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403082499-2349-3-git-send-email-marcin.kraglak@tieto.com \
--to=marcin.kraglak@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox