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

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