From: Luiz Augusto von Dentz Date: Fri, 27 Jul 2018 08:01:04 +0000 (+0300) Subject: agent: Make the first agent to register the default X-Git-Tag: submit/tizen/20200220.012900~1^2~1^2~258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b70a3a580ee4d83ce76a92c569683a7ff0f424cb;p=platform%2Fupstream%2Fbluez.git agent: Make the first agent to register the default This simplifies the handling of default agent and enforce the IO capabilities to be set whenever there is an agent available in the system. Change-Id: I23b3fe9031d2d61ec2adeabf21af5d7a0f721a77 Signed-off-by: himanshu --- diff --git a/src/agent.c b/src/agent.c index ff44d57..183e2f1 100755 --- a/src/agent.c +++ b/src/agent.c @@ -50,13 +50,6 @@ #include "agent.h" #include "shared/queue.h" -#define IO_CAPABILITY_DISPLAYONLY 0x00 -#define IO_CAPABILITY_DISPLAYYESNO 0x01 -#define IO_CAPABILITY_KEYBOARDONLY 0x02 -#define IO_CAPABILITY_NOINPUTNOOUTPUT 0x03 -#define IO_CAPABILITY_KEYBOARDDISPLAY 0x04 -#define IO_CAPABILITY_INVALID 0xFF - #define REQUEST_TIMEOUT (60 * 1000) /* 60 seconds */ #define AGENT_INTERFACE "org.bluez.Agent1" @@ -150,7 +143,7 @@ static void set_io_cap(struct btd_adapter *adapter, gpointer user_data) if (agent) io_cap = agent->capability; else - io_cap = IO_CAPABILITY_NOINPUTNOOUTPUT; + io_cap = IO_CAPABILITY_INVALID; adapter_set_io_capability(adapter, io_cap); } @@ -294,6 +287,11 @@ static struct agent *agent_create( const char *name, const char *path, name, agent_disconnect, agent, NULL); + if (queue_isempty(default_agents)) + add_default_agent(agent); + else + queue_push_tail(default_agents, agent); + return agent_ref(agent); }