From patchwork Tue Mar 9 11:36:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1449673 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=hpuvPMvg; 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 4DvtX50NwPz9sSC for ; Tue, 9 Mar 2021 22:39:00 +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=rImksDCD0qyqhXK51mCjVHe7kx+JAaUBr0xtoU9zEEQ=; b=hpuvPMvgabjBEDIcGVhbZ1bGQw sNYWfdKP//Tg1oOautR6cnL20k3EyETN3X8HgDIK5INTMxWSMmHLwxf0uRzNOYRvb9HGe9pjiNHLH l9JIB5FtBOO1qVhNidM5uoBxmXE3NyOD4wfXOKajtatZd2whehqkU9tjAer1XmLahNQSemEljhRvu OHJgPXt5Kq5hbzzqph/opvb3oh+wrOAJ+p8jS/jFARTs6RSnZJuezpcMj9ZfZrE04iUziaOXC2gas HEYH3hBGHJahABpTL8XYnNT6BbdFnyU3Gm/qCPgHK6jWJ1jwhHu4nXwiUCpkPOKIVugGZ22+CPKiT AcRsW1cw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJafg-004LCd-W8; Tue, 09 Mar 2021 11:37:05 +0000 Received: from mxout70.expurgate.net ([194.37.255.70]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJafa-004LAI-GN for openwrt-devel@lists.openwrt.org; Tue, 09 Mar 2021 11:37:00 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1lJafT-00048p-MY; Tue, 09 Mar 2021 12:36:51 +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.90) (envelope-from ) id 1lJafS-0001UJ-Sx; Tue, 09 Mar 2021 12:36:50 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id BCCD6240041; Tue, 9 Mar 2021 12:36:49 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 6087C240040; Tue, 9 Mar 2021 12:36:49 +0100 (CET) Received: from feckert.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id D838C20168; Tue, 9 Mar 2021 12:36:48 +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 1/1] ltq-vdsl-app: add line_state number and power_state number Date: Tue, 9 Mar 2021 12:36:38 +0100 Message-ID: <20210309113638.20113-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-ID: 151534::1615289811-00004CF2-56115C05/0/0 X-purgate: clean X-purgate-type: clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_113658_924063_BD5396B1 X-CRM114-Status: GOOD ( 10.93 ) 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) [194.37.255.70 listed in wl.mailspike.net] -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_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": { "mumber": 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": { "mumber": 0, "string": "L0 - Synchronized" } Signed-off-by: Florian Eckert --- .../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..9d78b61188 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("mumber", 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("mumber", out.data.nPowerManagementStatus); + m_str("string", str); + blobmsg_close_table(&b, c); + } } static void g997_xtu_system_enabling(int fd, standard_t *standard) {