From patchwork Tue Jan 1 23:44:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019859 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K+aA6CYB"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="PorFSqLG"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrRd0Nfxz9rxp for ; Wed, 2 Jan 2019 10:46:21 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m8yOrviH26ALSKyu6gw8eORIQtzkiIpGOzUDcoW0BNM=; b=K+aA6CYBQFft3C l9N2ctPceKPpQOqnyenqOf/R+h/NY56zWt2mmvoLMXkbv1EBjlg731mxxX2H4RUirkEhjh73rytrN wHIzyuRPakCqsaSezHwda3hlcTujQaQmv8AsA0q7UOntq3CgGVagh+I5Z9DDYs8QWIkPCTl8Knyjn Ll9IkRkBmhRoxilb6yu0NmCaN1g9154RYKgVoTSK3tZsIe8K5H0AeaSFHbKvoh7HyHlqXMYQvq8jo r6D8xYVLhzWgR3bDxJ963kuO2fpUthtNZ1STeDOKs18uBTzAXlxBwFtyiuexRNlEoBhnaI4KfuF1q aR5+BIGE5V1MMPFj1Vjg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjl-0005GM-3W; Tue, 01 Jan 2019 23:46:17 +0000 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::4]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00032t-Dq for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=5r3B2jL2mkv+rJyRhmyJePq+AH9C0nL1+y1uo4VV+2k=; b=PorFSqLGyWpt8kv5RvAOU7HyNJue0vMEBvR5nfhYaK+COTZSV9V1XGINK7A0170HXe fCH1PNu7J2lzv6BR84rbggffisow+6SYChDJe9spEDam+DE1+kWUBqexDL/C3366QnIU wbY0xH+w2BZfNAvF5pks9Tbz7XlyF9QdTafaT07mxqgFig187ENhB06lOy5v2XMbz6Zv t7+HW2UkZEe1CE087zH2g8Lm43VF2Qs0KvId3Q4fuoJo2neuWnA/IPjIOv9fnglkrDIE XcrBOYIV4XT3qx+jNJVi26sp4tiQT2rLKngNHyKmirQHX9lz+RySFctp+gCposCfLRj9 TFaw== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGQORRBv+ASfYPl1MvNNIX2auzOwM9p4BBr44tR1BG9NeeWg9zWig==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 AUTH) with ESMTPSA id y05b79v01Nj3HZt (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id B76B01C7ABE; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:57 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_931674_6D6CB5B3 X-CRM114-Status: UNSURE ( 8.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5301:0:0:4 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 5/7] procd: add start-console support X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 --- plug/hotplug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plug/hotplug.c b/plug/hotplug.c index 80e6e4d..6b5960a 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -297,12 +297,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 { @@ -336,6 +351,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)