Blame SOURCES/0002-agent-Make-the-first-agent-to-register-the-default.patch

d9c819
From 15bcb7be08286c6c59044b4201ad1408dbe93a7e Mon Sep 17 00:00:00 2001
d9c819
From: Gopal Tiwari <gtiwari@redhat.com>
d9c819
Date: Tue, 23 Jul 2019 18:12:20 +0530
d9c819
Subject: [PATCH BlueZ 2/2]     agent: Make the first agent to register the
d9c819
 default
d9c819
d9c819
commit 9213ff7642a33aa481e3c61989ad60f7985b9984
d9c819
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
d9c819
Date:   Fri Jul 27 11:01:04 2018 +0300
d9c819
d9c819
    agent: Make the first agent to register the default
d9c819
d9c819
    This simplifies the handling of default agent and enforce the IO
d9c819
    capabilities to be set whenever there is an agent available in the
d9c819
    system.
d9c819
d9c819
Signed-off-by: Gopal Tiwari <gtiwari@redhat.com>
d9c819
---
d9c819
 src/agent.c | 14 ++++++--------
d9c819
 1 file changed, 6 insertions(+), 8 deletions(-)
d9c819
d9c819
diff --git a/src/agent.c b/src/agent.c
d9c819
index ff44d5755..183e2f190 100644
d9c819
--- a/src/agent.c
d9c819
+++ b/src/agent.c
d9c819
@@ -50,13 +50,6 @@
d9c819
 #include "agent.h"
d9c819
 #include "shared/queue.h"
d9c819
 
d9c819
-#define IO_CAPABILITY_DISPLAYONLY	0x00
d9c819
-#define IO_CAPABILITY_DISPLAYYESNO	0x01
d9c819
-#define IO_CAPABILITY_KEYBOARDONLY	0x02
d9c819
-#define IO_CAPABILITY_NOINPUTNOOUTPUT	0x03
d9c819
-#define IO_CAPABILITY_KEYBOARDDISPLAY	0x04
d9c819
-#define IO_CAPABILITY_INVALID		0xFF
d9c819
-
d9c819
 #define REQUEST_TIMEOUT (60 * 1000)		/* 60 seconds */
d9c819
 #define AGENT_INTERFACE "org.bluez.Agent1"
d9c819
 
d9c819
@@ -150,7 +143,7 @@ static void set_io_cap(struct btd_adapter *adapter, gpointer user_data)
d9c819
 	if (agent)
d9c819
 		io_cap = agent->capability;
d9c819
 	else
d9c819
-		io_cap = IO_CAPABILITY_NOINPUTNOOUTPUT;
d9c819
+		io_cap = IO_CAPABILITY_INVALID;
d9c819
 
d9c819
 	adapter_set_io_capability(adapter, io_cap);
d9c819
 }
d9c819
@@ -294,6 +287,11 @@ static struct agent *agent_create( const char *name, const char *path,
d9c819
 							name, agent_disconnect,
d9c819
 							agent, NULL);
d9c819
 
d9c819
+	if (queue_isempty(default_agents))
d9c819
+		add_default_agent(agent);
d9c819
+	else
d9c819
+		queue_push_tail(default_agents, agent);
d9c819
+
d9c819
 	return agent_ref(agent);
d9c819
 }
d9c819
 
d9c819
-- 
d9c819
2.17.2
d9c819