All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH 2/5] android/hal-pan: Return error in case of unsupported PAN roles
Date: Tue, 19 Nov 2013 14:21:13 +0200	[thread overview]
Message-ID: <1384863676-12358-2-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1384863676-12358-1-git-send-email-ravikumar.veeramally@linux.intel.com>

---
 android/hal-pan.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/android/hal-pan.c b/android/hal-pan.c
index 2bc560e..30facd4 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -77,6 +77,9 @@ static bt_status_t pan_enable(int local_role)
 	if (!interface_ready())
 		return BT_STATUS_NOT_READY;
 
+	if (!(local_role == BTPAN_ROLE_PANU || local_role == BTPAN_ROLE_PANNAP))
+		return BT_STATUS_UNSUPPORTED;
+
 	cmd.local_role = local_role;
 
 	return hal_ipc_cmd(HAL_SERVICE_ID_PAN, HAL_OP_PAN_ENABLE,
@@ -112,6 +115,14 @@ static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
 	if (!interface_ready())
 		return BT_STATUS_NOT_READY;
 
+	if (!((local_role == BTPAN_ROLE_PANNAP &&
+			remote_role == BTPAN_ROLE_PANU) ||
+		(local_role == BTPAN_ROLE_PANU &&
+			remote_role == BTPAN_ROLE_PANNAP) ||
+		(local_role == BTPAN_ROLE_PANU &&
+			remote_role == BTPAN_ROLE_PANU)))
+		return BT_STATUS_UNSUPPORTED;
+
 	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
 	cmd.local_role = local_role;
 	cmd.remote_role = remote_role;
-- 
1.8.3.2


  reply	other threads:[~2013-11-19 12:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 12:21 [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call Ravi kumar Veeramally
2013-11-19 12:21 ` Ravi kumar Veeramally [this message]
2013-11-19 13:27   ` [PATCH 2/5] android/hal-pan: Return error in case of unsupported PAN roles Johan Hedberg
2013-11-19 13:51     ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 3/5] android: Handle multiple init(register) and cleanup(unregister) calls properly Ravi kumar Veeramally
2013-11-19 13:30   ` Johan Hedberg
2013-11-19 13:52     ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb Ravi kumar Veeramally
2013-11-19 13:31   ` Johan Hedberg
2013-11-19 13:53     ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 5/5] android/hidhost: Free all connected devices in profile cleanup call Ravi kumar Veeramally
2013-11-19 13:35   ` Johan Hedberg
2013-11-19 13:55     ` Ravi Kumar Veeramally
2013-11-19 13:23 ` [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call Johan Hedberg

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=1384863676-12358-2-git-send-email-ravikumar.veeramally@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.