Lines Matching defs:cmd
19 const char *cmd;
28 * and populate the cmd struct with the command string and pressed
33 static int get_button_cmd(int n, struct button_cmd *cmd)
40 cmd->btn_name = env_get(buf);
41 if (!cmd->btn_name)
44 button_get_by_label(cmd->btn_name, &btn);
46 log_err("No button labelled '%s'\n", cmd->btn_name);
50 cmd->pressed = button_get_state(btn) == BUTTON_ON;
51 /* If the button isn't pressed then cmd->cmd will be unused so don't waste
54 if (!cmd->pressed)
60 log_err("No command set for button '%s'\n", cmd->btn_name);
64 cmd->cmd = cmd_str;
71 struct button_cmd cmd = {0};
74 while (get_button_cmd(i++, &cmd) && i < MAX_BTN_CMDS) {
75 if (!cmd.pressed)
78 log_info("BTN '%s'> %s\n", cmd.btn_name, cmd.cmd);
79 run_command(cmd.cmd, CMD_FLAG_ENV);