From patchwork Tue Mar 9 12:05:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1449694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=TcAhR2au; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 ozlabs.org (Postfix) with ESMTPS id 4Dvv913nk0z9s1l for ; Tue, 9 Mar 2021 23:07:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=841rSZpRKzbbon5KuRTbYd9jelfQQvc/SltcfILwPR0=; b=TcAhR2auKUY0r6RUpu6k7tCLfA U3s+Q48Ync2FlyJZ4c1aNRtP7TT3DcRzRlm+iVEOs6qejL4w6ypysr0z8qcqGcvOx4fovktTbDErE Tc3p9cBKoXsmRr+4bbJw7gMhSiWRJHPuSgSsrfjwklsYQtGajBnvVj2U48WNwcMvk9DFyjEAvM1Q/ dPj2wbYsWfgiOtC/+Jjvs1uRRNpgUDJFuHnr1puGilTcXo8C9U5i8G1Y6d6rMcJy0vNhBMpPSPWfT DTPR8d6tkfHofgj22ZjCFXIYJVVI+tdoIPhCqeBoIDvU2j+q4oR3ZtFzyWkNXiqbuV6YvzuT34z// nMw2c6BA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJb7f-004P2V-Db; Tue, 09 Mar 2021 12:05:59 +0000 Received: from mxout70.expurgate.net ([91.198.224.70]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJb7b-004P1u-I9 for openwrt-devel@lists.openwrt.org; Tue, 09 Mar 2021 12:05:57 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1lJb7a-0005yt-7d; Tue, 09 Mar 2021 13:05:54 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJb7Z-000KAO-DY; Tue, 09 Mar 2021 13:05:53 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 394CD240041; Tue, 9 Mar 2021 13:05:52 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id CC6D7240040; Tue, 9 Mar 2021 13:05:51 +0100 (CET) Received: from feckert.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 74F7420168; Tue, 9 Mar 2021 13:05:51 +0100 (CET) From: Florian Eckert To: Eckert.Florian@googlemail.com, a.heider@gmail.com, dev@kresin.me Cc: openwrt-devel@lists.openwrt.org Subject: [PATCH v2 1/1] ltq-vdsl-app: add line_state number and power_state number Date: Tue, 9 Mar 2021 13:05:43 +0100 Message-ID: <20210309120543.11533-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,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::1615291553-0000C46D-0C0464D8/0/0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_120555_757527_A0CFBE08 X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -0.7 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: With the old ubus dsl API, the numbers for the individual line_states and power_states were also returned. These were not ported to the new DSL C-API. This commit changes the following JSON output. * current JSON output for state: "state": "Showtime with TC-Layer sync" Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [91.198.224.70 listed in wl.mailspike.net] -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_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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 With the old ubus dsl API, the numbers for the individual line_states and power_states were also returned. These were not ported to the new DSL C-API. This commit changes the following JSON output. * current JSON output for state: "state": "Showtime with TC-Layer sync" * new JSON output for state: "line_state": { "number": 2049, "string": "Showtime with TC-Layer sync" }, * current JSON output for power_state: "power_state": "L0 - Synchronized" new JSON outpug for power_state: "power_state": { "number": 0, "string": "L0 - Synchronized" } Signed-off-by: Florian Eckert --- v2: * Fixed typo .../ltq-vdsl-app/src/src/dsl_cpe_ubus.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c index 52b2be20e1..4629620a90 100644 --- a/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c +++ b/package/network/config/ltq-vdsl-app/src/src/dsl_cpe_ubus.c @@ -306,7 +306,9 @@ static void version_information(int fd) { static void line_state(int fd) { IOCTL(DSL_LineState_t, DSL_FIO_LINE_STATE_GET) + void *c; const char *str; + switch (out.data.nLineState) { STR_CASE(DSL_LINESTATE_NOT_INITIALIZED, "Not initialized") STR_CASE(DSL_LINESTATE_EXCEPTION, "Exception") @@ -351,8 +353,13 @@ static void line_state(int fd) { str = NULL; break; }; - if (str) - m_str("state", str); + + if (str) { + c = blobmsg_open_table(&b, "line_state"); + m_u32("number", out.data.nLineState); + m_str("string", str); + blobmsg_close_table(&b, c); + } m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC); } @@ -377,7 +384,9 @@ static void g997_line_inventory(int fd) { static void g997_power_management_status(int fd) { IOCTL(DSL_G997_PowerManagementStatus_t, DSL_FIO_G997_POWER_MANAGEMENT_STATUS_GET) + void *c; const char *str; + switch (out.data.nPowerManagementStatus) { STR_CASE(DSL_G997_PMS_NA, "Power management state is not available") STR_CASE(DSL_G997_PMS_L0, "L0 - Synchronized") @@ -388,8 +397,13 @@ static void g997_power_management_status(int fd) { str = NULL; break; }; - if (str) - m_str("power_state", str); + + if (str) { + c = blobmsg_open_table(&b, "power_state"); + m_u32("number", out.data.nPowerManagementStatus); + m_str("string", str); + blobmsg_close_table(&b, c); + } } static void g997_xtu_system_enabling(int fd, standard_t *standard) {