cr->matches = i9e_complete_commands(ci->word, audiod_completers);
}
+static void ll_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ i9e_ll_completer(ci, cr);
+}
+
static void version_completer(struct i9e_completion_info *ci,
struct i9e_completion_result *cr)
{
}
EXPORT_AUDIOD_CMD_HANDLER(help)
+static int com_ll(int fd, struct lls_parse_result *lpr)
+{
+ unsigned ll;
+ char *errctx;
+ const char *sev[] = {SEVERITIES};
+ const char *arg;
+ int ret = lls(lls_check_arg_count(lpr, 0, 1, &errctx));
+
+ if (ret < 0) {
+ char *tmp = make_message("%s\n", errctx);
+ free(errctx);
+ client_write(fd, tmp);
+ free(tmp);
+ return ret;
+ }
+ if (lls_num_inputs(lpr) == 0) {
+ char *msg;
+ ll = daemon_get_loglevel();
+ msg = make_message("%s\n", sev[ll]);
+ ret = client_write(fd, msg);
+ free(msg);
+ return ret;
+ }
+ arg = lls_input(0, lpr);
+ for (ll = 0; ll < NUM_LOGLEVELS; ll++) {
+ if (!strcmp(arg, sev[ll]))
+ break;
+ }
+ if (ll >= NUM_LOGLEVELS)
+ return -ERRNO_TO_PARA_ERROR(EINVAL);
+ PARA_INFO_LOG("new log level: %s\n", sev[ll]);
+ daemon_set_loglevel(ll);
+ return 1;
+}
+EXPORT_AUDIOD_CMD_HANDLER(ll)
+
static int com_tasks(int fd, __a_unused struct lls_parse_result *lpr)
{
int ret;
assert(loglevel >= 0);
assert(loglevel < NUM_LOGLEVELS);
me->loglevel = loglevel;
+}
+/**
+ * Get the current log level of the daemon.
+ *
+ * \return Greater or equal than zero and less than NUM_LOGLEVELS. This
+ * function never fails.
+ */
+int daemon_get_loglevel(void)
+{
+ return me->loglevel;
}
/**
void daemon_set_logfile(const char *logfile_name);
void daemon_set_hooks(void (*pre_log_hook)(void), void (*post_log_hook)(void));
void daemon_set_flag(unsigned flag);
+int daemon_get_loglevel(void);
void daemon_set_loglevel(int loglevel);
bool daemon_init_colors_or_die(int color_arg, int color_arg_auto,
int color_arg_no, bool logfile_given);
free(ci.word);
return ret;
}
+
+/**
+ * Complete on severity strings.
+ *
+ * \param ci See struct \ref i9e_completer.
+ * \param cr See struct \ref i9e_completer.
+ */
+void i9e_ll_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *sev[] = {SEVERITIES, NULL};
+
+ if (ci->word_num != 1) {
+ cr->matches = NULL;
+ return;
+ }
+ i9e_extract_completions(ci->word, sev, &cr->matches);
+}
struct i9e_completion_result *cr);
int i9e_print_completions(struct i9e_completer *completers);
int i9e_get_error(void);
+void i9e_ll_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr);
short_opt = o
summary = One-shot mode: Stop grabbing if audio file changes
+m4_include(`com_ll.m4')
+
[subcommand off]
purpose = deactivate para_audiod
[description]
--- /dev/null
+[subcommand ll]
+ purpose = Query or set the log level of the daemon
+ non-opts-name = [severity]
+ [description]
+ If no argument is given, the command prints the severity string (one
+ of the possible string arguments to --loglevel) which corresponds to
+ the current loglevel. Otherwise, if the given argument is a severity
+ string, the current log level is set accordingly.
+ [/description]