summaryrefslogtreecommitdiff
path: root/plug
diff options
context:
space:
mode:
authorMichael Heimpold <mhei@heimpold.de>2019-01-02 00:44:57 +0100
committerJohn Crispin <john@phrozen.org>2019-10-27 14:21:52 +0100
commitba4c4dbbbd65ce45622d9f2a92e9322348ed12ef (patch)
tree09ca3120a25d5dfc34b9192ca66866707a89f968 /plug
parent3e39fe539490e618e068358a68028fa33bf9e247 (diff)
downloadprocd-ba4c4dbbbd65ce45622d9f2a92e9322348ed12ef.tar.gz
procd: add start-console support
This adds a hotplug function to (re-)start inittab entries with askfirst or respawn. At the moment the devices used with these actions must be present during boot otherwise such lines are skipped. However, this prevents having inittab entries with consoles for e.g. USB gadget devices which only appear after kernel module loading and after configuring them with configfs. While it was possible to only scan the inittab for the desired item to start, I assume the inittab to be short and re-running the whole list will be negligible. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Diffstat (limited to 'plug')
-rw-r--r--plug/hotplug.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/plug/hotplug.c b/plug/hotplug.c
index fd29e62..c572ced 100644
--- a/plug/hotplug.c
+++ b/plug/hotplug.c
@@ -312,12 +312,27 @@ send_to_kernel:
exit(-1);
}
+static void handle_start_console(struct blob_attr *msg, struct blob_attr *data)
+{
+ char *dev = blobmsg_get_string(blobmsg_data(data));
+
+ DEBUG(2, "Start console request for %s\n", dev);
+
+ procd_inittab_run("respawn");
+ procd_inittab_run("askfirst");
+
+ DEBUG(2, "Done starting console for %s\n", dev);
+
+ exit(-1);
+}
+
enum {
HANDLER_MKDEV = 0,
HANDLER_RM,
HANDLER_EXEC,
HANDLER_BUTTON,
HANDLER_FW,
+ HANDLER_START_CONSOLE,
};
static struct cmd_handler {
@@ -351,6 +366,10 @@ static struct cmd_handler {
.name = "load-firmware",
.handler = handle_firmware,
},
+ [HANDLER_START_CONSOLE] = {
+ .name = "start-console",
+ .handler = handle_start_console,
+ },
};
static void queue_next(void)