[PATCH v4 1/1] ltq-vdsl-app: extent dsl metrics with power_level and state_detail
Florian Eckert
fe at dev.tdt.de
Fri Apr 9 09:59:19 BST 2021
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 adds the missing information to the JSON output.
* additional JSON output for state_detail:
"state_detail": {
"exception": false,
"idle": false,
"silent": false,
"handshake": false,
"full-init": false,
"showtime-without-sync": false,
"showtime-with-sync": true,
"resync": false,
"not-initialized": false,
},
* additinal JSON output for power_level:
"power_level": <integer>,
Possible values are if the information is available:
0: L0
1: L1
2: L2
3: L3
Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
.../ltq-vdsl-app/src/src/dsl_cpe_ubus.c | 34 +++++++++++++++++--
1 file changed, 32 insertions(+), 2 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 8eefdfe4d5..d8ebbb584c 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,6 +306,7 @@ 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")
@@ -351,8 +352,21 @@ static void line_state(int fd) {
str = NULL;
break;
};
- if (str)
+
+ if (str) {
m_str("state", str);
+ c = blobmsg_open_table(&b, "state_detail");
+ m_bool("exception", out.data.nLineState == DSL_LINESTATE_EXCEPTION);
+ m_bool("idle", out.data.nLineState == DSL_LINESTATE_IDLE);
+ m_bool("silent", out.data.nLineState == DSL_LINESTATE_SILENT);
+ m_bool("handshake", out.data.nLineState == DSL_LINESTATE_HANDSHAKE);
+ m_bool("full-init", out.data.nLineState == DSL_LINESTATE_FULL_INIT);
+ m_bool("showtime-without-sync", out.data.nLineState == DSL_LINESTATE_SHOWTIME_NO_SYNC);
+ m_bool("showtime-with-sync", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
+ m_bool("resync", out.data.nLineState == DSL_LINESTATE_RESYNC);
+ m_bool("not-initialized", out.data.nLineState == DSL_LINESTATE_NOT_INITIALIZED);
+ blobmsg_close_table(&b, c);
+ }
m_bool("up", out.data.nLineState == DSL_LINESTATE_SHOWTIME_TC_SYNC);
}
@@ -388,8 +402,24 @@ static void g997_power_management_status(int fd) {
str = NULL;
break;
};
- if (str)
+
+ if (str) {
m_str("power_state", str);
+ switch (out.data.nPowerManagementStatus) {
+ case DSL_G997_PMS_L0:
+ m_u32("power_level", 0);
+ break;
+ case DSL_G997_PMS_L1:
+ m_u32("power_level", 1);
+ break;
+ case DSL_G997_PMS_L2:
+ m_u32("power_level", 2);
+ break;
+ case DSL_G997_PMS_L3:
+ m_u32("power_level", 3);
+ break;
+ }
+ }
}
static void g997_xtu_system_enabling(int fd, standard_t *standard) {
--
2.20.1
More information about the openwrt-devel
mailing list