From patchwork Thu Mar 17 12:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1606548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Wyqx4G2u; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KK6QG0Bf7z9s5V for ; Thu, 17 Mar 2022 23:48:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uTdHM5iNNu3JG7YISR8f39gSjg++vKLhF4IFU+g4n1Y=; b=Wyqx4G2uLHYwmw Xd4fcOVz0DAdE9XX1M/6QhqFVAchTWn5TxiyVmKWD9k3Qgy4N0qzYrJqQcT8blnaaiCJdsqvFiKKp kddB81vRTsgj7BLbDf1qsZvj1j9/JsbKBcLdoQJzGdQRged0+E7oM0yOAaNpGp5wM0x+EtujrYHFn ldSIGiPHjSWp4xHSKPnfXVYhRL+JmP8lB+Vr1lPiLPNLL1LgT4D4Y73Lin2+f8luK27oh2Lc+wbMd zv0FuNB4qHrySGYOOLF2UZNOIUbv+Q3cJ0ZNnYqndn/8nxIYFUS06HeSSz4EFsLWppUmTBRWaUGiW zRpcq+XN9ZTlByNrKX3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUpRi-00G6dy-IO; Thu, 17 Mar 2022 12:41:38 +0000 Received: from mxout70.expurgate.net ([194.37.255.70]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUpRc-00G6dD-4B for openwrt-devel@lists.openwrt.org; Thu, 17 Mar 2022 12:41:33 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1nUpRX-000Mbd-7k; Thu, 17 Mar 2022 13:41:27 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUpRW-0005Ia-K0; Thu, 17 Mar 2022 13:41:26 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 32EB7240049; Thu, 17 Mar 2022 13:41:26 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id D615D240040; Thu, 17 Mar 2022 13:41:25 +0100 (CET) Received: from localhost.localdomain (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 6C26F25EDF; Thu, 17 Mar 2022 13:41:25 +0100 (CET) From: Florian Eckert To: nbd@nbd.name, Eckert.Florian@googlemail.com Cc: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2] base-files: add uci section name for application led trigger handling Date: Thu, 17 Mar 2022 13:41:20 +0100 Message-ID: <20220317124121.20103-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de X-purgate-type: clean X-purgate: clean X-purgate-ID: 151534::1647520887-000005D6-D321A506/0/0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220317_054132_362466_917902DD X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In order to read out additional options from the uci section in the called led trigger script, this section must also be add as a argument to the application led trigger script. Signed-off-by: Florian Eckert --- package/base-files/files/etc/init.d/led | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [194.37.255.70 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In order to read out additional options from the uci section in the called led trigger script, this section must also be add as a argument to the application led trigger script. Signed-off-by: Florian Eckert --- package/base-files/files/etc/init.d/led | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 51cb8b5178..80db46f4f8 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -33,7 +33,7 @@ load_led() { # execute application led trigger [ -f "/usr/libexec/led-trigger/${trigger}" ] && { - . "/usr/libexec/led-trigger/${trigger}" + . "/usr/libexec/led-trigger/${trigger}" "$1" return 0 } From patchwork Thu Mar 17 12:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1606547 X-Patchwork-Delegate: nbd@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=li6PzRqm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KK6Nt0tFgz9s5V for ; Thu, 17 Mar 2022 23:47:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ol/JppyzVbfstEyEuIZNCLHjL87cU1myLsewVFEFayY=; b=li6PzRqmjWRGh/ Nsh7h2euUiDEX6pyKnqvf+gveu3qt6v2D/PCTN2uW/OynPWRFTtVBJA61voS8jV72qrDk1hwoERo8 UFdOU6XQIXsMVYlH9ILGn/z1WGoPLkpDgqRxXNiJHYwpqnZGgItrTzgZ4nynhQIjA6BF1OdTiUkyF 9nUwTvljVZ1sMcqlKgIMOihCaZOXTEmCnCIFWUKSkYGxDp2GfGePaqYFmhNhQYSmZQAGeAIVOyZDK AV6ObU+4wn491XzWkIWOw2nRehfuO8dFDVxR9sEhutG9Ink+/hJQESdETKxiBH5Kk02/QUbS/Tzb6 +7yhprYdM0muIe5qJLxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUpRu-00G6f5-MX; Thu, 17 Mar 2022 12:41:50 +0000 Received: from mxout70.expurgate.net ([91.198.224.70]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUpRc-00G6dE-4p for openwrt-devel@lists.openwrt.org; Thu, 17 Mar 2022 12:41:33 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1nUpRX-000LKi-GO; Thu, 17 Mar 2022 13:41:27 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUpRW-000LKO-Ti; Thu, 17 Mar 2022 13:41:26 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id A56F9240049; Thu, 17 Mar 2022 13:41:26 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 55580240040; Thu, 17 Mar 2022 13:41:26 +0100 (CET) Received: from localhost.localdomain (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id D304525FA7; Thu, 17 Mar 2022 13:41:25 +0100 (CET) From: Florian Eckert To: nbd@nbd.name, Eckert.Florian@googlemail.com Cc: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] mac80211: add ath10k ledtrigger abstraction Date: Thu, 17 Mar 2022 13:41:21 +0100 Message-ID: <20220317124121.20103-2-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220317124121.20103-1-fe@dev.tdt.de> References: <20220317124121.20103-1-fe@dev.tdt.de> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de X-purgate: clean X-purgate-type: clean X-purgate-ID: 151534::1647520887-00014461-B0716887/0/0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220317_054132_364432_24C5FF77 X-CRM114-Status: GOOD ( 16.58 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This change adds an application trigger ath10k under "/usr/libexec/led-trigger". The kernel LED API of the ath10k does not behave like the netdev trigger. For the netdev trigger, the interface to use [...] Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [91.198.224.70 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This change adds an application trigger ath10k under "/usr/libexec/led-trigger". The kernel LED API of the ath10k does not behave like the netdev trigger. For the netdev trigger, the interface to use can be set under /sys/class/leds//device_name. For the LED ath10k, the interface is added to the supported trigger name. So we have for one interface (phy0) the following triggers for each LED. - phy0rx - phy0tx - phy0assoc - phy0radio - phy0tpt To make it easier for us to configure this, there is now an application trigger. This has additional uci options. - device: which interface we want to use (phyX) - function: which trigger function we want to use (rx|tx|assoc|radio|tpt) The trigger now behaves the same way again netdev trigger. This change is backwards compatible. If the kernel trigger names are used (phyrx | phytx | phyassoc | phyradio | phytpt) this will continue to work. With this change it is now easier to create a LUCI configuration page without Javascript magic. Signed-off-by: Florian Eckert --- package/kernel/mac80211/ath.mk | 8 +++++++ .../files/usr/libexec/led-trigger/ath10k | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 package/kernel/mac80211/files/usr/libexec/led-trigger/ath10k diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 50b1eed9c8..b42a693b8a 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -289,6 +289,14 @@ define KernelPackage/ath10k-smallbuffers VARIANT:=smallbuffers endef +ifdef CONFIG_ATH10K_LEDS +define KernelPackage/ath10k/install + $(INSTALL_DIR) $(1)/usr/libexec/led-trigger + $(INSTALL_DATA) ./files/usr/libexec/led-trigger/ath10k \ + $(1)/usr/libexec/led-trigger +endef +endif #CONFIG_ATH10K_LEDS + define KernelPackage/carl9170 $(call KernelPackage/mac80211/Default) TITLE:=Driver for Atheros AR9170 USB sticks diff --git a/package/kernel/mac80211/files/usr/libexec/led-trigger/ath10k b/package/kernel/mac80211/files/usr/libexec/led-trigger/ath10k new file mode 100644 index 0000000000..7abee76d04 --- /dev/null +++ b/package/kernel/mac80211/files/usr/libexec/led-trigger/ath10k @@ -0,0 +1,24 @@ +#!/bin/sh + +main() { + . /lib/functions.sh + local led="$1" + + local device="$(uci_get system "$led" device)" + local function="$(uci_get system "$led" function)" + local sysfs="$(uci_get system "$led" sysfs)" + + [ -f "/sys/class/leds/${sysfs}/trigger" ] || { + logger -t "leds/ath10k" -p "warning" "LED '${sysfs}' not found" + return 0 + } + + [ "$(cat "/sys/class/leds/${sysfs}/trigger" | grep -q "${device}${function}")" ] && { + logger -t "leds/ath10k" -p "warning" "Trigger '${device}${function}' not found" + return 0 + } + + echo "${device}${function}" > /sys/class/leds/${sysfs}/trigger +} + +main "$@"