*action = EVENT_ACTION_CONF;
else if (streq(buf, "dhcp"))
*action = EVENT_ACTION_DHCP;
+ else if (streq(buf, "boot"))
+ *action = EVENT_ACTION_BOOT;
else {
pb_log("%s: unknown action: %s\n", __func__, buf);
return -1;
return "url";
case EVENT_ACTION_DHCP:
return "dhcp";
+ case EVENT_ACTION_BOOT:
+ return "boot";
default:
break;
}
return 0;
}
+static int user_event_boot(struct user_event *uev, struct event *event)
+{
+ struct device_handler *handler = uev->handler;
+ struct boot_command *cmd = talloc(handler, struct boot_command);
+
+ cmd->option_id = talloc_strdup(cmd, event_get_param(event, "id"));
+ cmd->boot_image_file = talloc_strdup(cmd, event_get_param(event, "image"));
+ cmd->initrd_file = talloc_strdup(cmd, event_get_param(event, "initrd"));
+ cmd->dtb_file = talloc_strdup(cmd, event_get_param(event, "dtb"));
+ cmd->boot_args = talloc_strdup(cmd, event_get_param(event, "args"));
+
+ device_handler_boot(handler, cmd);
+
+ talloc_free(cmd);
+
+ return 0;
+}
+
static void user_event_handle_message(struct user_event *uev, char *buf,
int len)
{
case EVENT_ACTION_DHCP:
result = user_event_dhcp(uev, event);
break;
+ case EVENT_ACTION_BOOT:
+ result = user_event_boot(uev, event);
+ break;
default:
break;
}
" Events can be read from stdin, or provided on the command line.\n"
" User events must have the following format:\n"
"\n"
-" (add|remove)@device-id [name=value] [image=value] [args=value]\n"
+" (add|remove|boot)@device-id [name=value] [image=value] [args=value]\n"
"\n"
" When read from stdin, components are separated by NUL chars\n"
"\n"