From 980779a583c8ea91fe873c8fc3efd05518e34495 Mon Sep 17 00:00:00 2001 From: Markus Gothe Date: Fri, 7 Feb 2025 14:22:05 +0100 Subject: [PATCH] Don't start ponmngr microservice in PtP-mode. --- ponmngr/files/airoha/lib/xpon/airoha.sh | 40 ++++++++++++++++++++- ponmngr/files/broadcom/lib/xpon/broadcom.sh | 4 +++ ponmngr/files/common/etc/init.d/xpon | 2 ++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/ponmngr/files/airoha/lib/xpon/airoha.sh b/ponmngr/files/airoha/lib/xpon/airoha.sh index 923a996bf..e21f22c52 100644 --- a/ponmngr/files/airoha/lib/xpon/airoha.sh +++ b/ponmngr/files/airoha/lib/xpon/airoha.sh @@ -1,6 +1,44 @@ #!/bin/sh . /lib/functions.sh +. /usr/share/libubox/jshn.sh + +apply_extra_xpon_config() { + local wanport enabled updated + + if [ -f /etc/board.json ]; then + json_init + json_load_file /etc/board.json + json_select network + json_select wan 2>/dev/null + json_get_var wanport device + json_select .. + json_select .. + json_cleanup + + if [ -f /etc/bbfdm/services/ponmngr.json ]; then + json_init + json_load_file /etc/bbfdm/services/ponmngr.json + json_select daemon + json_get_var enabled enable + + if [ "$wanport" = "pon" ]; then + updated=1 + else + updated=0 + fi + + # Avoid writing to flash if not necessary, since it might affect wear-leveling + if [ "$enabled" != "$updated" ]; then + json_add_string enable "$updated" + json_select .. + json_pretty + json_dump > /etc/bbfdm/services/ponmngr.json + fi + json_cleanup + fi + fi +} set_serial_number() { local vendor_id="$1" @@ -46,6 +84,7 @@ apply_xpon_uci_config() { configure_loid_authentication configure_equipment_id configure_onu_version + apply_extra_xpon_config } init_xpon() { @@ -65,4 +104,3 @@ init_xpon() { deinit_xpon() { return } - diff --git a/ponmngr/files/broadcom/lib/xpon/broadcom.sh b/ponmngr/files/broadcom/lib/xpon/broadcom.sh index c69477613..c7eee5fda 100644 --- a/ponmngr/files/broadcom/lib/xpon/broadcom.sh +++ b/ponmngr/files/broadcom/lib/xpon/broadcom.sh @@ -2,6 +2,10 @@ . /lib/functions.sh +apply_extra_xpon_config() { + return +} + set_serial_number() { local vendor_id="$1" local vssn="$2" diff --git a/ponmngr/files/common/etc/init.d/xpon b/ponmngr/files/common/etc/init.d/xpon index a845f34a8..73f047349 100755 --- a/ponmngr/files/common/etc/init.d/xpon +++ b/ponmngr/files/common/etc/init.d/xpon @@ -29,6 +29,8 @@ start_service() { configure_serial_number apply_xpon_uci_config init_xpon + else + apply_extra_xpon_config fi }