linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles
@ 2013-11-19 14:56 Ravi kumar Veeramally
  2013-11-19 14:56 ` [PATCH_v2 2/4] android: Handle multiple init(register) and cleanup(unregister) calls properly Ravi kumar Veeramally
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-19 14:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

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

diff --git a/android/hal-pan.c b/android/hal-pan.c
index 2bc560e..a2e6060 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,20 @@ static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
 	if (!interface_ready())
 		return BT_STATUS_NOT_READY;
 
+	switch (local_role) {
+	case BTPAN_ROLE_PANNAP:
+		if (remote_role != BTPAN_ROLE_PANU)
+			return BT_STATUS_UNSUPPORTED;
+		break;
+	case BTPAN_ROLE_PANU:
+		if (remote_role != BTPAN_ROLE_PANNAP &&
+						remote_role != BTPAN_ROLE_PANU)
+			return BT_STATUS_UNSUPPORTED;
+		break;
+	default:
+		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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-20  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 14:56 [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles Ravi kumar Veeramally
2013-11-19 14:56 ` [PATCH_v2 2/4] android: Handle multiple init(register) and cleanup(unregister) calls properly Ravi kumar Veeramally
2013-11-20  7:02   ` Szymon Janc
2013-11-20  9:09     ` Luiz Augusto von Dentz
2013-11-19 14:56 ` [PATCH_v2 3/4] android/hidhost: Handle error case properly in interrupt_connect_cb Ravi kumar Veeramally
2013-11-19 14:56 ` [PATCH_v2 4/4] android/hidhost: Free all connected devices in profile cleanup call Ravi kumar Veeramally
2013-11-19 16:20 ` [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).