eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 19529a4d3a5c9a61661bfcc45f0fbc22d8bc7a59
parent 411834e089f3cad1b0558c579f8754103b85e8bb
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date:   Thu, 19 Sep 2019 10:16:31 -0700

client: Don't register agent without a need

Register agent iff no '--dontask' command-line option has been provided
or there are some other command line options besides '--dontask'

Diffstat:
Mclient/command.c | 6++++++
Mclient/command.h | 1+
Mclient/dbus-proxy.c | 7++++++-
3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/client/command.c b/client/command.c @@ -76,6 +76,12 @@ bool command_option_get(const char *name, const char **value_out) return false; } +bool command_needs_no_agent(void) +{ + return command_option_get(COMMAND_OPTION_DONTASK, NULL) && + (l_queue_length(command_options) == 1); +} + static enum cmd_status cmd_version(const char *entity, char **argv, int argc) { diff --git a/client/command.h b/client/command.h @@ -58,6 +58,7 @@ struct command_family { }; bool command_option_get(const char *name, const char **value_out); +bool command_needs_no_agent(void); bool command_line_find_token(const char *token, uint8_t num_to_inspect); char **command_completion(const char *text, int start, int end); diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c @@ -704,6 +704,9 @@ static void get_managed_objects_callback(struct l_dbus_message *message, while (l_dbus_message_iter_next_entry(&objects, &path, &object)) proxy_interface_create(path, &object); + if (command_needs_no_agent()) + goto no_agent; + if (!agent_manager_register_agent()) { display_error("Failed to register Agent.\n"); @@ -715,6 +718,7 @@ static void get_managed_objects_callback(struct l_dbus_message *message, return; } +no_agent: if (!command_is_interactive_mode()) { command_noninteractive_trigger(); @@ -829,7 +833,8 @@ bool dbus_proxy_exit(void) { struct interface_type_desc *desc; - agent_manager_unregister_agent(); + if (!command_needs_no_agent()) + agent_manager_unregister_agent(); for (desc = __start___interface; desc < __stop___interface; desc++) { if (!desc->exit)