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

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